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.
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:
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.
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.
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).
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.
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.
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 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:
Use Quick Reply and Carousel where appropriate, to help the user choose the right value.
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.
Full reference to Twilio opt-out words: support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering-
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!?
Here is a handy checklist—for SMS based chatbots built with NativeChat and Twilio:
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:
Build an SMS Chatbot with NativeChat and Twilio
Build a WhatsApp Chatbot with NativeChat and Twilio
Build a Viber Chatbot with NativeChat
Alex is a Senior Software Engineer on the NativeChat team at Progress. He likes to play with chatbots and work on interesting new projects.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
You have the right to request deletion of your Personal Information at any time.
You can also ask us not to pass your Personal Information to third parties here: Do Not Sell My Info
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Copyright © 2021 Progress Software Corporation and/or its subsidiaries or affiliates.All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.