Sample Bot - QuestionBot for Twilio a.k.a. "ConferenceBot"
Check out this sample bot that shows off several of the Twilio API methods and features built-in AI approximation with no external services.
QuestionBot is a sample bot written for Twilio that exemplifies several of Twilio's functions. It's a great example of how a bot that is focused on conversational UI works and shows how easy it is to roll your own AI-like system if you wish. QuestionBot can also teach you how to send real-time notifications from the chatbot to other systems through the real-time "Unanswered Questions" feature. Finally, remixing QuestionBot is a great way to see how to integrate effective and accurate screen-scraping to provide information to your own bots.
Using Glitch, you'll be able to easily clone QuestionBot's code, host QuestionBot inside Glitch (no need for local config!), and get a working copy in minutes! You can also view QuestionBot's source code on GitHub.
Feel free to try out QuestionBot's scraping and intuitive question/answer management system on your own by heading over to it's live Question console!
QuestionBot showcases several features of a modern conversational bot, including its own built-in AI-like system.
- Accurate Screen Scraping
- QuestionBot helps administrators get set up extremely quickly by being able to import questions and answers from existing FAQ pages using a generic screen scraping algorithm that can handle many different FAQ pages.
- Look into the code of
scrape.jsif you want to understand the algorithm and learn how you can empower your own bot with information scraped from the web.
- Real-Time Unanswered Question Update
- Whenever a user asks a question that QuestionBot can't answer, it is displayed in real-time on the administrator's web console. This way, the administrator can quickly set up QuestionBot and get immediate feedback on the types of question he/she still need to answer.
- The real-time update is accomplished using a technique called long polling. Look into the code of
api.jsto see how this is set up so you can reuse it in your own projects.
- In-built AI
- Many traditional AI methods require an extensive training stage so that the neural network used by the AI can "learn" questions and answers. However, this long training stage is impractical for something like QuestionBot, where QuestionBot needs to be able to answer questions that the administrator set up moments ago. For this reason, QuestionBot does not use external AI services that use neural-networks and instead uses a natural language processing system based on fast string manipulations so that QuestionBot can quickly match a users question to an approximate answer without the expensive training phase.
- Read into tools like Lunr if you want to implement this for your own bot.
- Fuzzy matching
- Users often make accidental typos when interacting with conversational interfaces, and even more so when texting over Twilio. For this reason, QuestionBot implements "fuzzy matching" into its AI system, where QuestionBot will still be able to understand what the user meant, even if a few letters are missing, changed or rearranged.
- Read up on natural language calculations like Levenshtein distance so you can understand how to best use this technique for your own benefit in your bot development.
Setting up your own QuestionBot
Thanks to the awesome tool that is Glitch, setting up your own QuestionBot is as easy as clicking the
Remix on Glitch button below.
Once you've opened up this link, you'll be taken to a more detailed explanation of how to set up your new QuestionBot. At the top of the page, you'll see a button that says
Remix This 🎤. From here, you can follow the README.md that's included in QuestionBot's code to get everything set up.