Connect Microsoft Healthcare Bot to Twilio for SMS
Published Apr 01 2020 11:30 PM 3,936 Views
Microsoft

Microsoft Healthcare Bot service can be configured to connect to multiple channels. A channel is a connection between the Healthcare Bot and communication apps. The Healthcare Bot leverages Azure Bot Service to connect your bot to a channel and facilitates communication between your bot and the user. The default channels available in Healthcare bot are Web Chat, DirectLine, Microsoft Teams, Twilio and Facebook.

 

Healthcare Bot is easy to connect with a Web Chat embedded on a web page or connect with Microsoft Teams. Another popular channel is to connect it to an SMS provider for public-facing scenarios. Twilio allows us to establish a connection such that patients can interact with the health bot via a simple text message.

teaserimg.png

This blog provides step-by-step instructions to connect the Healthcare Bot to Twilio’s SMS service. Steps include:

  1. Creating a Twilio account and getting a trial number
  2. Creating a TwiML app and forwarding Twilio messages to the Healthcare bot
  3. Connecting Healthcare Bot to Twilio

 

Creating a Twilio account and Getting a trial number

 

1. Create a new Twilio account using Twilio's sign up page. Requirements to sign up: a valid email address and phone number. It then asks a few questions about how you would like to use Twilio, what kind of developer are you, the kind of project you are working on, and so forth. For sample answer: I chose - Developer, C#, Project, and Send or receive a SMS.

 

2. You will then be redirected to the project dashboard.

img1.png

 

3. Click on "Get a Trial Number". A random number is generated from a pool of trial numbers which might not have your area code, but you can add your final number later.

img2.png

 

4. Click on “Choose this Number”. You will have the ability to add your final number later.

img3.png

 

Creating a TwiML app and forwarding Twilio messages to the Healthcare bot

 

1. On the left-hand bar, click on the circle with ellipses on the menu bar. Click Programmable Messaging. You can even pin it to keep it on the menu.

ProgrammableMessaging.png

 

2. In Programmable Messaging tab, click on Helper Tools -> TwiML Apps -> Create a new TwiML App

TwiMLApp.png

 

3. In Create TwiML App screen, add the following details and click Save:

CreateTwiMLAp.png

 

4. Now, the app is created and settings are configured to send messages to the health bot. Next, we need to associate the Twilio number with the service.

To do this, click on the circle with ellipses on the menu bar on the left-hand bar. Select # Phone Numbers -> Manage Number -> Active Numbers

Note: For adding an existing verified number to use with this app, please refer Twilio's support doc.

PhoneNumbers.png

 

5. Click on the trial number (Or add the verified number if you have already switched to verified number). In Configure tab, scroll down and change Voice & Fax and Messaging sections to

  • CONFIGURE WITH: TwiML App
  • TWIML APP: Select name of the TwiML App created in previous step 

ConfigureWith.png

 

6. Save the settings. You should see a configuration similar to this:

ActiveNumbers.png

 

Connecting Healthcare Bot to Twilio

 

1. Click on Home button to go to Twilio's Project Dashboard. Project Info has the 3 pieces of information you need to connect to healthcare bot – Phone Number, Account SID, and Auth Token. You can click on the double box on the right-hand side to copy values to your clipboard. Note: You can get Auth Token by clicking on Show.

imga5.png

 

2. Login to your healthcare bot admin portal. Navigate to Integration -> Channels. Mark Twilio channel active.

imgb1.png

 

3. You will be prompted for the Phone Number, Account SID, and Auth Token. Enter details you copied from Twilio Project Info in previous step. Click “Save”.

imgb2.png

 

 

Congratulations, you have successfully completed the configuration and can now try out the new SMS to Health Bot connection by sending an SMS to your trial (/verified) number with a Hi.

 

Please note: The health bot needs to respond to any kind of text and it may not be related to the scenarios outlined on web pages that host the Health bot via Web Chat channel. If you want to run a specific scenario, send a SMS to your trial (/verified) number with a "begin <scenario_id>". For example, if you want to invoke a scenario with scenario_id = covid19_assessment, send a SMS to your trial number as begin covid19_assessment

 

Thanks for reading and let us know how we can help.

 

JohnBrown_LinkedIn.jfif

John Brown, Microsoft Azure Cloud Architect

 

Nikita_LinkedIn.jfif

Nikita Pitliya, Microsoft Data & AI Solution Architect

1 Comment
Version history
Last update:
‎Aug 31 2020 05:54 PM
Updated by: