Setting up social channels
Set up the conversational channels connections including Apple Business Chat, WhatsApp, SMS, and Facebook within the Digital Messaging Manager of your Digital messaging interface to enable customers to interact with Pega Intelligent Virtual Assistant (IVA) by sending messages from the respective messaging channels. By performing this task, you ensure that users can quickly and efficiently request information or report problems with your application through these conversational channels.
Setting up Apple Business Chat
- Add a digital messaging channel connection of your choice in Digital Messaging Manager. For information on adding a connection, see Adding a social messaging channel connection.
- On the Apple Business Chat Accounts page, click the Add new ABC account icon.
- In the Add New Business Chat Account window, in the Account Name field, enter a label for your Apple Business Chat account to use in the system.
- In the Business Chat ID field, enter an identifier for
your Apple Business Chat account.Apple generates a unique Business Chat identifier when you create an account in the Apple Business Chat portal.
- Click Submit.
- The system displays the Apple Business Chat connection in the Connections section.
- Close the window, and then in your Digital Messaging interface, click Save.
Setting up WhatsApp
- Add a digital messaging channel connection of your choice in Digital Messaging Manager. For information on adding a connection, see Adding a social messaging channel connection.
- On the Twilio WhatsApp Accounts page, click Add New Twilio WhatsApp Number.
- In the Add New Twilio WhatsApp Number window, perform the
following tasks:
- In the Name field, enter a name for your WhatsApp account.
- In the Number field, enter a WhatsApp number, including the country code.
- In the Account SID field, enter the identifier
for your Twilio account.
Twilio generates a unique identifier when you create a Twilio account.
- In the Auth Token field, enter the authorization
token for your Twilio account.Twilio generates an authorization token when you create a Twilio account.
- Click Submit.
- In the Webhook for Twilio WhatsApp section, select and copy the generated webhook URL for WhatsApp.
- Define the webhook URL for the WhatsApp numbers in your Twilio account by
performing the following steps:
- Log in to your Twilio account.
- Click the More icon, and then click Programmable SMS WhatsApp Senders.
- In the displayed list, select a WhatsApp number, and then click Configure.
- In the Twilio Senders for WhatsApp window, in the
Senders Configuration section in the
A Message Comes In field, paste the webhook
URL that you copied in step 7.This action ensures that when your phone number receives inbound messages from WhatsApp Messenger, Twilio forwards the messages to the IVA channel.
- To add additional WhatsApp numbers for your Twilio account to the webhook URL, repeat steps 8.c through 8.d.
- Click Close.
- The system displays the WhatsApp connection in the Connections section of Digital Messaging Manager.
- Close the window, and then in your Digital Messaging interface, click Save.
Setting up SMS
- Add a digital messaging channel connection of your choice in Digital Messaging Manager. For information on adding a connection, see Adding a social messaging channel connection.
- On the SMS Accounts page, click Add New Twilio
Number.This action ensures that you give permission to your Twilio SMS account to send and receive messages on behalf of the IVA channel.
- In the Add New Twilio Number window, perform the following
steps: in the
- In the Name field, enter a name for your Twilio account.
- In the Number (Please include country code) field, enter the phone number, including the country code, for your Twilio account.
- In the Account ID field, enter the identifier
for your Twilio account.Twilio generates a unique identifier when you create a Twilio account.
- In the Auth Token field, enter the authorization
token for your Twilio account.Twilio generates an authorization token when you create a Twilio account.
- Click Submit.
- On the SMS Accounts page, highlight and copy the generated webhook URL for Twilio.
- Access your account on the Twilio portal, click Manage Numbers, and then click Active Numbers.
- In the Messaging section, in the field next to the
A Message Comes In webhook section, paste the webhook
URL that you copied in step 7.This action ensures that when your Twilio phone number receives inbound SMS messages, Twilio forwards the messages to the IVA channel.
- The system displays the SMS connection in the Connections section of Digital Messaging Manager.
- Close the window, and then in your Digital Messaging interface, click Save.
Setting up Facebook
- Add a Digital Messaging channel connection of your choice in Digital Messaging Manager. For information on adding a connection, see Adding a social messaging channel connection.
- Log into your Facebook account using your Facebook Admin account credentials. You must use an account that is an admin of the Facebook page that you want to authorize.
- In the open window, click Continue as <YOUR NAME>.
- In the page selection window for your Facebook page application, select the checkbox for the Facebook page that you plan to use with your Pega Customer Service application, and then click Next.
- Review the permissions for your Facebook page, and then click Done.
- Click Ok.
- To display Get Started in the
Facebook Messenger, turn on the Messenger Get Started Button switch.
Users see Get Started on the welcome screen in Messenger. When the user clicks Get Started, the Get Started message is posted in the conversation, and the page is granted permission to send messages.
- Close the window, and then in your Digital Messaginginterface, click Save.
Client Channel API
The Client Channel API provides you with a standardized method to exchange messages between several types of third-party client channels, for example, Teams, Webex, or Slack, and Digital Messaging Service.
The process of sending and receiving messages as JSON payload requests using the Client Channel API consists of four stages:
- Your client channel sends messages to the integration layer that you configure in premises (back-end), using the communication method that is specific to the type of client channel.
- In your integration layer, transform the received client channel payload into
the format that is required by the Client Channel API. Then, pass the message to
the endpoint for the Digital
Messaging Service.
This endpoint is the Digital Messaging Webhook URL that the system specifies in your Digital Messaging Manager and Client Channel API settings, for example:
https://incoming.artemis.pega.digital/messages
The Digital Messaging Service then forwards the message to your Pega Customer Service application.
- Your Pega Customer Service application returns a response to the Digital
Messaging Service which then forwards the response to the endpoint that you
specify for your integration layer in your Digital
Messaging Manager Client Channel API settings, for
example:
https://sampleclientchannelwebhook.com
. You must configure the webhook URL so that the URL is publicly accessible (off VPN) to enable communication with Digital Messaging Service. If your integration layer is behind a firewall or otherwise limits access to internal-only users and components, you must set up the webhook URL so that the URL is reachable publicly. - Your integration layer transforms the received Digital Messaging Service payload into the required format by your client channel, and then passes the message to the client channel endpoint.
Supported message types
The system supports the following features during communication from a client channel to the Digital Messaging service:- Text messages
- Typing indicators
- Attachments
- Postbacks
- End session event (customer ended the conversation)
- Context data
- Text messages
- Typing indicators
- Attachments
- List pickers
- Links/buttons
- Carousels
- End session event (CSR/chatbot ended the conversation)
Creating a client channel connection
Use the Client Channel API to securely communicate between your Pega Customer Service application, your integration layer, and third-party client channels, for example, Teams, Webex, or Slack. As a result, you make Digital Messaging more accessible by engaging with your customers in their preferred social messaging channels. The Client Channel API provides you with a Digital Messaging Service endpoint to which you can send payload requests in JSON format. The payload requests indicate an action during a chat conversation, for example, when a customer in the client channel sends a message. Similarly, you can set up an endpoint for your integration layer to receive payload requests from the Digital Messaging Service, for example, when the chatbot or CSR sends a reply or is busy typing.
- In the Digital Messaging Manager of your Digital Messaging interface, select Add connection, and then click the Client Channel APIicon.
- In the New Client Channel API section, complete the
following fields:
- In the Name field, enter a unique name for your channel.
- In the Client webhook field, enter the URL of a
client webhook.
- Click Save.
Client Channel API guidelines
Use the guidelines in this section to help you design the best possible third-party client channel integration with the Digital Messaging channel.
Consider the following best practices for your client channel integration with the Client Channel API:
- The Client Channel API does not provide a direct integration to any client channels, for example, Slack or Teams.
- You cannot create an integration in your local environment that directly connects to your client channel and Digital Messaging Service. You must build a custom integration layer in your back-end that meets the endpoint and payload requirements for both your client channel and the Client Channel API, in order to pass messages between them.
- Each client channel has unique setup and configuration guidelines for integrating with an API. Consult the documentation for the client channel for specific instructions on how to configure the integration.
- You must configure the URL endpoints on your back-end to enable the message delivery between your client channel and the Client Channel API. The endpoint for the Client Channel API is displayed in your Digital Messaging Manager settings. For your client channel endpoints, consult API instructions that are specific to your third-party client channel, in order to create your implementation endpoints. You must configure the webhook URL so that the URL is publicly accessible (off VPN) to enable communication with Digital Messaging Service. If your integration layer is behind a firewall or otherwise limits access to internal-only users and components, you must set up the webhook URL so that the URL is reachable publicly.
- You must secure all endpoints using the Transport Layer Security (TLS) protocol, by using https.
- The system uses JSON Web Tokens (JWT) to authenticate the communication in both directions, between your back-end and Digital Messaging Service. You must generate a valid JWT to include in each request to send.
- The Client Channel API does not track chat sessions. You must handle session control in your integration layer or the client channel.
Client Channel API payload requirements
To communicate between your Digital Messaging channel and a third-party client channel for example, WebEx or Teams, you use the Client Channel API by sending and receiving JSON data in a specific payload format. As a result, your integration layer can interact with Digital Messaging Service and your third-party client channel in the correct format, providing a seamless experience to the customer. You can configure different payload types in the same API in your integration layer.
Authorization
To send and receive JSON requests between the integration layer and Digital Messaging Service, JSON payload headers must include the following information:
- Authorization token
- The "Bearer {JWT}" value.
- The connection_id value
- The unique ID of the connection for your client channel.
Your integration layer must generate an authorization token that you include in each JSON request. Use the connection_id value as the JSON Web Token (JWT) issuer and sign the JWT using the value for JWT Secret, as shown in the following sample code:
var jwt = require("jsonwebtoken")
const token = jwt.sign({iss: "connection_id"}, 'jwt_secret');
console.log(token);
After you successfully add a Client Channel API connection in the Digital Messaging Manager, the system stores the connection_id and JWT Secret values in your Client Channel API settings. For more information, see Creating a client channel connection.
Incoming payload format
To send request payloads from your integration layer to Digital Messaging Service,
invoke POST {DIGITAL_MESSAGING_WEBHOOK}
with a JSON request body,
for example: POST
https://incoming.artemis.pega.digital/messages
When a customer performs any of the following actions in the client channel, send a request payload from your integration layer:
- Sends a message
- Is busy typing their message
- Ends the chat conversation
- Customer message
The following is the JSON body format of the request payload for the customer message that your integration layer sends to Digital Messaging Service:
Body (JSON) { "type": "text", "customer_id": "string", "customer_name": "string", "message_id": "string", "text": ["string"], "postback": "string", "attachments": [ { "url": "string" } ], "context_data": { "string": "string" } }
The following table describes the parameters passed in the Customer message payload request:
Parameter | Description | Type |
type | The static value "text" | Required |
customer_id | The ID of the customer sending the message. The ID is a unique value that is provided by the client channel. | Required |
customer_name | The name of the customer sending the message. | Optional |
message_id | The ID of the message. The ID is a unique value that is provided by the client channel and must be different for every message. | Required |
text | An array of strings that specify messages from the customer. See also the note below. | Optional |
postback | The payload value of the menu or carousel item that is selected. See also the note below. | Optional |
attachments.[].url | Temporary private URL that references a file attachment. See also the note below. | Optional |
context_data.key | The context data key. | Optional |
context_data.value | The context data value. | Optional |
- Typing indicator
- The following code is the JSON body format of the request payload that your integration layer sends to Digital Messaging Service when the customer is typing a message:
Body (JSON)
{
"type": "typing_indicator",
"customer_id": "string",
}
The following table describes the parameters passed in the Typing indicator payload request:
Parameter | Description | Type |
type | The static value "typing_indicator". | Required |
customer_id | The ID of the customer that is sending the message. The ID is a unique value that is provided by the client channel. | Required |
- Customer ended the conversation
- The following is the JSON body format of the request payload that your integration layer sends to Digital Messaging Service when the customer ends the conversation:
Body (JSON)
{
"type": "customer_end_session",
"customer_id": "string",
}
The following table describes the parameters passed in the Customer ended the conversation payload request:
Parameter | Description | Type |
type | The static value "customer_end_session". | Required |
customer_id | The ID of the customer that is sending the message. The ID is a unique value that is provided by the client channel. | Required |
Outgoing payload format
To receive request payloads from Digital Messaging Service in your integration layer, the system usesPOST {CLIENT_WEBHOOK}
to send a
JSON request body, for example: POST
https://sampleclientchannelwebhook.com
You receive a request payload in your integration layer when the chatbot or CSR performs one of the following actions in your Digital Messaging channel:
- Sends a message
- Displays a menu
- Displays a carousel
- Sends a link
- Is busy typing in the chat window
- CSR ends the chat conversation
- CSR message
The following is the JSON body format of the request payload that your integration layer receives from Digital Messaging Service when the chatbot or CSR sends a message:
Body (JSON) { "type": "text", "customer_id": "string", "message_id": "string", "csr_name": "string", "text": ["string"], "attachments": [ { "url": "string", "content_type": "string", "file_name": "string", "size": numeric } ] }
The following table describes the parameters passed in the Text message payload
request:
Parameter | Description |
type | The static value "text". |
customer_id | The ID of the customer to which the chatbot or CSR sends the message. |
message_id | The unique ID of the message. |
csr_name | The name of the CSR that is sending the message. |
text | An array of strings that correspond to the messages sent by the chatbot or CSR. |
attachments.[].url | A temporary private URL that references an attachment file. |
attachments.[].content_type | The content type for the file attachment. |
attachments.[].file_name | The attachment file name. |
attachments.[].size | The size in bytes of the file attachment |
- Menu
- The following is the JSON body format of the request payload that your integration layer receives from Digital Messaging Service for a menu selection:
Body (JSON)
{
"type": "menu",
"customer_id": "string",
"message_id": "string",
"csr_name": "string",
"title": "string",
"items": [
{
"text": "string",
"payload": "string",
"image_url": "string"
}
]
}
The following table describes the parameters passed in the Menu payload
request:
Parameter | Description |
menu | A static value "menu". |
customer_id | The ID of the customer to which the chatbot or CSR sends the message. |
message_id | The unique ID of the message. |
csr_name | The name of the CSR that is sending the message. |
title | The title for the menu. |
items.[].text | The label for the menu option. |
items.[].payload | The postback value for the reply option. |
items.[].image_url | The URL referencing an optional image for the reply option. |
- Carousel
- The following is the JSON body format of the request payload that your
integration layer receives from Digital
Messaging Service for a carousel selection:
Body (JSON) { "type": "carousel", "customer_id": "string", "message_id": "string", "csr_name": "string", "items": [ { "title": "string", "sub_title": "string", "title_image_url": "string", "items": [ { "text": "string", "payload": "string", "description": "string", "image_url": "string" } ] } ] }
The following table describes the parameters passed in the Carousel payload request:
Parameter Description type The static value "carousel". customer_id The ID of the customer to which the chatbot or CSR sends the message. message_id The unique ID of the message csr_name The name of the CSR that is sending the message. items.[].sub_title The optional subtitle for the menu. items.[].title_image_url The optional title image URL for the menu. items.[].items[].text The label for the menu. items.[].items[].payload The postback value for the menu option. items.[].items[].description The optional description for the menu option. items.[].items[].image_url The URL referencing the optional image for the menu option.
- Link
- The following is the JSON body format of the request payload that your integration layer receives from Digital Messaging Service for a link:
Body (JSON) { "type": "link_button", "customer_id": "string", "message_id": "string", "csr_name": "string", "title": "string", "label": "string", "url": "string" } }
The following table describes the parameters passed in the Link payload request:
Parameter | Description |
type | The static value "link_button". |
customer_id | The ID of the customer to which the chatbot or CSR sends the message. |
message_id | The unique ID of the message |
csr_name | The name of the CSR that is sending the message. |
title | The title for the link button. |
label | The label for the link button. |
url | The URL that opens when a customer taps the button. |
- Typing indicator
- The following is the JSON body format of the request payload that your integration layer receives from Digital Messaging Service when the CSR or chatbot is typing:
Body (JSON)
{
"type": "typing_indicator",
"customer_id": "string",
}
The following table describes the parameters passed in the Typing indicator payload request:
Parameter | Description |
type | The static value "typing_indicator". |
customer_id | The ID of the customer. |
- CSR ended the conversation
The following is the JSON body format of the request payload that your integration layer receives from Digital Messaging Service when the CSR ends the conversation:
Body (JSON)
{
"type": "csr_end_session",
"customer_id": "string",
}
The following table describes the parameters passed in the CSR ended the conversation payload request:
Parameter | Description |
type | The static value "csr_end_session". |
customer_id | The ID of the customer. |
Delivery confirmation
On successful delivery of a request payload from your integration layer to Digital Messaging Service, the system returns a success response, 200: Successful request, for example:
{
"account_id": "string",
"source_id": "string",
"source": "custom",
"date": "2022-07-08T14:51:01.589Z",
"visibility": "private",
"recipient_profile_id": "string",
"customer": {
"id": "string",
"profile_name": "string",
"profile_id": "string"
},
"consumer_id": "string",
"content": {
"text": "string"
},
"postback": "string",
"context_data": {
"string": "string"
}
}
In a case of failure, Digital Messaging Service returns one of the following response errors:
- 400: Malformed payload (invalid message type)
- 403: Invalid/Expired JWT
- 404: API Endpoint not found
- 422: Un-processable request (missing mandatory fields, invalid JSON)
Previous topic Private Data API for secure data transmission Next topic Configuring a chatbot