How to Connect your Bot to SMS Text Messaging

Through Bot Libre, you can now send and receive SMS messages with your own bot. You can use this to chat with your bot through SMS, but the possibilities are endless. You could also use it to perform surveys or marketing, send customer service escalations, or send notifications from social media or email. Any bot can be set up with SMS text messaging with an account on Twilio.com. This "How To" will give you a step by step process to connect your bot with Twilio to allow for SMS text messaging.

A screen will pop up with a phone number that has been chosen for you. You can accept this phone number by clicking the "Choose this Number" button. If you want to try again for a different phone number, you can click the underlined "Search for a different number" link. Ensure the number you select has SMS capabilities.

Step 4 - Connect webhook

Navigate to your bot's page on the Bot Libre website. Go to its admin console by clicking on the gear icon.

Now return to the Console on the Twilio website and select "Phone Numbers"

Next, select "Manage Numbers"

Select the phone number you created to edit its settings.

Scroll down to the "Messaging" section and select "Webhooks/TwiML" from the "Configure with" dropdown menu. Paste the Webhook URL from your bot's SMS admin page into the "A message comes in" Webhook field.

Your bot should now be able to reply to SMS messages sent to the phone number you set up on Twilio. Trial accounts on Trilio can only send messages to phone numbers you have verified in the phone numbers section of your account portal. To remove this restriction, you will need to upgrade your Twilio account.

Step 5 - Accessing SMS from a script

To send SMS message's from a bot's script, you will need to enter your Twilio account's SID, Auth Token and phone number into your bot's SMS admin page. You can find your Twilio Account SID and Auth Token on your Account Dashboard on the Twilio site.

Return to your bot's SMS admin page and enter your Account SID into the Twilio SMS SID field, the Auth Token into the Twilio SMS Secret field and your Twilio phone number into the Twilio Phone Number field. Press "Save"

You will now be able to send SMS messages from your bot through scripts. The method for sending an SMS message from a Self script is Twilio.sms("+16131234567", message); The first parameter is the phone number the SMS message will be sent to. The second parameter is the message that will be sent to the number. For an example of how to do this, please look at the source for this script: https://www.botlibre.com/script?id=12864737

In summary, your bot should now be able to send and receive SMS messages. By creating a Self script, you will be able to create custom behaviour for sending SMS messages in response to chat messages sent to your bot. If you encountered any issues, or would like help setting up your bot please email us at support@botlibre.com or upgrade to our Platinum service and we can build your bot for you.