Simple forms of artificial intelligence, or AI, are taking over many human duties. Chatbots are one quickly emerging application of AI. Given a well constrained domain of operation, chatbots can already provide a solution for the needs of customer service or simple transactions such as “I need to book a meeting room ASAP”.
What does it take to build a chatbot in 2 hours?
At SC5, we favor a rapid prototyping and lean development approach in all our software creations. We’ve been eager to get familiar with this new interaction channel. To get started, we’ve done some work to discover the cloud-based components that do the “fastest and the mostest” for us.
And guess what? We have found few alternatives for a technology stack that enables us to build a chatbot from “a scratch” (as far as the idea goes) in less than two hours! So, instead of forcing us to spend hours reinventing the wheel, we’ve build a serverless solution and concentrated our efforts on the most important part, the machine intellect.
And now, the best part, with a little bit of help, you can do the same thing! One solution has already been successively tried in workshops around Europe with scores of people. With this story, we are happy to share it with you! Our chatbot has two main parts: the muscles and the brain. We’ll start with the former.
Muscles: Technology stack
As we prefer serverless cloud-based solutions, our technology stack is hand picked from the cloud components. It has three main parts:
- Chat interface = FB Messenger platform
- “Middleware” = AWS Serverless technologies (AWS API Gateway, AWS Lambda, …)
- Intelligence = Wit.Ai (owned by Facebook)
Each of these is in theory interchangeable. For instance, we could switch the interface from FB to WeChat, Skype or Slack, if that was desired. The “middleware” connects the interface with the intelligence and its implementation depends on these two solutions.
In our example, the intelligent communication is generated by the Wit.AI component. Wit.ai is a natural language processing and conversation logic service owned by Facebook, but currently totally unconnected to other Facebook products or data. It provides many important components that help to interpret user intention and connect external data that facilitate developing witty assistance off the shelf. Despite these scaffolds, the programming of the AI logic is the most work intensive part of our two-hour botshow.
While the details of AI programming are beyond the scope of this story, few words about how it works. In Wit.ai, the conversation flow is represented by stories, which defines the bot and user interactions of a conversation. The service is capable of extracting entities such as date or location from the user input. The conversation flow is configured via a web interface, i.e. no programming skills are needed for basic conversation flows. Interactions that require to access data from 3rd party services can be hooked into the conversation as external actions (e.g. getWeather action in the weather bot example below).
Our workshop model: Getting Talkative in Two Hours
In our workshop, we have help people to fast track their way into chatrobotics. During the workshop we build a Messenger weather bot using Wit.ai, AWS Lambda and the Serverless Framework. By providing the muscles and the schematics of the brain, there is a small job of creating the skeleton that binds everything together.
Our workshop takes the following steps to get to the working bot:
- Creating an endpoint for the bot to AWS using the Serverless Framework
- Creating a Facebook page and application hooked to our endpoint
- Registering to Openweathermap (used for the weather forecasts)
- Registering to wit.ai
- Modelling the conversation flows in wit.ai
- Implementing the weather forecast logic into our endpoint
Get yourself familiar with our workshop format by browsing the slides:
Watch out for our workshops or have one tailormade for you!
Just contact us and let’s figure it out.
You can also hone your skills at your pleasure with these web resources:
Text: Lassi A Liikkanen and Mikael Puittinen, SC5
Illustration: Tuija Latva, SC5