triniti.ai

Conversational AI: Another post on creating a chatbot in 10mins

Disclaimer: Indeed a very simple one, as smarter one takes⏳+🏋️‍♀️ (i.e. time & effort). Though it would be a good start.

Shashank Sharma
Published in
9 min readMay 14, 2020

--

In this article, we will build together an elegant and powerful FAQ chatbot, which answers queries related to COVID-19 using triniti.ai.

What you will learn in this article:

  • Creating a new workspace in triniti.ai
  • Adding FAQs from your website’s existing FAQ page
  • Responding with text and rich content like images, videos, and more
  • Offering a simple workflow where needed

First and foremost, you need a triniti.ai account to follow along. You can register for free, no credit card required. Use SHASHANK as promo code.

Start at developer.triniti.ai/register. Meanwhile, I’ll wait and watch some funny cats gifs.

Register! :D

After you registered successfully and log in for the first time, you would see a page similar to one below. Take a screenshot of that and share it to trustmeiregistered@active.ai. Sorry, I am just kidding again. 😇

Welcome Screen

Click Start.

Create a Workspace

Estimate time: < 1 min

A workspace defines a new project space. Workspace, as the name indicates, is a space that triniti.ai provides you to do the chatbot building process.

  • Click on ‘Create Workspace’
  • Give your virtual assistant’s workspace a name
  • Select the country where the virtual assistant will be deployed
  • Go with the default Workspace Type (Cognitive QnA) and Domain (Custom)
  • Select a pricing plan; your first workspace comes with a 30-day free plan
  • For now, skip the Knowledgebase option, we can do that at a later time. Click the ‘Create’ button to create your first workspace.
  • Congrats on your new workspace. 🥳

A more detailed version is available in our online documentation portal at Create your first workspaces.

Load FAQs from a website*

Estimate time: 1–2 mins

Once your new shiny workspace is created, you will be prompted with options to configure the knowledgebase which we skipped during workspace creation.

We will use the first option to import the FAQs from a website. Copy-paste this URL https://www.cdc.gov/coronavirus/2019-ncov/faq.html and click Import.

At this point, we can just go ahead and train the chatbot. To train your knowledgebase, click on the ‘Train’ button on the Knowledgebase page. It should take about 1–2 minutes.

Once the training is successful, you will find another side option appear with the text “Test your bot” and a green dot. The green dot signifies your chatbot is ready to test.

Voila! It’s not even 5 minutes since we started, and your chatbot is ready to be tested with around 65 FAQs and pre-configured small talk. Pretty cool, eh? 😎

Go ahead test your chatbot.
Ask queries like,
- What is coronavirus?
- How do I protect myself?
- Why do we see a rise in cases?

You may find that some FAQ responses are not adequately aligned, or links are missing. This is part of the testing and improvement cycle. Remember⏳+🏋️‍♀️

Rich Template Responses

Estimate time: < 2 mins

The next step of enriching your user experience is to offer rich content. You can format the responses as Text, Card, Image, Carousel, List, Button, and Video.

For our chatbot, we will change the response for “How can I help protect myself?” FAQ to a carousel response. For that, follow these steps.

Please note, you don’t need to train the chatbot again if only response is updated. Test again to check the updated response.

How do I protect myself?

A detailed version is available in our online documentation portal at Formatting FAQ Response for more details.

Workflow as Response

Estimate time: 5–6 mins

Sometimes we need additional information from the user before answering their question, or we need to offer them a response based on a sub-category of their question. We can do this using a workflow response.

As an example, let me ask you a few questions:

Are you taller than me?
Or are you younger to me?
Or do we share the same favourite colour?

If you don’t know me, it’s impossible to answer before asking counter questions. In the previous section, we added FAQ responses as text, templates. But sometimes you require more information before answering a question. In triniti.ai, we achieve this using a workflow.

In simple terms, a workflow is a series of steps to complete some work. What we will do next is to enable our chatbot to answer a widespread query: “Do I need to wear a mask?”.

We can reply with a big paragraph response for queries like that. But instead will ask a few questions to provide the user with a simple yes/no response. I created a simple flow chart to illustrate how our AI assistant is going to decide if the user needs to wear a mask or not.

