What is Wit.ai?
Wit.ai is a natural language processing (NLP) interface that turns natural language (speech or text messages) into structured data. Developers use Wit because it simplifies the process of making applications and devices that people can converse with. Without it, developers would need to learn natural language processing algorithms. That would be too time-consuming if you just want to make a simple application.
What will this blog post cover?
In this blog post, I'll cover a simple tutorial on how to train your application to understand common company chatbot questions using the Wit.ai console. By the end of the tutorial, the bot will be able to understand basic questions such as "What is your business email address?". The communication with the bot will be done via the HTTP API provided by Facebook.
If you are not really interested in a chatbot, just follow along to learn the basics. You will be able to create other cool stuff on the Wit.ai community page.
Warning! Stories are now deprecated.
Before I forget, the reason why I'm creating a Wit.ai tutorial when there are already so many good ones is that there are several outdated tutorials out there using the now deprecated stories. You should not use them as Facebook will no longer support them by February 1, 2018.
First Wit.ai Application
First, create an application by clicking the plus icon at the top navigation bar. It will redirect you to the "Create a new App" page.
Enter your application name, description, and privacy settings. Don't worry about the application name and visibility settings too much. It isn't permanent and you can change it again later on the settings page.
Training your Wit.ai application to greet
Once you made your application, you will be directed to the entities page. This is where you train your bot to understand expressions. For now, we will teach the bot to understand common greetings.
Enter the word "Hello" or any other greeting you like in the textbox as shown in the picture above. In the "Add a new entity" box, select wit/greetings and choose value as true. Your chatbot now understands that the expression "Hello" intent is a greeting.
There will now be another entity called wit/greetings listed on the entities page. If you click on wit/greetings entity you will be directed to the greetings entity page.
You can see that the expression we created is listed. In this page, you are able to view expressions you have taught the Wit.ai application. If you don't like any expressions you have made you can simply delete them by clicking the cross on the right-hand side of the text.
What is your email address?
Now, we will train our conversational bot to understand our intent to get the company email address.
Enter "What is your email address?" in the textbox and add a new entity called "intent". In the value textbox, input "getEmail" and validate the expression. That's it, you have successfully taught your bot to understand the intent of the expression "What is your email address?".
Communicating with the Wit.ai App through curl (HTTP API)
Now go to the settings page.
As shown above, enter "What is your email address?". Once done, copy the text to the clipboard. This can be done easily by clicking on the button above learn more. Now curl the text.
Voila, your application is 99% confident that your intent is to "getEmail". With this, you have the basics of creating a chatbot. You can extract the value and create your own function. I'll expand on this on my next blog post where I'll create a fully functioning company chatbot.
You have mastered the basics of Wit.ai
Congratulations! You now possess enough knowledge to explore and play around with Wit.ai on your own. Your journey doesn't end here and I hope you would create amazing things like Disney's Zootopia chatbot.
Hopefully, this blog post has been useful to you. I appreciate any feedback both good and bad. I'm still learning Wit and have much to learn but please don't hesitate to contact me to discuss Wit.ai.