Support Chat Guide v1
Support Chat
Version 1

Integrate with Salesforce Service Cloud

Copy link

This guide explains how to integrate Salesforce Service Cloud with Sendbird Chat through Salesforce Connector. First, download the Salesforce Connector installation package. Then set up the integration environment on both Sendbird Dashboard and Salesforce Setup. After the set-up, create a group channel on Sendbird Chat SDK and create a Case using Salesforce's site to connect to the channel.


Prerequisites

Copy link
  1. You need Service Cloud User permission for users who will use our application. (You can edit this in the Salesforce web page setup.)

  2. You should enable Omni-Channel settings.

  3. You have to check if the Case service channel already exists in Omni-Channels > Service Channels. We use the standard Case object, so it will cause an error if the Case service channel already exists in your org.


Step 1 Download the installation package

Copy link

Salesforce Connector provides a package for Salesforce Service Cloud integration.

  1. You can download the installation package here. As of May 27, 2024, the latest version of the package is 1.71.

  2. Log in to your organization’s Salesforce account with a System Administrator’s ID and password.

  3. Select Install for Specific Profiles... and click Install.

  1. A popup will appear asking if you would like to grant third-party access to Sendbird. See if Sendbird’s websites are checked and check Yes, grant access to these third-party web sites. Then click Continue.

Note: If you see an error message saying Invalid type: UserServicePresence, AgentWork, go to Setup > Feature Settings > Service > Omni-Channel Settings on Salesforce, check the box next to Enable Omni-Channel, and Save.


Step 2 Configure the Sendbird Dashboard settings

Copy link

Now, go to Sendbird Dashboard and add Salesforce integration under Settings > Chat > Integrations. Once Salesforce Connector integrates Salesforce Service Cloud and Sendbird Chat, a conversation within each Salesforce Case takes place in a group channel in Sendbird Chat SDK. Therefore, make sure to configure the group channel settings on Sendbird Dashboard as well to meet your service needs.

Enable Salesforce integration

Copy link
  1. On Sendbird Dashboard, go to Settings > Chat > Integrations and select Salesforce.

  1. Click the Add button in the top-right corner to start Salesforce integration.

  2. The API Token field will appear and you'll need the token later, so copy and save it somewhere safe.

Note: You can enable additional add-on services, such as Einstein Bots, from the Salesforce integration page in the dashboard. But before doing so, you need to complete the settings for Service Cloud. To integrate Einstein Bots with Sendbird Chat, see our documentation on Einstein Bots integration.

Configure group channel settings

Copy link

Once integrated, all conversations between your agents and customers will happen in Sendbird's group channels. Enable the following functionalities of the group channels for a fuller context of your customer service. This can ensure comprehensive and timely customer support, allowing agents to see previous conversations for context and be informed of any change in their Cases.

  1. Go to Settings > Chat > Channels > Group channels.

  2. Turn on Chat history to allow agents to see old messages between them and their customers in a group channel.

  3. Select Joins automatically when invited for Default channel invitation preference.

  4. (Optional) Select which Auto message to send to group channels for specific user and channel events. Auto message is an admin message that is systematically sent to group channels when a specific event occurs. The screenshot below shows the recommended settings for Auto message.


Step 3 Configure the Salesforce Service Cloud settings

Copy link

After configuring group channels on Sendbird Dashboard, go to Salesforce's Setup page and set up the service environment for integration.

Note: As Salesforce Service Cloud offers a wide range of functionalities in their Setup page, use Quick Find in the left menu bar for your convenience.

Create a Sendbird__Setting__c object on Salesforce Service Cloud

Copy link

Register your Sendbird application ID and its API token to Salesforce Service Cloud using a Sendbird__Setting__c object. This can be done on Salesforce's Developer Console in Apex.

  1. In order to create a Sendbird__Setting__c object, you need a user who has the Sendbird Lightening User permission. If there's no user with the access, go to Settings > Users, select a user, and edit Permission Set Assignments to add the permission.

  2. Go to Salesforce's Setup page. Click the Setup button in the top-right corner of your screen and open Developer Console.

  3. On the Developer Console window, go to Debug > Open Execute Anonymous Window in the menu bar and execute the following Apex code. Set the values of Sendbird__ApplicationId__c and Sendbird__ApiToken__c in a Sendbird__Setting__c object.