Our workflow would look similar to the flowchart above. To begin, add a new FAQ in the triniti.ai knowledgebase.

  • Click on “Add a Question”
  • Type or copy-paste “Do I need to wear a mask?” as a question
  • Click on the “Format Response” in the answer section.
  • Select “Workflow” then “Manage Workflow.”

Pro Tip: Start training to save time while you create the workflow response. Remember, response updates don’t require training! 🤓

Below is the updated flow chart with our action plan.

Action Plan

Some basic terminology for workflow editor:

Workbook

A workbook is where you will design the workflow. Each workbook can have multiple nodes to define the flow. The figure below shows a new workbook only with a Start node, Cancellation node and the toolbar.

Workbook

Node

Node is one step of the process to complete a flow. Every node has three responsibilities.

1. Ask input from the user (Prompt)

2. Verify inputs (Validation)

3. To route to next step (Connection)

Each node except the start and cancellation node has four buttons on the right-hand side upper corner to open Definition, Validation, Connection and to delete. For the start node, there is no Validation. The tiny “garbage can” icon 🗑️ on every node enables the user to delete a particular node selectively.

Click on any node to open the dialog window to configure the node. For our workflow, we will be only using the definition and the connection tab of the dialog window.

Make sure to save the changes in each node’s dialog window tab separately using the Apply button. Save the workflow often, as we’ve not yet released the ‘autosave’ feature. It’s dangerous yet thrilling.

Enough of gyaan, let's get to the action.

  1. Create a node from the start node and click on that node to open the dialog window. In the definition tab, give this node a name as “Are you sick?”. And click on the Apply button in the dialog window to save the changes for the node.
  2. Create two nodes from “Are you sick?” node. And similarly, like the above step, give a name to these two nodes as “Wear mask” and “Going out?”. Press and hold the trackpad or mouse while you drag the node to a new location to make your workflow look similar to our flow chart.
  3. Create one node from “Going out?” node and name it “Not required”.
  4. Now your workflow must be looking similar to our flow chart, except a connection missing from “Not required” node to the “Wear mask” node, which will add later.
Partial workflow till step 4

5. Click on the “Are you sick?” node to open the dialog window. In the Prompt section of the Definition tab, select Send Template and click Create Template.

6. Choose Button template. Copy-paste title as “Are you sick? Any symptoms like Cough, Sore throat, Shortness of breath, Fever”.

7. Add two buttons with button title as “Yes” and “No”. For yes change the button postback data to {“sick”: “yes”} from {“options”: “no”} & for no {“sick”: “no”} from {“options”: “no”}. This postback will use while making the connections. Click on the cross icon to save the button. And Save button to save the template. Apply button to save the node.

Button template | Button for Yes

8. After prompt is set for this node. Go to Connection tab. Add another condition block.
In one condition block
- set the “Entity/Variable” as “sick” (which is same as what we set in the button postback).
- Operator as “==”
- Value as “yes” (Same as what we set in the Yes button postback)
- Node value as “Wear mask”
In the other condition block
- set the “Entity/Variable” as “sick” (which is same as what we set in the button postback).
- Operator as “==”
- Value as “no” (Same as what we set in the Yes button postback)
- Node value as “Going out?”
Click the Apply button to save the connections.

“Are you sick?” Node Connections

9. Similarly, add button template prompt and connections for “Going out?” node. From “Going out?” node your yes condition node would point to “Wear mask” node.

“Going out?” node connections

After adding connections for “Going out?” node, the workflow looks similar to our flow chart.

10. Like we added template prompt for “Are you sick?” and “Going out?” node, let’s add send message prompt for “Wear mask” and “Not required” nodes with respective messages.

11. Click save for the workflow.

12. Voila again! You successfully created your first workflow.

Do I need to wear a mask?

A more detailed overview is available in our online documentation portal at workflow documentation.

Let’s see what you will prepare next with the skill you just learned.

There is still a lot you can do on the platform. We have just scratched the surface. I would leave you to explore it on your own. For any queries or support, join our Slack channel through ask.trinti.ai. And refer our online documentation portal docs.triniti.ai for more information.

Happy learning. 👨‍🎓

Disclaimer: The Covid-19 related FAQs and workflows used in this article are only for training purpose. Please follow the local guidelines about Covid-19.

*URL import is in beta and may not work on all websites.

--

--

Shashank Sharma

Programmer | Technology enthusiast | Building projects and teams