Things to Consider When Building an SMS Chatbot With NativeChat and Twilio

Things to Consider When Building an SMS Chatbot With NativeChat and Twilio

August 06, 2020 0 Comments
Things to Consider When Building an SMS Chatbot With NativeChat and Twilio

When building an SMS chatbot, it is easy to make a lot of assumptions and build the chatbot the same way we are used to building web-based chatbots.

Even though there is a big overlap between web and SMS chatbots, there are a few challenges that you might come across, which could significantly affect the development of your SMS chatbot. 

In this article, we are going to look at various challenges—that you might face when building an SMS chatbot with NativeChat and Twilio—and the best practice on how to handle them.

Choose an SMS Capable Twilio Number

One of the first things that we need to do when setting up an SMS chatbot with NativeChat and Twilio, is to buy a phone number from Twilio. 

While doing so, Twilio gives us an option to search for numbers with capabilities for: 

  • Voice

  • SMS 

  • MMS 

  • FAX 

Each number has one or more capabilities, but not all numbers are capable of sending SMS messages. Make sure to buy a number that supports sending and receiving SMS. 

Note that for some countries—like Argentina, Brazil, Bulgaria, and Germany — Twilio doesn’t offer the capability to send/receive SMS. In this case, you might need to consider using a number from a different country. 

Design Your Chatbot With MMS Availability in Mind

If your chatbot requires the users to upload files or send images, then you will need to get an MMS-capable phone number. However, currently, this is only possible for the numbers from Canada and the U.S. 

Keep that limitation in mind. If your chatbot is meant to work in Canada and/or the U.S, then make sure to get an MMS-capable number. 

However, if you expect your chatbot to work in other countries, then you will need to design your chatbot, which should allow the users to upload the files via the web. 

Think About Your Bill (and the Bill of Your Users) 

Your bot will be sending SMS, and these incur cost against your Twilio account. The costs start at $0.0075 for an SMS segment to a local U.S. number, but this cost varies based on your Twilio number, the destination and carrier. You can check the full pricing here: https://www.twilio.com/sms/pricing/us 

You will be charged per 160-character segment. If your bot sends a longer message, most SMS apps on the receiving end will display the entire message in a single message bubble but you will be charged the SMS price for each 160-character segment. The full reference here: https://www.twilio.com/docs/glossary/what-sms-character-limit 

Every SMS the user sends to the bot may cost money. This depends entirely on their carrier and plan. As a chatbot developer, you should make sure that you design the conversation with the bot so that the user can achieve their goal with the minimum number of sent SMS possible. NativeChat uses a slot-filling algorithm, which parses each message from the user and extracts the maximal number of entities. If you design your bot right it would be possible for the user e.g.: to book an appointment with Dr. Alcutt for tomorrow at 14:00 by typing in a single message only—‘I want to see Dr. Alcutt tomorrow at 14:00’ and the bot will extract the intent (Book a doctor), the doctor (Alcutt), the date (tomorrow) and the time (14:00). 

Think About the UX 

With SMS chatbots most of the communication happens with text, as there is a limited amount of UI that can be used. This means that we have to be very careful about how we design our chatbot, and how we communicate with our users. 

Conversational UI Alternatives 

One big missing piece in SMS based communication is the lack of conversational UI elements—like buttons, list pickers and carousels—which usually help our user choose one of the available answers. 

However, NativeChat still provides support to display a list of available values with Quick Reply and Carousel

Quick Reply 

You can use Quick Reply to display a list of available values in the format of semicolon-delimited list of values. 

For example, if your user is asked to provide the name of the doctor they would like to see, the chatbot can communicate this, as follows: 

A screenshot of a cell phone Description automatically generated 

Carousel 

A Carousel display type is useful, where our chatbot needs to provide a list of value together with additional info. 

For example, your chatbot could display a list of insurance quotes, and ask the user to pick one, like this:  

A screenshot of a cell phone Description automatically generated 

Use Quick Reply and Carousel where appropriate, to help the user choose the right value. 

Twilio Opt-Out Words 

Because of regulations, Twilio provides the opt-out workflow, which allows customers to opt-out from receiving SMS from a certain service, bots included. 

If your user sends STOP, STOPALL, UNSUBSCRIBE, CANCEL, END or QUIT to the bot by SMS, Twilio will unsubscribe the sender from receiving further messages, and thus shutting off the communication between your user and the chatbot. Additionally, you will not be informed about any users that unsubscribed from the service. 

Likewise, if the user sends START, YES or UNSTOP, Twilio will re-subscribe your user to the messages from your chatbot and pass the START, YES or UNSTOP message to the chatbot for further processing. 

The important thing here is to understand that Twilio only handles single-word triggers, so STOP will unsubscribe the user but STOP PLEASE will not

If your user sends HELP or INFO Twilio will respond with "Reply STOP to unsubscribe. Msg&Data Rates May Apply." More importantly, Twilio will not pass HELP or INFO to NativeChat, so make sure your chatbot doesn’t rely on HELP or INFO as conversation triggers or an entity value. 

You should design your chatbots with the opt-out keywords in mind, and never require your users to say any of them as part of the conversation. 

Additionally, you could warn your users that they should avoid using these keywords if they don’t want to get disconnected from the chatbot. 

I Have Set Up Everything, but It Does Not Work. What Should I Do? 

As with all third-party channel integrations, there is one extra moving part to your bot with Twilio. Luckily Twilio offer comprehensive guides and debug log with all incoming and outgoing messages and with all errors. 

Twilio will also send you an email for every first error on a given day. So if you just woke up and still sleepy went straight to your Twilio console and tried a new configuration and accidentally broke something, you won’t need to go inspecting all the logs—Twilio will send you the exact error in an email. Now, aren’t they nice!?

Checklist

Here is a handy checklist—for SMS based chatbots built with NativeChat and Twilio: 

  1. Do I have an SMS capable Twilio number? Check the capabilities for your number in the Twilio console
  2. Do I have enough credit in my Twilio account? Check your account in Twilio
  3. Is the NativeChat Twilio integration set up correctly? Check your Twilio project. Check the message and debug logs.
  4. Is my NativeChat chatbot getting the user messages? Go to bots.nativechat.com and see the history tab for your bot. Can you see all messages sent by your users?
  5. Does my NativeChat chatbot understand what the user says? If you are at this point, you probably can reproduce the issue entirely in NativeChat. Continue testing your bot from the NativeChat test console and tweak your bot and training so that it understands what the user says with their particular phrasing.

Summary 

Building an SMS based chatbot is quite easy, however, we need to be mindful that the communication tends to be quite different when comparing to a web-based chatbot. Even the fact that conversations incur costs on both sides (your company and your users) means that we need to make our chatbots communicate clearly and get to the point quickly. 

If you have a case that we didn’t cover, let us know in the comments. Maybe we could create another blog post or update this one. 

If you would like to learn how to build a chatbot for an SMS/WhatsApp/Viber, then you should check out these articles:  

Alex Hitrov

Aleksandar Hitrov

Alex is a Senior Software Engineer on the NativeChat team at Progress. He likes to play with chatbots and work on interesting new projects.

Comments
Comments are disabled in preview mode.
Topics
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

More From Progress
supercharge-the-velocity-of-your--net-business-rules-with-corticon-6232x131_resourceimage.png
Supercharge the Velocity of Your .NET Business Rules with Corticon 6
Read More
 
570x321__Top 7 Considerations Before Choosing a Chatbot for Your Enterprise
Top 7 Considerations Before Choosing a Chatbot for Your Enterprise
Read More
 
corticon-states-thumbnail
U.S. States Using Corticon
Read More