Configure an SMS channel for Twilio
Omnichannel for Customer Service offers a suite of capabilities that extend the power of Dynamics 365 Customer Service Enterprise to enable organizations to instantly connect and engage with their customers across digital messaging channels. An additional license is required to access Omnichannel for Customer service. For more information, see the Dynamics 365 Customer Service pricing overview and Dynamics 365 Customer Service pricing plan pages.
The SMS channel through Twilio in Omnichannel for Customer Service allows your organization to connect to customers by using text messages. Your customers can send text messages through Twilio and connect with an appropriate customer service agent. Agents can view the incoming SMS requests on their dashboard and respond accordingly.
Make sure that the following prerequisites are met:
SMS for Twilio is provisioned in Omnichannel for Customer Service. More information: Provision Omnichannel for Customer Service
To enable the SMS channel for Twilio in an existing Omnichannel for Customer Service environment, you must upgrade to the latest version of Omnichannel for Customer Service. More information: Upgrade Omnichannel for Customer Service
A Twilio account with a phone number and subscription is available.
Configure an SMS channel for Twilio in Omnichannel for Customer Service
Get Twilio account details
An SMS channel is enabled within Omnichannel for Customer Service by integrating with Twilio. This integration uses public APIs of Twilio for sending and receiving text messages.
In your Twilio account, note the ACCOUNT SID and AUTH TOKEN values. These values are required to create the SMS configuration in the Omnichannel Administration app.
Purchase support phone numbers through your Twilio account.
Only US phone numbers are supported.
Create a work stream
Perform the following steps to create a work stream for the SMS channel for Twilio:
Sign in to Omnichannel Administration.
Under Work Distribution Management, select Work Streams.
Select New. The New Work Stream page appears.
In the General information area, enter the following details:
- Channel: Select SMS.
- Auto-close after inactivity: Select a value that indicates a duration of eight hours or more.
- Allow automated messages: Specify Yes to be able to define the business hours.
In Work distribution, specify the necessary details. More information: Create a work stream
On the SMS Settings tab, enter the following details:
- SMS Provider: Select Twilio.
- Account SID: Enter the Twilio ACCOUNT SID.
- Auth Token: Enter the Twilio AUTH TOKEN.
Select Save. The Twilio inbound URL is generated and displayed.
On the SMS Numbers tab, select New SMS Number, and then enter the following details:
- Number: Specify the support phone number that you purchased from Twilio in the <country_code><phone_number> format, such as 14252306549. Make sure that you don't enter blank spaces or special characters.
- SMS number language: This is the preferred language that will be used when you configure automated messages on the Automated messages tab.
- Type: Select Long code, Short code, or Toll free.
- Description: Specify a description for the number. (Optional)
- Operating Hours: Specify the business hours when the customer support team is active and available to serve customers.
You can configure only one phone number per work stream.
Optionally, on the Automated messages tab, configure automated messages.
Optionally, on the Surveys tab, configure a post-conversation survey.
On the command bar, select Validate API Key. The Twilio account and phone number are validated.
Configure the routing rules on the Routing rule items tab. The routing rule for SMS works on Mobile Phone of the Contact entity. The customer is identified based on Mobile Phone, and the conversation is automatically linked to the contact record.
Establish a connection between Omnichannel for Customer Service and the Twilio account
Perform the following steps to configure the URL in Twilio for the SMS messages from Omnichannel for Customer Service to be processed in Twilio:
Copy the value in Twilio inbound URL of the work stream for Twilio.
Go to your Twilio account > Phone Numbers > Active Numbers, and then select the SMS phone number.
In the Messaging section, paste the Twilio inbound URL.
Flow of data between Omnichannel for Customer Service - SMS channel and Twilio
Incoming text messages
For an incoming text message sent by a customer to the support phone number, the message is first sent to the Twilio messaging service and then pushed by Twilio to Omnichannel for Customer Service by using the callback URL. After this, the message gets routed and associated to either a new or an existing conversation by Omnichannel for Customer Service.
Outgoing text messages
For an outgoing message sent by an agent from within Dynamics 365, the message is first sent to the Twilio service and then Twilio sends it to the customer. In addition to the text message, Omnichannel for Customer Service uses the APIs provided by Twilio to send the customer's phone number, support phone number, and the Twilio account information (Account SID and the Auth Token) to the Twilio service.
Twilio account and phone number validation
When you validate the SMS settings while setting up the SMS channel, a call is made to Twilio to validate the Account SID and Auth Token.