Sendbird__Setting__c setting = new Sendbird__Setting__c(
    Sendbird__ApplicationId__c = 'YOUR_APPLICATION_ID',
    Sendbird__ApiToken__c = 'YOUR_API_TOKEN'
);
insert setting;
Property nameTypeDescription

Sendbird__ApplicationId__c

string

Specifies your Sendbird application ID. This can be found under Settings > Application > General on Sendbird Dashboard.

Sendbird__ApiToken__c

string

Specifies the Salesforce integration’s API token generated on Sendbird Dashboard. This can be found under Settings > Chat > Integrations > Salesforce on Sendbird Dashboard.


  1. If you want to check the object is created correctly, select the Query Editor tab and execute the following query.
SELECT FIELDS(ALL) FROM Sendbird__Setting__c LIMIT 1
  1. Then a Sendbird__Setting__c object like below is created.

Register a Remote Site

Copy link

To send an HTTP request to and from Salesforce, your Sendbird API request URL must be registered as a Remote Site on the platform.

  1. On Salesforce's Setup page, search Remote Site Settings in the Quick Find search bar. Or go to Setup > Security > Remote Site Settings in the left menu bar.

  2. Click New Remote Site at the top of the Remote Site table.

  1. Fill in each field according to the following instructions.
  • Remote Site Name: Enter any value of your choice. Only alphanumeric characters and underscores are allowed in Remote Site Name. Don't use spaces.

  • Remote Site URL: The URL should be https://api-[YOUR_SENDBIRD_APPLICATION_ID].sendbird.com. Replace [YOUR_SENDBIRD_APPLICATION_ID] in the URL with your Sendbird application ID.

  • Check the box next to Active and Save.

Set up Omni-Channel

Copy link

Once integrated, Support Chat connects Cases in Salesforce with group channels in Sendbird. In order to effectively manage and route these channels to your agents, leverage the Omni-Channel feature in Salesforce. The Omni-Channel feature automatically routes all the work items, such as Cases, to agents based on the agent's capacity, priority, status, and etc. Here, you need to create and configure Service Channel, Presence Status, User Access, and Routing Rule to get started with Omni-Channel.

This guide demonstrates the basic requirements of Omni-Channel for the integration. To learn more about how to customize Omni-Channel, see Salesforce's guide on Omni-Channel.

Service Channels

Copy link
  1. On Salesforce's Setup page, search Omni Channel Settings in Quick Find or go to Omni-Channel > Omni-Channel Settings in the left menu bar.

  2. In the Omni-Channel Settings page, make sure that Enable Omni-Channel is checked. Depending on your service needs, configure other settings such as Skills-Based Routing and Secondary Routing Priority as well.

  3. Go to Setup > Feature Settings > Service > Omni-Channel > Service Channels in the left menu bar and click the New button at the top of the table.

  1. You can now create a new Service Channel for Cases. Fill in each field according to the following instructions and Save the Service Channel.
  • Service Channel Name: Enter any value of your choice. Copy and save the channel name because it’s required when creating a new Presence Status in the following section.

  • Developer Name: Enter any value of your choice.

  • Salesforce Object: Select Case.

  • (Optional) Check the box next to Minimize the Omni-Channel widget when work is accepted.

  • (Optional) Check the box next to Automatically accept work requests. If this option is unchecked, agents manually take Cases routed through Omni-Channel Utility.

Presence Status

Copy link
  1. Go to Setup > Feature Settings > Service > Omni-Channel > Presence Statuses in the left menu bar and click the New button at the top of the table.

Note: If your organization already have Presence Statuses in use, you can add the new Service Channel you've created in the previous section to the existing statuses instead of creating a new Presence Status.

  1. You can now create a new status. Fill in each field according to the following instructions and Save the Presence Status.
  • Status Name: Enter any value of your choice. Examples can be Available and Online. Copy and save the status name because it’s required when granting status access to users in the following section. For more information, see Salesforce's guide on Presence Status Settings.

  • Developer Name: Enter any value of your choice.

  • Status Options: Select Online.

  • Add the service channel you created in the previous section to Selected Channels.

