Skip to content

Latest commit

 

History

History
 
 

63.twilio-adapter

Twilio Adapter

Bot Framework v4 echo bot using Twilio Adapter sample.

This bot has been created using Bot Framework, it shows how to create a simple echo bot that connects with Twilio to respond SMS messages.

Prerequisites

  • .NET Core SDK version 3.1

    # determine dotnet version
    dotnet --version

To try this sample

  • Clone the repository

    git clone https://github.com/Microsoft/BotBuilder-Samples.git
  • Connect the bot with Twilio by following the instructions below.

  • Run the bot from a terminal or from Visual Studio, choose option A or B.

    A) From a terminal, navigate to samples/csharp_dotnetcore/63.twilio-adapter

    # run the bot
    dotnet run

    B) Or from Visual Studio

    • Launch Visual Studio
    • File -> Open -> Project/Solution
    • Navigate to samples/csharp_dotnetcore/63.twilio-adapter folder
    • Select TwilioAdapterBot.csproj file
    • Press F5 to run the project
  • Test the bot sending a SMS message to the Twilio Number.

Connect the bot with Twilio

Populate settings for Twilio Number, Account SID, Auth Token and Validation URL in appsettings.json file.

Instructions about how to create / configure a Twilio number for your bot and where to obtain the values for the settings can be found in the documentation covering connecting a bot to Twilio using the Twilio adapter.

  "TwilioNumber": "",
  "TwilioAccountSid": "",
  "TwilioAuthToken": "",
  "TwilioValidationUrl", ""

Deploy the bot to Azure

To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.

You can now test your bot is connected to Twilio correctly by sending an SMS message to your Twilio number. Once the message is receieved by your bot it will send a message back to you, echoing the text from your message.

Further reading