Connect a bot to Twilio (SMS)
APPLIES TO: SDK v4
You can configure your bot to communicate with people using the Twilio (SMS) cloud communication platform. This article describes how to configure a bot to communicate using Twilio by creating a TwiML application and connecting the bot in the Azure portal.
- An Azure account. If you don't already have one, create a free account before you begin.
- An existing bot published to Azure.
Create a TwiML application
- If you don't have a Twilio account, create a new account. If you already have a Twilio account, continue to the next step.
- Follow the instructions to create a TwiML application.
- Enter a Friendly Name for your TwiML app.
- Under Voice Configuration, leave the Request URL empty
- Under Messaging Configuration, set the Request URL:
- For a global bot, enter
- For a regional bot, enter
- For a global bot, enter
Select or add a phone number
Follow the instructions to add a verified caller via the Console. You can skip this if you already have a verified caller ID.
After you finish, you'll see your verified number in Verified Caller IDs.
Specify TwiML app to use for voice and messaging
After adding a verified caller ID, configure your number's setting to use the TwiML app you created.
- Select Active numbers under Phone Numbers > Manage. Select the number and go to Configure.
- Under both Voice & Fax and Messaging, set Configure With to *TwiML App. Then set TwiML APP to the TwiML app you created earlier. After you finish, select Save.
- Select Active Numbers again. You'll see the Active Configuration of both Voice and Messaging are set to your TwiML App.
Gather credentials from Twilio
Go back to the Twilio Console homepage
Under Account Info, you'll see your Account SID and Auth Token on the project dashboard, shown below. Copy and save these values for later steps.
Enter Twilio credentials in the Azure portal
Now that you have the necessary values from Twilio, connect your bot to Twilio in the Azure portal.
In a separate window or tab, go to the Azure portal.
Select the bot that you want to connect to Twilio.
Under Settings, select Channels, then select the Twilio (SMS) icon from the list of Available Channels.
Enter the Phone Number, Account Sid, and Auth Token you saved earlier. After you finish, select Apply.
Your bot's now successfully configured to communicate with Twilio users.
Test your bot in Twilio
To test whether your bot is connected to Twilio correctly, send an SMS message to your Twilio number. When your bot receives the message, it sends a message back to you, echoing the text from your message.
To learn more about developing for Twilio, see the Twilio SMS documentation.
Connect a bot to Twilio using the Twilio adapter
In addition to using the available Azure Bot Service channel to connect your bot with Twilio, the Bot Builder Community repos define a custom channel adapter for Twilio.
- For information on the C# adapter, see the Adapters section in the .NET community repo.
Submit and view feedback for