Start Your First Chatbot
A chatbot is an application that allows humans to have online conversations with a computer via text or voice. This tutorial will create a simple chatbot using the Kata Platform. So, let’s get started.
Video tutorial
You can watch the tutorial to start your first chatbot or follow the steps in this documentation
Registration and Login
- Open your browser and enter the URL https://platform.kata.ai/.
- Register your data in the Kata Platform by filling in the required fields.
- After filling in all the data, click Sign Up. We will send a verification email to your registered email.
- Continue to verify your account by entering the password to continue the registration step.
- Login with your account
In this step, you will create a simple chatbot as in the image below. Let’s start.
Create a Project
You will see all projects in the project dashboard. A project consists of bot design, NLU, and CMS.
- Click Create Project to create a new project.
- Fill in project detail, then click Create Project.
- After the project has been created, you will be redirected to the Conversation Flow page to create flow, state, and action.
- Congratulations, you successfully created a new project.
Create a Flow
Flow is a conversation chatbot flow. In this simple tutorial, you will create 1 flow and use 1 default flow. Default flow is a fallback flow or a flow to answer if questions are not understandable by a chatbot.
- In the Conversation Flow, click the Create Flow.
- Fill in the flow name hello, then click Create. If a flow is successfully created, it will show in the Conversation Flows sidebar.
Create a State
The state is a step in a conversation. A flow must have 1 state called the initial state, and 1 state called the end state.
In this tutorial, you will create 2 states in the flow “hello”, which are “init” state and “hello” state. “Init” state will become the initial state, and the “hello” state becomes the end state.
- Click the icon "+" in the Conversation Flow menu.
- In this step, you will create an initial state. Fill in the “init” state, then turn on the toggle Initial State to set it as the initial state.
- Next, create a “hello” state. This state will be an end state, so you must turn on the End State toggle. Do a similar step with the second step.
In this step, you will get an error that an end state must have at least 1 action. So, the next step is to create an action in the “hello” state.
Create an Action
Action is a bot response in text, images, buttons, interactive messages such as a carousel in LINE, a generic template in FB Messenger, and others. A state must have at least 1 action, except in the initial state. This tutorial will create a text action in the “hello” state.
- Click in the “hello” state, then it will show a form on the right screen.
- To create a new action, click on the Add action button.
- Click on the “+” icon. Next, it will show various available actions. Choose action Text.
- After choosing a Text action, it will show an interface like in the image below. Input action name, then click Add Variant button to input text response.
- Finishing your action by clicking the Create Action button.
- Then, finalize the state by clicking the Create button.
Create an Intent
A chatbot needs to understand end-users input to show correct action or bot response. The intent will recognize input in the Kata Platform by checking keywords, NL, or regex. End-user is a term for chatbot users.
This step will create an intent to catch when end-users greet the chatbot.
- In the “hello” flow, choose the Intent menu. Next, click Create Intent.
- Input intent detail with name “helloIntent”. Then, turn on toggle As Initial to create a trigger in the chatbot and execute the “hello” flow.
- Next, continue to choose the Text type. Input a condition to make the chatbot execute the intent when the end-user sends the message “Hello” or “/start”:
content == ‘Hello’ || content == “/start”
- Click the Create button to finish creating intent.
Create a Transition
Transition is a procedure to move from one state to another state if a condition is fulfilled. Create transition by pulling a line from the source state to the destination state, like the image below.
- In this step, you will create a transition between the “init” state and the “hello” state by pulling a line. If you succeed to create a transition, it will show a form on the right screen.
- Then, input condition detail to create transition can be executed if an end-user input is caught by “helloIntent” intent:
intent == ‘helloIntent’
- Click the Save button to finish creating the transition.
Publish Bot
This publish feature is useful to save changes in the form of revision numbers. The Publish button can be found on all Flow pages.
- In this step, you will save the created bot design. Click the Publish button which is placed in the top right corner.
- To ensure your bot is stored correctly, enter the Revision List menu. The revision list will show every new revision at the top.
Testing Your Bot
In this step, you will try a simple chatbot using the emulator feature.
- On the lower right of your screen, click on the Test Chatbot button. You will see a small window with a chat conversation interface if you succeed.
- Type “Hello” word. If your chatbot works well, then it will show the chatbot reply witn created action. This image is the correct example.
- Congratulations, your first chatbot is done. Next, continue to deploy your chatbot in messaging platform Telegram.
Create a Deployment
Deployment is a step to merge all Revisions in Flow, NLU, and CMS so that bots can be integrated into the channel. Before starting channel integration, chatbots must at least have 1 deployment.
- In the sidebar, choose the Deploy menu. Then, choose Overview.
- Click the New Deployment button, then it will show a form on the right screen.
- Choose the deployment version. In Kata Platform, there are 3 deployment versions:
- Major to deploy big changes, such as change chatbot use-case.
- Minor to deploy medium changes, such as adding new features in your chatbot.
- Patch to deploy small changes, such as change copy in action.
- Then, click the Submit button. If deployment is successful, then the interface will be shown like this.
Create an Environment
Step after creating a deployment is to create an environment. An environment is a zone in computer science that provides a place to run integrated applications. Kata Platform has 3 environments: development, staging, and production.
- Choose the menu Deploy, then choose Environment.
- In this step, you will create a Development environment. Click the button Create Environment in the Development card.
- Fill in the environment, then click Create.
Integration to a Channel
Create a Channel
In this step, you will create a chatbot integration with the Telegram messaging platform. Telegram is a free messaging platform to deploy chatbots with a simple setup.
- In the Deploy > Environment, click the Create Channel button.
- You will be redirected to the Create Channel page. Click the “+ Create Channel” button to create a new channel.
- Fill in the channel name and choose type as Telegram. To fill in the Bot User OAuth Access Token field, we must set up a chatbot in Telegram first. The next step is to open your Telegram application and log in.
Before you start, you need a Telegram account already registered and logged in to your application.
Connect chatbot to Telegram
- The first step is to register your bot to the BotFather account.
- Type
/newbot
and BotFather will ask for your chatbot name. Feel free to use any name you like. - After that, you will be asked to enter your chatbot username. Remember that your bot username has to either start or end with
bot
. - Once finished, BotFather will respond with a bot token to access the Telegram Bot API.
- Go back to Platform, then copy the bot access token into the channel drawer.
- Click Create to get a webhook from the Kata Platform. Then, click the copy button to copy the webhook URL.
- Click on the webhook link to View Channel detail. It will show a drawer to copy the access token and webhook URL.
- Next, open a new tab on your browser and enter this URL. Change
{my_bot_token}
into your own bot token. Also, paste{kata_platform_webhook_url}
with the copied webhook URL.
https://api.telegram.org/bot{my_bot_token}/setWebhook?url={kata_platform_webhook_url}
- Click “Go” or press Enter on the keyboard.
- If you see the message “Webhook was set,” you’re all set! Let’s try our chatbot. Open Telegram on the desktop or mobile, and start chatting with your bot.
This is the end of getting started with a chatbot. You can contact support@kata.ai if you have any difficulties implementing this.