User Access

Copy link
  1. Go to Setup > Users > Profiles in the left menu bar and click the user's profile name who will be using the Omni-Channel feature.

  2. Click or scroll down to the Service Presence Status Access section and click Edit.

  3. Add the presence status you created in the previous section to Enabled Service Presence Status Access and Save.

Routing Rule

Copy link
  1. Go to Setup > Feature Settings > Service > Omni-Channel > Routing Configurations in the left menu bar and click the New button to create a new routing rule. This rule can be applied to your Queues in the following section.

  2. Fill in each field according to the following instructions and Save.

  • Routing Configuration Name: Enter any value of your choice.

  • Developer Name: Enter any value of your choice.

  • Routing Priority: Enter any value of your choice. See Salesforce’s guide on Routing Priority to learn more.

  • Routing Model: Enter any value of your choice. See Salesforce’s guide on Routing Model to learn more.

  • Units of Capacity or Percentage of Capacity (optional): You must enter a value of your choice to either one of the two fields. See Salesforce’s guide to learn more.

Set up Queues and Assignment Rules

Copy link

In Salesforce Service Cloud, each issue raised by customers or agents is called Case and Cases are queued and assigned to its members according to Assignment Rules. Create a Queue and Assignment Rules for the Cases that will be connected to Sendbird channels.

This guide demonstrates the basic requirements for the integration. To learn more about how to customize Queues and Assignment Rules, see Salesforce guide.

Create a Queue and add Members

Copy link

To assign agents to Cases with a Sendbird channel, you must create a dedicated Queue and Assignment Rules for them.

  1. Go to Setup > Users > Queues the left menu bar or search Queues in Quick Find.

  2. Select the New button at the top of the Queues table.

  3. Fill in each field according to the following instructions and Save.

  • Label: Enter Sendbird Chat Queue as shown in the image below. The value of Label must be Sendbird Chat Queue. Otherwise, conversations through Sendbird Chat SDK won’t show in Cases properly.

  • Queue Name: Once Label is entered, Queue Name is automatically generated.

  • Configuration with Omni-Channel Routing: Search and select the Routing Configuration you created in the previous step.

  • Supported Objects: Select Case in Available Objects and add it to Selected Objects.

  • Queue Members: Add Members to Selected Members so that they can be assigned to the Cases that fall into this queue.

Create Assignment Rules

Copy link

If your organization already has a Case Assignment Rule in use, you can use it or add a new rule entry. To add a new one, jump to #4 in the following instructions.

  1. Go to Setup Home > Feature Settings > Service > Case Assignment Rules in the left menu bar or search Case Assignment Rules in Quick Find.

  2. Select the New button at the top of the Assignment Rules table.

  3. Enter a name for the new assignment rule. Check Active and Save. You will return to the Case Assignment Rules page. Click the rule you've just created.

  4. Select the New button in the Rule Entries section.

  5. Enter a new rule entry as shown in the image below and Save.

  • Step 1: Set Sort Order to 1.

  • Step 2: Select Case: Sendbird Channel URL and not equal to for Field and Operator, respectively. Then enter Null in Value as shown below. The Salesforce Connector uses this custom field in the case to identify that it's a case linked to a Sendbird chat channel.

  • Step 3: Select the queue to apply this Assignment Rule to. Select Queue in the dropdown menu and search Sendbird Chat Queue you just created in the previous section.

Assign Permission Set to agents

Copy link
  1. Go to Setup Home > Users > Permission Sets in the left menu bar or search Permission Sets in Quick Find.

  2. Click the Sendbird Lightning User permission set in the table and click Manage Assignments button.

  3. Click the Add Assignment button and

  4. In the table, select the users you want to allow to use Sendbird Chat, click the Next button, and then click the Assign button.

Add UI components

Copy link

