Support Chat Guide v1
Support Chat
Version 1

Customer Satisfaction (CSAT)

Copy link

The Customer Satisfaction (CSAT) feature enables users to rate their experience after interacting with an agent. When CSAT is activated, a CSAT question message is sent to the user once the chat session has ended. Users can then provide feedback by selecting a satisfaction score and optionally leaving a comment. The feedback gathered from CSAT responses helps enhance the quality of customer support services.


Prerequisites

Copy link
  1. Sendbird Chat SDK integration with Salesforce Service Cloud. See guide.

Granting admin user permissions

Copy link

Admin users need Sendbird Lightning User permission to configure CSAT settings. If a user doesn't have this permission, do the following:

  • Go to Setup > Administration > Users > Users, then click on a user.
  • Click on Permission Set Assignments > Edit Assignments.

  • Find Sendbird Lightning User in the list of available permission sets and click Add, then click Save.


Step 1: Update Salesforce User's Chat UI

Copy link

CSAT Message Types

Copy link

The CSAT functionality uses specific custom message types:

  • CSAT Question: Sent as an admin message with custom type SALESFORCE_SUPPORT_CHAT_CUSTOMER_SATISFACTION
  • CSAT Response: Sent with custom type SALESFORCE_SUPPORT_CHAT_CUSTOMER_SATISFACTION_RESPONSE

The UI should be customized to display CSAT questions differently from standard admin messages, including options for scoring and comments.

Implementation Details

Copy link

When submitting feedback, include the following data as a JSON string:

  • question_message_id (Required): ID of the original CSAT question message.
  • csat_score (Required): User's satisfaction score.
  • csat_comment (Optional): User's feedback comment.

Code Examples

Copy link

Case 1: Using Collection

Copy link
collection.setMessageCollectionHandler({
  onMessagesAdded: (context: MessageEventContext, channel: GroupChannel, messages: BaseMessage[]) => {
    if (channel.customType === 'SALESFORCE_SUPPORT_CHAT_CHANNEL') {
      const csatMessage = messages[0];
      if (csatMessage instanceOf AdminMessage) {
        if (csatMessage.customType === 'SALESFORCE_SUPPORT_CHAT_CUSTOMER_SATISFACTION') {
          // Draw CSAT Screen
          drawCsat(channel, csatMessage);
        }
      }
    }  
  },
  // ...
});

Case 2: Using GroupChannelHandler

Copy link
channel.addGroupChannelHandler('HANDLER_KEY', new GroupChannelHandler({
  onMessageReceived: (channel: GroupChannel, message: BaseMessage) => {
    if (channel.customType === 'SALESFORCE_SUPPORT_CHAT_CHANNEL') {
      if (message instanceOf AdminMessage) {
        if (csatMessage.customType === 'SALESFORCE_SUPPORT_CHAT_CUSTOMER_SATISFACTION') {
          // Draw CSAT Screen
          drawCsat(channel, message);
        }
      }
    }
  }
}));

drawCsat(channel: GroupChannel, csatMessage: AdminMessage): void {
  const satisfactionMessageData = JSON.parse(csatMessage.message);
  // code for display csat screen
  // use satisfactionMessageData.body
  // when rating completed.
  const csatResponse = {
    question_message_id: csatMessage.messageId,
    csat_score: score,
    csat_comment: comment,
  };
  channel.sendUserMessage({
    customType: 'SALESFORCE_SUPPORT_CHAT_CUSTOMER_SATISFACTION_RESPONSE',
    message: JSON.stringfy(csatResponse),
  });
}

CSAT Response Format

Copy link

When a CSAT question message includes a rating, the data field contains:

{
  "data": "{
    \"csat_comment\": \"good\",
    \"csat_score\": \"4\",
    \"csat_rated_message\": \"Thanks for your feedback!\",
    \"csat_question_message\": \"How was your conversation?\"
  }"
}

Step 2: Enable CSAT

Copy link

To enable CSAT, update the properties related to CSAT settings in the Sendbird__Setting__c object using Salesforce's Developer Console. To learn more, see our documentation.

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

  2. Update the Sendbird__Setting__c object with the following properties:

Property NameTypeDescription

Sendbird__EnableCsat__c

boolean

Determines whether to enable CSAT feature. An option to receive customer satisfaction feedback after closing a chat. The value should be set to true.

sendbird__CsatQuestionMessage__c

string

Satisfaction rating message after closing the chat.

sendbird__CsatRatedMessage__c

string

Response to customer's CSAT feedback.


  1. Once you've updated the object, select the Query Editor tab at the bottom of the Developer Console window and execute the following query.
SELECT id, Sendbird__EnableCsat__c, Sendbird__CsatQuestionMessage__c, Sendbird__CsatRatedMessage__c 
FROM Sendbird__Setting__c 
LIMIT 1
  1. Update the CSAT settings as shown in the example below.

Note: If multiple objects exist, Sendbird uses the oldest Sendbird__Setting__c object.


Step 3: Updating CSAT Feedback in Salesforce Case

Copy link

To add CSAT feedback data to a Case, use the Sendbird Chat Platform API. This allows you to log customer CSAT feedback and retrieve CSAT records updated over a specific period. For more information, refer to the Sendbird Chat Platform API documentation here.

HTTP request

Copy link
GET https://api-{{app_id}}.sendbird.com/v3/salesforce_channel_csat_logs/

Parameters

Copy link

The following table lists the parameters that this action supports.

Properties
RequiredTypeDescription

start_dt

string

Specifies the start date and time for the range of CSAT logs to retrieve. The date string should be in the format %Y-%m-%dT%H:%M:%SZ.

end_dt

string

Specifies the end date and time for the range of CSAT logs to retrieve. The date string should be in the format %Y-%m-%dT%H:%M:%SZ.

OptionalTypeDescription

token

string

Specifies a page token that indicates the starting index of results to retrieve. If not specified, the index is set to 0.

limit

int

Specifies the number of bots to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10)

Response

Copy link

If successful, an example response is as follows:

{
    "salesforce_channel_csat_logs": [
        {
            "channel_url": "sendbird_group_channel_12345",
            "last_agent_user_id": null,
            "question_message_id": 249528566,
            "response_message_id": 249528762,
            "csat_question_message": "How was your conversation?",
            "csat_score": 4.0,
            "csat_comment": "great",
            "responded_ts": 1730878375630,
            "created_at": "2024-11-06T07:32:56Z",
            "updated_at": "2024-11-06T07:32:56Z"
        }
    ],
    "next": "YB0RRFZTS1JAEEZdXF1afx"
}