Connect Microsoft Healthcare Bot to Twilio for SMS

This post has been republished via RSS; it originally appeared at: Healthcare and Life Sciences Blog articles.

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
  2. Adding Twilio Channel to Healthcare bot portal
  3. Forwarding Twilio messages to the Healthcare bot

Creating a Twilio account

 

1. Create a new Twilio account. 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

 

5. The Twilio dashboard for Project Info now has the first 3 pieces of information you need – 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.

imga5.png

 

Connect your Healthcare Bot to Twilio

 

1. Login to your health bot admin portal. From the hamburger menu, navigate to Integration -> Channels. Mark the Twilio channel active.

imgb1.png

 

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

imgb2.png

This step connects the Health Bot to Twilio. Next, we need to setup Twilio to forward messages to Health Bot.

 

Forwarding Twilio messages to Healthcare Bot

 

1. The health bot is now listening to messages coming from Twilio, but we still need to forward the messages from Twilio to the health bot. Go back to the Twilio dashboard and select the circle with the ellipses on the menu bar. You can even pin it to keep it on the menu.

imgc1.png

 

2. Select the SMS and Messaging Services. Click “Create new Messaging Service” button.

imgc2.png

 

3. Give it a friendly name, and select the Chat Bot / Interactive 2-way option.

imgc3.png

 

4. Then, you can edit the settings of the Messaging Service, specifically the “Inbound Settings”. Choose the SEND AN INCOMMING_MESSAGE WEBHOOK option and put in the request url in this form: https://sms.botframework.com/api/sms

imgc4.png

5. Now, the service 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, navigate to Numbers section of the configured Health Bot SMS service we just created. Select the Numbers option and Add an Existing Number.

imgc5.png

 

6. Select the trial number and Add Selected

imgc6.png

Congratulations, you have successfully completed the configuration and can now try out the new SMS to Health Bot connection!

 

Please note that 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.

 

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

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.