With the UI components, agents can hold real-time conversation with customers still accessing all the data on Salesforce Service Cloud. Salesforce Connector provides two types of user interfaces: a utility widget chat UI and a Case-embedded chat UI.

Utility widget UI

Copy link

Add Sendbird Chat Panel as a Utility Item to Salesforce Service Cloud.

  1. Go to Setup > Apps > App Manager and find Service Console in the table. Then click the down arrowhead button at the end of the row and select Edit.

  2. Select Utility Items (Desktop Only) in the left menu bar.

  3. Choose Add Utility Item and select Sendbird Support Chat.

  4. Set the following values to Utility Item Properties.

  • Icon: After removing the default fallback icon, change it to anywhere_chat.

  • Panel Width: Enter any value of your choice. We recommend 860.

  • Panel Height: Enter any value of your choice. We recommend 480.

  • Check the box next to Start automatically and Save.

  1. You'll also need an omni-channel panel UI. Click Add Utility Item and select Omni-Channel under Standard. The values have been pre-set for its properties for optimal performance and can't be edited.

Case-embedded UI

Copy link

Sendbird Chat Panel can be added into the Case view as a UI component.

  1. Select the Apps icon next to Setup in the top-left corner of your screen. Then search Service Console and choose the default Service Console app.

  1. Select any Case of your choice.

  2. Click the Setup button in the top-right corner of your screen and click Edit page.

  1. In the search box located at the top of the left menu bar, search Sendbird Chat Panel. Click and drag Sendbird Chat Panel under Custom - managed to place it where it in a Case. Drag and adjust the component to your needs.

  1. An error message will appear in the embedded chat UI if the Case isn’t linked to a valid Sendbird group channel. To prevent the error message from showing in the UI, use the Component Visibility filter. Select the chat UI component to see the Set Component Visibility sidebar. Then click the Add Filter button and create a filter with the following values.
  • Field: Sendbird Channel URL

  • Operator: Not Equal

  • Value: ''

  1. If the page you added the component to hasn't been activated, select Activation at the top-right corner of the screen.

  2. When an Activation popup appears, go to the APP DEFAULT tab and select Assign as App Default. Select Service Console when the Select Apps popup appears. For Select form factor, select Desktop and click the Next button. Review assignment and Save.

  1. If changes are saved, you can go back to the Case view and see if the chat UI component is working properly.

Step 4 Try the live demo

Copy link

The configurations for integration are completed. Before jumping onto building your application with Sendbird Chat SDK, you can visit our live demo to try out the chat experience that Salesforce Connector offers.

Note: We recommend that this demo application should be tested with a development or testing account on Salesforce to prevent any confusion. While Sendbird doesn’t retrieve or store any sensitive Salesforce data to the Sendbird server, creating Cases in your Salesforce organization through this demo application can cause inconvenience or confusion among users if used with the production account.

The demo showcases the chat experience from an end-user's perspective, enabling you to create a Salesforce Case by sending a message and initiating a chat with an agent in a Sendbird’s group channel.

  1. Select Login with Salesforce to enter your account ID and password.

  2. Select Allow to allow Salesforce Connector to access user data and identity URL service.

  1. Click the Start chat button in the top-right corner of the sample app to begin a chat.

  2. Confirm that the Salesforce Case is created correctly on your Salesforce Service Console. If you have enabled Einstein Bots, the bot takes the Case. If not, an agent is assigned to it in Salesforce Service Console.

  3. Confirm if the Sendbird Chat Panel UI component you added earlier displays the chat in the agent view.


Step 5 Client-side implementation

Copy link

Once you’ve set up both Sendbird Dashboard and Salesforce Service Cloud for integration, implement the client application.

Salesforce Connector links a Salesforce’s Case to a group channel in Sendbird with its channel URL. So, link the group channel's URL to the Sendbird__ChannelUrl__c property of Case. Set the optimal configurations of group channels including setting the value of custom_type to SALESFORCE_SUPPORT_CHAT_CHANNEL.

