Top 5 Things to Consider for Building Better Bots
Time to read: 5 minutes
There's a lot of conflicting information on best practices when building bots, so we set out to make your chatbot-building life easier in our new comprehensive guide to Intelligent Chatbots.
That massive resource provides developers, builders, and DOers with an intelligent bot guide, covering bot use cases, descriptions of how bots work, instructions on building and deploying bots, intelligent bot best practices, and more.
In this post, I’ll summarize some of that guide and tell you what you need to consider to build better bots.
1. Pick your use case and type of chatbots
The purpose of most bots is often to automate tasks, save time, or just to generally make life easier – just like with most other tools and automation. So first, you’ll need to consider your bot’s use case.
Various industries use chatbots in different ways. Here’s a list of some of the more common use cases we’ve seen:
Industry |
Potential Uses |
Healthcare |
Appointment scheduling and reminders, gamify learning |
Finance |
Collect payments, automate customer support, return account balance |
Hospitality |
Show images of rooms, compare packages, confirm booking, accept payment |
Retail |
Collect product feedback, let users order an item, track an order |
Sales/marketing |
Book meetings and calls automatically, recommend webinars and content |
Regardless of use case, your bot can either be transactional (stateless) and not require history, or conversational (stateful), and require history and information collection to complete its tasks.
While use cases are open ended, a lot of your design hinges on the type of bot you set out to build.
2. Determine your bot’s capabilities
Second, you’ll need to consider the capabilities your bot will need. Don’t worry, I’ve added a few of the more common capabilities below.
Natural Language Processing (NLP) and Natural Language Understanding (NLU)
NLP and NLU help computers understand and interpret human language.
Bots employing NLP/NLU use algorithms to break down a sentence to characterize different components:
- utterance - phrases expressed by user to refer to a specific intent
- intent - the task the user wants to address
- entity - details relating to intent, such as date, time, location, etc.
- session - one conversation from start-to-finish (which can be interrupted)
- context - helps save and share parameters across a session
Text-to-speech (TTS)
TTS converts the text responses generated by your bot into speech to be read back to a user over the phone.
Automatic speech recognition (ASR)
ASR converts audio from a user into text that the NLP engine can process
Dialogue management
Dialogue management helps track the state of a conversation, remembering collected data and input across sessions via context.
Human handoff
Human handoff provides a fallback option in the event that your bot gets stuck or runs into an issue. When switching between bot and human conversation, it is a best practice to let the user know the switch will happen.
Really, this is just a small selection of potential bot capabilities.
There are many more features you can add to your bot. Pick and choose the ones you’ll need!
3. Choose the channels or platforms where you’d like to deploy your bot
Third, you need to decide where you’ll deploy your bot. Where will your customers find it most useful?
You should ask yourself who and where your users are.
If your bot is related to a Facebook page, then you should build for Facebook Messenger. Messenger is also the most popular chatbot platform, counting over a billion monthly active users.
However, if your bot is for internal use, maybe making it a Slackbot makes more sense.
If you want to build your bot for multiple channels, you are probably better off using a bot framework and not building from scratch. By using a framework, you won’t have to write the code to integrate with each platform you want to support - and can cover Messenger, Slack, and a myriad of other platforms with your chatbot.
4. Decide to build a bot from scratch, use an existing platform, or use assistive APIs
Fourth, you need to decide how you’re going to build your bot: do you want to make it from scratch or work with some sort of assistance? This question will influence how you build your bot – but know that we don’t suggest writing your chatbot from scratch.
Build a chatbot from scratch
Building a bot from scratch means making it in the language of your choosing – although likely using some libraries or open source software. This takes more time and more code... but does let you customize your bot or iterate more. You can also integrate all of the libraries or technologies you choose.
Build a chatbot on Channel APIs
You can also build a chatbot using Channel APIs like Twilio's SMS and Voice APIs, or through first-party APIs such as Slack's or Facebook Messenger's. Though Channel APIs may not have as many customization options as you'd like, many now let you customize your bot extensively.
Like Legos!
Build a chatbot on a Conversational API
At the highest abstraction end of the spectrum, you can use an existing Conversational AI platform. These platforms provide APIs, infrastructure, and tools to reduce the amount of heavy lifting you need to build a bot.
This provides an even higher level of abstraction than you would get with Channel APIs. This level of abstraction may even require little to no coding knowledge.
5. What language should you program your bot in if you decide to code?
Finally, you should decide how you’re going to program your bot.
There are tools and libraries for building bots in almost every language so you can build a bot using… well, anything. For example, Facebook Messenger bots can be developed in any language because of the Facebook API and webhooks provided by the Messenger platform.
However, Python is the most popular language for developing chatbots for a variety of reasons. Python offers amazing community support, varied AI and ML support libraries and frameworks like Keras, NLTK, Tensorflow, and more.
Python also has great libraries with time-saving features, such as the ability to make HTTP requests very concisely with Python's requests
module.
So what are you waiting for?
Visit our brand new Chatbot guide for more in-depth information and advice on building bots.
We can't wait to see – and interact with –what you build!
Lizzie Siegle is a software engineer who serves developers on Twilio's developer evangelism team and focuses on AI and intelligent bots using industry frameworks. She can be found on Twitter @lizziepika, GitHub @elizabethsiegle, and through email at lsiegle [at] twilio.com.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.