This integration allows you to connect your Attentive account with your Salesforce Service Cloud organization. It has three key components:
- Post back Attentive data to Service Cloud — Connect Attentive with your Salesforce CRM to collect subscriber email addresses, phone numbers, and metadata through your Attentive sign-up units. Then, post back this information as a Service Cloud Contact, Lead, or Person Account (depending on how the object is configured).
- Sync Service Cloud data to Attentive — Match and keep your subscriber data in the Attentive platform up to date in real time with Salesforce CRM data from Contacts, Leads, Person Accounts, or other standard and custom objects.
- Customer service integration — Connect Attentive with Service Cloud to allow your customer service team to directly respond and provide text support through the service console. You can use a specific keyword, such as “SERVICE” or “SUPPORT,” to create a case in Service Cloud.
See Salesforce integration overview to learn more about using Salesforce Service Cloud and Marketing Cloud together.
Salesforce product requirements
Before you begin setting up this integration, you must be using one of the following Salesforce product editions:
- Sales Cloud Enterprise edition (or Unlimited/Developer editions)
- Service Cloud Enterprise edition (or Unlimited/Developer editions)
- Platform Starter*
- Platform Plus
*Note: Platform Starter licenses can only sync contacts with the Contact object.
For the Salesforce customer service integration, you must enable the following product tools:
Synchronized metadata
Important to note:
- If a subscriber record already exists (email address exists in Service Cloud), this postback updates the Phone Number of the subscriber and adds the relevant metadata.
- If a subscriber record doesn't exist (no email address in Service Cloud), this postback creates a new record in the relevant object.
The following Salesforce fields are created or updated during the setup process to provide metadata for your Salesforce organization:
Salesforce field | Description |
The Email Address field on Contact/Lead/Person Account object that's updated during the postback (Salesforce standard field). | |
Mobile Phone | The phone number collected through Attentive’s sign-up unit (Salesforce standard field). |
Attentive Opt-In Status | The boolean value (true or false ) to indicate whether the subscriber is opted in to promotional text messages through Attentive. |
Attentive Opt-In Date | The date of opt-in/last opt-in through Attentive’s sign-up unit. |
Attentive Opt-Out Date | The date of opt-out through Attentive’s sign-up unit. This field is blank if subscriber is still opted in. If a subscriber opts back in to SMS, this field is updated to an empty value. |
First Name | (Optional) If First Name is collected by Attentive, this field on the Salesforce object is updated. (This feature must be turned on by your Customer Success Manager.) |
Last Name | (Optional) If Last Name is collected by Attentive, this field on the Salesforce object is updated. (This feature must be turned on by your Customer Success Manager.) |
Additional Custom Attributes | (Optional) This option allows for hard-coded static values that would be the same for all contacts/leads/person accounts to be mapped to a field in Salesforce. (This feature must be turned on by your Customer Success Manager.) An example here is country_code = “US” |
Note: The fields are automatically created on the Lead/Contact/ Person Account object (depending on your configuration), but you may need to edit the page layout in Salesforce to make them visible. See Edit Page Layouts for Standard Objects for details.
Step 1. Install Attentive app in Salesforce
As a Salesforce system administrator, complete the following steps to install the Attentive app.
Important! You must install the app in Salesforce. Without it, the integration won't work.
- Log in to your Salesforce account.
- Select the Salesforce organization for which you want to install the package. For example: Install in Production
- Click the Install for All Users option (1), read and select the acknowledge checkbox (2), and then click Install (3).
The Attentive app is now installed in your Salesforce account.
Step 2. Edit the app profile
Log in to Salesforce Service Cloud and complete the following steps:
- Click the gear icon in the top-right corner and select Setup.
- On the left-side navigation panel, click Apps > App Manager.
- Find the Attentive Service Cloud Prod row.
- Click the drop-down in the row and select Manage.
- On the App Manager page, select Edit Policies.
- In the OAuth Policies section, select Admin approved users are pre-authorized.
- Click Save.
- On the App Manager page, scroll to the Profiles section and select Manage Profiles.
- On the Application Profile Assignment page, select the checkbox next to System Administrator and click Save.
Step 3. Configure chat settings and deployment
Note: This step is only meant for those using the customer service integration (Digital Engagement). You can move on to Step 4 if you're only using the data synchronization/postback.
Complete the following steps to configure your customer service integration:
- Log in to your Salesforce account.
- Enable chat for your account.
- Copy and save the following endpoint; then paste it in the Chat API Endpoint field:
https://d.la1-c2-ia5.salesforceliveagent.com/chat/rest/
- Click Save.
- Create a chat deployment.
Note: We recommend that you consult your Salesforce administrator when doing this. - Save the Deployment ID and Button ID in a safe location.
Step 4. Set up the integration in Attentive
Now, complete the following procedure to set up the integration in Attentive:
- Navigate to the integrations setup page and select Salesforce Service Cloud.
- Complete this step only if you're using the customer service integration: Click the Enable Customer Service Support setting to enable (✓) chat support.
- Complete this step only if you're using the customer service integration: Enter the following details:
- Chat API Endpoint —Enter the URL that you used to configure Salesforce chat in Step 3.
- Deployment Id—Enter the ID of the chat deployment that you configured in Step 3.
- Button Id—Enter the ID of the chat button that you configured in Step 3.
- Support Confirmation Keyword—Enter a keyword (e.g.,
SUPPORT
) that your customers can use to confirm they need assistance. Note that this keyword must match the keyword in your autoresponder. - Support Acknowledgement Message—Enter the message that your customers should receive after replying with the Support Confirmation Keyword.
- (Optional) Resolution Message—Enter the message that your customers should receive to confirm that the support ticket is resolved.
- (Optional) Edit the Email Contact Forwarding toggle. By default, this setting is enabled (✓) and it forwards any phone numbers and email addresses collected by Attentive to your Salesforce Service Cloud account. Additionally, it sets an SMS opt-in status in Service Cloud for sign-ups.
- Click Set up integration.
The Salesforce Service Cloud configuration page appears. - Click the App Installation Type drop-down and select AppExchange.
- Click the Standard Object drop-down and select the object used for the postback (Contact, Person Account, or Lead).
- Click Complete Setup.
Your Salesforce Service Cloud account is now connected to Attentive.
(Optional) Sync Salesforce Service Cloud / Sales Cloud / CRM attributes to Attentive
By using the Attentive Custom Attributes API, you can update a subscriber’s attributes in Attentive in real time whenever a field is set or updated in Salesforce Service Cloud / Sales Cloud / CRM.
Set up Service Cloud to Attentive data sync
As an example, the steps below explain how to update a subscriber’s attributes from the Contact object. You can also use these steps with any other Salesforce standard or custom object.
- Update Salesforce Remote Site Settings. Go to Setup → Security → Remote Site Settings.
- Create a new Remote Site:
- Remote Site Name:
Attentive_Custom_Attributes_API
- Remote Site URL:
https://api.attentivemobile.com
- Remote Site Name:
- Create a new Remote Site:
- Create an Apex Trigger (instructions):
- Write an Apex Trigger on the Contact object named
ContactFieldChangeTrigger
. - Set sObject to
Contact
. - Configure the trigger to fire on the before insert and before update events.
- Select the Is Active checkbox if you want to compile and enable the trigger. This checkbox is selected by default.
- Write an Apex Trigger on the Contact object named
- Implement API Call in Trigger Logic:
- In the trigger logic, check whether any of the fields you're interested in have changed.
- Make the API call to the Attentive custom attributes API directly within the trigger.
Next, insert the following code snippet in the Apex Trigger:
// This example updates the first name and last name fields in Attentive. Please update this code to match your organization's data schema
trigger ContactFieldChangeTrigger on Contact (before insert, before update) {
// Method to make API call to Attentive POST custom attributes API
public static void callAttentiveAPI(List<Contact> newContacts) {
// Update the following variables with your Attentive API endpoint and token
String attentiveApiUrl = 'https://api.attentivemobile.com/v1/attributes/custom';
String attentiveApiToken = '<YOUR_TOKEN_HERE>'; // replace with Attentive API Key
List<String> attentivePayloads = new List<String>();
for (Contact contactRecord : newContacts) {
// Check if any of the specified fields have changed
// Update the following fields with your custom attribute fields
if (contactRecord.FirstName != null ||
contactRecord.LastName != null) {
// Construct the payload for the Attentive API call
Map<String, Object> attentivePayload = new Map<String, Object> {
'properties' => new Map<String, Object> {
// Update the following fields with your custom attribute fields
// format: 'Attentive_custom_attribute_name' => contactRecord.fieldName
'first name' => contactRecord.FirstName,
'last name' => contactRecord.LastName
},
'user' => new Map<String, Object> {
'phone' => contactRecord.MobilePhone,
'email' => contactRecord.Email
}
};
attentivePayloads.add(JSON.serialize(attentivePayload));
}
}
// Make the HTTP POST request to Attentive API in a future method
if (!attentivePayloads.isEmpty()) {
AttentiveFutureCallout.sendPayloads(attentivePayloads, attentiveApiUrl, attentiveApiToken);
}
}
// Trigger handler for before insert and before update
if (Trigger.isInsert || Trigger.isUpdate) {
callAttentiveAPI(Trigger.new);
}
} - Make sure to replace
‘<YOUR_TOKEN_HERE>’
with your API token. Here are instructions on how to generate an Attentive API Key (instructions). - Click Save
- Create an Apex Class (instructions):
- Write an Apex Class named
AttentiveFutureCallout
.
Finally, insert the following code snippet in the Apex Class:
public class AttentiveFutureCallout {
@future(callout=true)
public static void sendPayloads(List<String> payloads, String apiUrl, String apiToken) {
for (String payload : payloads) {
HttpRequest request = new HttpRequest();
request.setEndpoint(apiUrl);
request.setMethod('POST');
request.setHeader('Authorization', 'Bearer ' + apiToken);
request.setHeader('Content-Type', 'application/json');
request.setBody(payload);
// Execute the request
Http http = new Http();
HttpResponse response = http.send(request);
System.debug('Attentive API Response: ' + response.getBody());
}
}
} - Write an Apex Class named
- Click Save
- That’s all! Now, whenever the fields listed in
ContactFieldChangeTrigger
are set or updated, the custom attributes on the corresponding subscriber record are also updated in the Attentive platform.
Questions?
We’re here to help! Contact our White Glove team (whiteglove@attentivemobile.com) to ask about the Attentive + Salesforce Service Cloud integration.