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
- To create a new Twilio Messenger connector, navigate to the Integrations page from the left-side panel.
- Click the gear icon on the "Twilio Messenger" item.
- Add your "Twilio Account SID" and "Twilio Auth Token" and click Save.
- Click the plus icon on the âTwilio Messengerâ item.
- Add a âTitleâ and âIdn.â In this case, just call them both âsms_connector.â
- Select an "Agent Phone Number" from the populated list. If you don't select a number, one will be assigned automatically.
- 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.
- Click the plus icon next to the Event Subscription section on the left-side panel.
- Under the âEvent Idn,â select "user_message" from the dropdown.
- Under âIntegration,â select âtwilio_messengerâ from the dropdown.
- Under âConnector,â select âsms_connectorâ from the dropdown.
- Under âSkill selector,â select âskill_idnâ from the dropdown.
- Under âSkill name,â select âSmsSkillâ from the dropdown.
- 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.
- Click Create to save the event.
Add a User
- 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.
- Click the plus icon next to the âUser:â section in the Sandbox chat.
- 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.
- 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).
- Under the "Actor settings," select âtwilio_messengerâ for the âIntegrationâ and âsms_connectorâ for the âConnector.â
- Click Create and apply to save the user.
Test Functionality
- Click Save and Publish in the top-right corner of the Flow Builder.
- 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.
Updated 7 months ago