Build an AI chatbot on Your custom data

JYOTI VYAS
5 min readSep 14, 2024

--

The world is digital and so are businesses, due to the advent of Artificial Intelligence it is now easier to build products that would ease operational tasks such as customer support.

In this blog, you’ll learn how to build an AI chatbot using your proprietary data, which you can integrate into your website, WhatsApp Business account, Instagram, and mobile application.

Why Create a custom chatbot?

Most businesses have their customer support running so why would anyone want to build a chatbot, well it’s clear that human-operated call centres can work only certain hours and as the business grows the support should be scaled as well, which costs a lot for the company.

But with a custom chatbot, customer support can run 24/7, 365 days without any human intervention which eases the workload of employees and prevents burnout.

So, let's get started!!

Step 1: Getting Started with Botpress

To begin, head over to Botpress and sign up using your Google or GitHub account. Once you’re signed in, you can start building your first chatbot.

  1. Create a new bot and choose one of the available templates or start from scratch.
Click on New bot to create a bot
You can choose any Template depending upon your use case

I have chosen Start from Scratch you can use as per your need.

  1. Go to Edit in Studio to add the structure you want to create.
  2. Customize your bot by adding a knowledge base that can consist of web pages, pdf documents, or text files.

To initialize your chatbot you need to create a standard node which can be created by right-clicking on the screen and then connecting it with start and end. You can use text by which your chatbot would greet the user.

Screenshot of BotPress

Step 2: Adding a Knowledge Base

To make your bot intelligent and capable of answering specific queries, you need to build a knowledge base.

To create a knowledge base go to Flows>Add knowledge base

In Botpress, this is as easy as adding URLs or documents. For instance:

  • Upload text files or PDFs.
  • Index a web page URL (such as your business website) to allow the bot to pull specific content.
A snapshot of botpress website telling how to add a knowledge base
Adding Knowledge base into the chatbot

Step 4: Configuring the Chatbot Responses

1. Setting Up Input Cards

  • You can configure how your bot will interact with users by creating input cards. These are essential for structuring the bot’s conversation flow.
  • Right-click on the main node (the start point), choose Add Card, and select Raw Input. This allows the bot to accept user queries and process them.
  • For example, you could create a card that asks, “What would you like to ask?” followed by a Raw Input that allows users to type in their questions.

2. Enabling Knowledge Answering

  • Once the input is set, you need to enable knowledge answering. This ensures that the bot retrieves answers from the knowledge base.
  • Go back to the main card, click Enable Knowledge Answering, and link it to the knowledge base you created earlier.

Now, when a user asks a question like “Can I cook Biryani in an electric rice cooker?”, the bot can retrieve the answer directly from the knowledge base.

Step 5: Adding Fallback to ChatGPT for Broader Queries

Sometimes, your knowledge base may not have all the answers, and this is where you can configure the bot to ask ChatGPT (or any other fallback AI) for answers.

1. Adding Fallback Nodes

  • Right-click the card node, and add a Standard Node. This node will act as a fallback when the knowledge base doesn’t have the answer.
  • In this node, you can write a script that triggers ChatGPT when no valid answer is found in the knowledge base.

For instance, if someone asks “How did planet Earth come into existence?” and your knowledge base doesn’t cover this, the bot will now automatically ask ChatGPT and provide the answer from there.

Step 6: Testing and Fine-Tuning Your Chatbot

1. Testing the Bot

  • Once everything is set up, start a new conversation by clicking New Conversation. Ask the bot questions based on the knowledge you’ve provided. For example, ask:
  • “How the earth came into existence?” If you’ve indexed a news article about cosmology, the bot would answer it.

2. Improving the Logic

  • If your bot gives incorrect or incomplete answers, go back to the Flow Editor and refine the logic. For instance, you can set conditions where the bot only asks ChatGPT after confirming that no answer is available in the knowledge base.

Step 7: Publishing and Deploying Your Bot

1. Publishing

  • Once your bot works perfectly, click on Publish. This will finalize your bot and make it ready for deployment.

2. Deploying to a Website

  • Botpress allows you to embed your chatbot on any website. After publishing, you can get a sharable link or an embed code to integrate into your website.

For example, you can deploy the chatbot to answer FAQs on an e-commerce site or provide real-time customer support.

Botpress custom AI ChatBot that we have built

Conclusion

Building a custom chatbot that draws from your data has never been easier, thanks to Botpress. By following these steps, you can create a chatbot tailored to your specific needs, capable of answering user queries based on information you control. Whether it’s for business insights, customer support, or any other use case, Botpress gives you the tools to create intelligent and interactive bots.

Now it’s your turn to experiment with Botpress and create something amazing! Share your bots in the comments or let me know how it’s working out for you.

Author’s Note: If you liked this article do share it, clap and follow for more. To integrate your created bot on WhatsApp check out this video.

--

--

JYOTI VYAS
JYOTI VYAS

Written by JYOTI VYAS

Hi, I am a freelancer data scientist with engineering degree I write about AI and explain concepts related to Artificial intelligence

No responses yet