Once the group channel are set, add the SampleCaseController class to Salesforce Service Cloud to handle the API requests for Cases and create a Case using a RESTful API. Salesforce Service Cloud doesn’t provide both a client-side SDK and a dedicated server to process the API requests related to Cases. Thus, use AWS’ Lambda, your own server, or create an API endpoint in Apex to handle API calls. This guide demonstrates how to create a public endpoint in Apex for a quick and easy implementation.

For the implementation of general chat features such as loading a list of group channels, entering a channel, and sending messages, see our Sendbird Chat Docs.

Note: This sample is intended to serve as a quickstart for your convenience and doesn’t support crucial security features such as a validator, authenticator, error handling, security checks, etc. We strongly recommend that developers thoroughly review and test any codes before deployment and modify them to meet the security and functionality requirements of your organization. We aren't responsible for any damages or issues that may arise from the use of this sample code. To learn more about authorization on Salesforce, visit Salesforce’s guide.

Set the custom type of group channels

Copy link

First of all, a group channel must be created so that its channel URL can be passed to a Case in Salesforce and the connection is made. In order for Salesforce Connector to recognize such group channels, the channel's custom_type must be set to SALESFORCE_SUPPORT_CHAT_CHANNEL. The following is an example of group channel data in JSON format.

{
  "name": "User Inquiry: Payment not working",
  "channel_url": "support-chat-23489",
  "cover_url": "https://sendbird.com/main/img/cover/cover_08.jpg",
  "custom_type": "SALESFORCE_SUPPORT_CHAT_CHANNEL",
  "unread_message_count": 0,
  "data": "",
  "members": [],
  /* Other group channel properties below ...*/
}

Group channel properties

Copy link

Besides the group channel’s custom_type, the following properties need to be checked for Salesforce Connector integration.

For example, once Salesforce Connector is integrated, a group channel must be created in your client app or through Sendbird Platform API for each Case so that the channel can be linked to the Case with its channel URL. To do so, the group channel’s channel_url should be passed to the Case’s Sendbird__ChannelUrl__c property.

Add the following custom fields to the Case so that each Case object can be linked to a group channel in your Sendbird application.

Property nameTypeDescription

Sendbird__UserId__c

string

Specifies the unique ID of the user who created the Case. This user ID is from your Sendbird application.

Sendbird__ChannelUrl__c

string

Specifies the URL of the group channel to be linked to the Case on Salesforce Service Cloud.

Sendbird__IsEinsteinBotsCase__c

boolean

Indicates whether the Einstein Bots feature is enabled for the Case. The value of true returns only if you are using the bot service on Salesforce. To integrate Einstein Bots with Sendbird Chat, see Salesforce Einstein Bots integration. To learn more about the Bots, see Salesforce's guide.

The group channel, linked to a Case, synchronizes the Case's status information to its metadata.caseStatus property. You can also be notified of such change by adding a channel event handler such as onMetaDataUpdated. To learn more about event handlers, see this page.

By tracking the change of Case status, Salesforce Connector also supports a functionality that enables an agent to leave a group channel when the Case is closed. To enable this feature, the Case status label of Closed should not be edited or changed. Make sure that the status label for closed Cases is set to Closed in Setup > Object Manager > Case > Fields & Relationships > Status.

Create a Case through a REST API

Copy link

There are multiple ways to create a Case, such as making a REST API request, but this guide uses a public domain and Apex REST API. By default, the Salesforce REST API requires authentication. However, in this guide, you will create a public endpoint using Salesforce’s Site, which allows you to make calls without authentication.

Note: Depending on your organization environment on Salesforce Service Cloud, you may need OAuth authentication and Salesforce RESTful API to create a Case on your website or application. See Salesforce's guide on OAuth 2.0 Client Credentials Flow for Server-to-Server Integration.

Add the SampleCaseController class

Copy link

Before creating a Site, add the SampleCaseController class to Salesforce Service Cloud.

  1. Select the Setup button in the top-right corner of your screen to open Developer Console.

  2. When the console appears, go to File > New > Apex Class. Enter a new class name SampleCaseController and select OK.

  3. Copy and paste the following code into the console and Save.

