Twilio SMS Notifications

Text messages to a user's phone can ensure they're reminded of upcoming events (i.e., notifications) or sent information, such as booking details.

Goal: Add a Twilio messaging integration to allow for SMS notifications.

๐Ÿ“˜

Video tutorial coming soon!

Create a Twilio Messenger Connector

  1. To create a new Twilio Messenger connector, navigate to the Integrations page from the left-side panel.
  2. Click the gear icon on the "Twilio Messenger" item.
  3. Add your "Twilio Account SID" and "Twilio Auth Token" and click Save.
  4. Click the plus icon on the โ€œTwilio Messengerโ€ item.
  5. Add a โ€œTitleโ€ and โ€œIdn.โ€ In this case, just call them both โ€œsms_connector.โ€
  6. Select an "Agent Phone Number" from the populated list. If you don't select a number, one will be assigned automatically.
  7. Click Save.

Create a New Skill

Start by creating a new agent and flow. Add a Skill with a "Skill Idn" of "SmsSkill." Copy the following Skill Script into your newly created Skill:

{{SendCommand(
    commandIdn="send_message", 
    integrationIdn="twilio_messenger", 
    connectorIdn="sms_connector",
    text="This is a notification!!!",
    phoneNumber="+1234567890"
)}}

The "commandIdn" and "integrationIdn" strings are set names to initiate the Twilio message functionality. The "connectorIdn" is the one you just set up. Add any string to the "text" value and add your phone number (with country code) to the "phoneNumber" value.

Create New Event

In order for the newly created "SmsSkill" to be activated, the Skill needs to be subscribed to an event, which will be triggered when sending a message in the Sandbox chat.

  1. Click the plus icon next to the Event Subscription section on the left-side panel.
  2. Under the โ€œEvent Idn,โ€ select "user_message" from the dropdown.
  3. Under โ€œIntegration,โ€ select โ€œtwilio_messengerโ€ from the dropdown.
  4. Under โ€œConnector,โ€ select โ€œsms_connectorโ€ from the dropdown.
  5. Under โ€œSkill selector,โ€ select โ€œskill_idnโ€ from the dropdown.
  6. Under โ€œSkill name,โ€ select โ€œSmsSkillโ€ from the dropdown.
  7. Add an โ€œEvent description.โ€ This field is optional but will help in the future when identifying the purpose of an event from a complex flow containing multiple event subscriptions.
  8. Click Create to save the event.

Add a User

  1. Click the Sandbox Chat button at the top-right corner of the Flow Builder to open the Sandbox chat panel. Ensure the correct agent is selected from the dropdown within the panel.
  2. Click the plus icon next to the โ€œUser:โ€ section in the Sandbox chat.
  3. Add a โ€œName.โ€ In this case, this is the name of a user who will be talking to the agent, which can be your name or a made-up name for testing purposes.
  4. Click the checkbox if you'd like to create an actor for the user persona. An Actor is someone who communicates through a specific connector. For example, a specific user could communicate via the Sandbox chat (Sandbox chat connector) and over the phone (Twilio connector), which each have identifiers of separate actors. For this case, we are going to create a single actor for Twilio SMS communications (ensure the checkbox is ticked).
  5. Under the "Actor settings," select โ€œtwilio_messengerโ€ for the โ€œIntegrationโ€ and โ€œsms_connectorโ€ for the โ€œConnector.โ€
  6. Click Create and apply to save the user.

Test Functionality

  1. Click Save and Publish in the top-right corner of the Flow Builder.
  2. Type anything in the Sandbox chat field, and click the send icon. You should receive an SMS to the number added in the SendCommand action.

๐Ÿšง

If sending SMS notifications to a US number (+1), ensure your Twilio account is US A2P 10DLC registered. More information here.