You will build a chatbot for a car rental company. We will make a number of simplifications, for example: we will assume that each city can only have one rental office. However, the general idea should be fairly accurate with what you would expect from a real chatbot.
For the backend, we will use a demo API hosted at https://api.demo.nativechat.com, which will come with some preconfigured data and cloud functions to aid you along the process.
The tutorial will introduce each data collection and cloud function as we go.
If you are curious and would like to preview the data, you need to make a GET request and pass in an authentication key, which means that you can't just paste the URL in your browser to get the data.
This tutorial is structured in a slightly different way to how you would actually go about building a chatbot. Usually you would add all the required features each time you add a new conversation step.
However, in order to make things simpler and easier to understand, the tutorial is divided in a number of chapters where each introduces a new concept and expands on the existing chatbot project.
It is important that you type each piece of code yourself and don't copy and paste solutions unless you are really stuck.
Typing will help you get used to the process, syntax and the structure of the project. While copy and paste is good to see how something works, before you forget it all. So, if you want to really learn: type, type, type it all.
Even as you progress through the tutorial and feel like you have already completed a similar task and that you can just copy and paste and tweak what needs changing, even (or especially) then try to go through the process and build each piece of the chatbot.
First, you need to log in with your NativeChat Account to NativeChat Portal.
If you don't have a NativeChat Account yet, you can create one here.
From the Chat portal, create a new project (by pressing the big plus button), select a Blank bot template, call it Car Rental, and press Create.
Although the template you used is the Blank bot, you will find that there is already some code in the Cognitive Flow tab.
You will probably notice that the code is in a JSON format. That is correct, NativeChat uses a declarative approach, where you describe what you want the chatbot to handle, and the chatbot engine manages the process for you.
The chatbot contains configurations for the following conversations:
welcome - what to do when a user starts a new session. Usually used to greet the user.
help - what to do when a user types help or when the bot gets stuck. Usually used to let the user know what the bot’s capabilities are.
restart - what to do after the user asks to restart.
settings - general project settings. Currently used for default messages.
commands - commands that allow the user to restart a conversation or to ask for the next batch of items.
Note that you don't have to close this window and open it again each time you make changes to your chatbot. Usually it is enough to save the chatbot and type restart for the chatbot to use the latest update.