// For the REST API, we use the RestResource annotation.
// We map it to /cases/, so the final URL is YOUR-PUBLIC-DOMAIN/services/apexrest/cases/.
@RestResource(urlMapping='/cases/')
global with sharing class SampleCaseController {
    // Use a POST method to create a Case object.
    @HttpPost
    global static void create() {
        RestRequest request = RestContext.request;
        RestResponse response = RestContext.response;
        Map<String, String> headers = request.headers;

        // To use the request body, deserialize it. In this sample, we use Map.
        String requestBodyStr = request.requestBody.toString();
        Map<String, Object> body = (Map<String, Object>) JSON.deserializeUntyped(requestBodyStr);

        // Create a Case record and edit its status by setting its parameters.
        // Sendbird__UserId__c, Sendbird__ChannelUrl__c, and Sendbird__IsEinsteinBotsCase__c are required.
        Case newCase = new Case();
        newCase.Subject = (String) body.get('subject');
        newCase.Description = (String) body.get('description');
        newCase.SuppliedName = (String) body.get('suppliedName');
        newCase.SuppliedEmail = (String) body.get('suppliedEmail');
        newCase.Sendbird__UserId__c = (String) body.get('sendbirdUserId');
        newCase.Sendbird__ChannelUrl__c = (String) body.get('sendbirdChannelUrl');
        newCase.Sendbird__IsEinsteinBotsCase__c = (Boolean) body.get('isEinsteinBotsCase');

        // Save your new Case.
        insert newCase;

        // Get a response with the information of your new Case.
        response.addHeader('Access-Control-Allow-Origin', '*');
        response.responseBody = Blob.valueof(JSON.serialize(newCase));
        response.statusCode = 200;
    }
}

Create a public endpoint

Copy link
  1. On Salesforce's Setup page, go to Setup > User Interface > Sites and Domains > Sites in the left menu bar. If you already have a site domain you can use, click Site Label of your choice and skip to #5. If you don’t have a site yet, check Sites Terms of Use first and select Register My Salesforce Site Domain.

  2. Click the New button at the top of the Sites table.

  1. Fill in and check each item according to the following instructions.
  • Site Label: Enter a name of your choice.

  • Site Name: This is automatically generated once you’ve entered Site Label.

  • Active Site Home Page: Choose any site from the search list. This won’t affect the behavior of the Site.

  • Check the box next to Active.

  • Check the box next to Lightning Features for Guest Users.

  • Check the box next to Enable Content Sniffing Protection.

  • Check the box next to Referrer URL Protection.

  • Check the box next to Redirect to Custom Domain.

  • Check the box next to Cache public Visualforce pages.

Note: Make sure to leave the Default Web Address empty.

  1. Save the Site and you will see Site Details of the new site you’ve created. Select Public Access Settings at the top of the Site Detail table.

  1. Select Enable Apex Class Access at the top of the table. This will land you to the Enabled Apex Class Access section. Then choose Edit next to the section title.

  1. Select SampleCaseController from Available Apex Classes and add it to Enabled Apex Classes. Then Save.

  2. You will see the controller added as an accessible class.

  3. Click edit button in the page and find Standard Object Permissions tab. Grant Read and Create basic access for Case.

  4. On Salesforce's Setup page, go to Setup > Sharing Settings in the left menu bar. At the bottom, click "New" under "Setting Sharing Rules". Select your account created in step 4.

  5. Select "Guest user access, based on criteria" and set the criteria to "API Token not equal to Null." Then, for the user, choose the user created in step 5 above.

  6. Now you can send a message to the Apex REST API server you’ve created and create a Case using the following sample. Copy the Site URL from the Sites list and use it in the request URL. Then copy and paste the following request body to your client app.

// Use a POST method at 'YOUR-PUBLIC-DOMAIN/services/apexrest/cases/'
// A trailing slash is required in the URL.

// Request body
{
    "subject": "chat",
    "suppliedName": "chat user",
    "suppliedEmail": "user@test.com",
    "sendbirdUserId": "user@123",
    "sendbirdChannelUrl": "channel@url@123",
    "isEinsteinBotsCase": false
}