• author: Liam Ottley

Building an AI Automation Agency Client Chat Bot

In this article, we will be taking a detailed look at the process of building a chat bot for one of our own AI automation agency clients. This particular chat bot was valued at $3,500 and we will be discussing every step of the process. This article is especially valuable for those who are new to the AI automation space and want to quickly grasp the concepts of using Bot Press and Stack AI to build chat bots.

Introduction to Morningside AI

Before diving into the details, let's briefly introduce ourselves. We are Liam Otley and we run an AI development and AI automation company called Morningside AI. Our company specializes in building custom coded AI applications and assisting businesses in automating their processes. Our goal is to reduce friction, decrease expenses, and ultimately increase profits for our clients. In fact, we are on track to exceed our revenue goal of $100,000 for the month of June.

Background and Functionality of the Chat Bot

The client we worked with at Morningside AI operates a SaaS platform that caters to martial arts businesses. Their platform helps handle leads, manage systems, and promote products. Our task was to build a chat bot that could be integrated into the websites of the client's customers. The chat bot's purpose was to engage with users, gather their preferences, and guide them to the appropriate products and services offered by the businesses.

The chat bot was designed to be easily deployed across multiple client websites. Its main functionality revolved around collecting information from potential customers, understanding their intent, and ultimately pushing them towards the conversion event, which, in this case, was booking a class. Additionally, we incorporated lead capture capabilities, enabling the bot to collect contact information from users and enrich their leads with the data gathered during the conversation. To accomplish this, we utilized Zapier to send the captured information directly to a Google Sheet.

To provide a visual representation, we have embedded the chat bot on a test website. When a user interacts with the chat bot, it begins by introducing itself as Joseph, an AI martial arts assistant from Superstar Martial Arts. From there, it guides the user through a personalized conversation, helping them find the correct products and services. It also offers the option to book a trial class via a provided link. Furthermore, the chat bot incorporates lead capture functionality, allowing users to submit their email and name to receive further information.

Leveraging AI Functionality

While the chat bot's initial interactions might not seem AI-enabled, it is important to note that the bot incorporates an open loop functionality powered by a knowledge base. This knowledge base has been ingested into both Stack AI and Bot Press. Users have the ability to ask further questions, and the chat bot queries the knowledge base to provide answers. This open loop allows users to explore various aspects of the business until they find the desired information.

Tech Stack for the Chat Bot

To build this chat bot, we utilized Bot Press as the foundation for handling logic, deployment, and the bot's user interface. Custom code blocks within Bot Press allowed us to make API calls to our Stack AI functionality, which provided advanced AI capabilities. In this article, we will demonstrate how to build the chat bot from scratch and connect it with Stack AI. The integration process is simplified, involving basic API calls that are beginner-friendly. However, it is worth mentioning that the landscape of chat bot platforms is rapidly evolving, so the tools and technologies we mention might change over time.

Availability of the Chat Bot Template

We are excited to announce that we can now share the chat bot template with you. Upon completion of this article, you will have a clear understanding of how to build the chat bot using Bot Press and Stack AI. Additionally, we will provide instructions on how to download and import the exact bot template into your own Bot Press account. This will enable you to use and customize the template for your own clients.

By following these steps, you can start building your own successful chat bots and leverage the potential of AI automation to enhance your business or help your clients. We hope you find this article valuable and stay tuned for the featured chat bot template at the end!

Creating a Chatbot from Scratch

In this tutorial, we will guide you through the process of creating a chatbot from scratch using Botpress. Whether you are a beginner or have some coding experience, this step-by-step guide will help you understand the different elements involved in building a chatbot.

Getting Started

Once you are logged in to Botpress, click on the "Create a Chatbot" option. If the option is not available, you may need to clear any existing projects to proceed. Choose to start from scratch for a complete understanding of the process.

After creating a new project, you will be presented with a workspace resembling the end product we are aiming to build. This includes two tree structures containing various nodes that interact with users.

Node Placement and Text Inputs

Begin by placing your first node on the workspace. You can quickly add a standard node by dragging and dropping it onto the workspace. Rename the node by clicking on it and entering a suitable name, such as "Hello."

Next, add the initial text content to the node. We recommend copying and pasting the text to maintain the flow of the tutorial. You can pause the video at any point to copy the text if needed.

Capturing User Information

To capture information from the user, you will need to add an information capture node. Choose the "Single Choice" option, which allows users to select an option using buttons. Write the question you want to ask, such as "What brought you here today?"

Create options for the users to choose from by clicking on the plus icon. For example, you can add options like "Martial arts for myself" and "Martial arts for my child." Make sure to create a variable to track and save the user's response, such as "who for."

Testing the Chatbot

Before proceeding further, you can test your chatbot by starting a conversation with a simple greeting like "hi." This will allow you to observe how each element displays in the conversation. The message exchange, capture question, and resulting variable value can be seen in the chat window.

Adding Text and More Choices

Continue building your chatbot by adding more nodes and text blocks. For example, create a node named "Why are you here" and add a text block with relevant information.

To gather more intent from the user, add another "Single Choice" node. This time, ask the question "Why are you looking to learn martial arts?" and provide options like "I want to stay fit" and "I want to learn self-defense." Since these options do not require different routes, you can connect them without splitting.

Incorporating Custom Code Blocks

To further enhance your chatbot's functionality, you can use custom code blocks. These blocks allow you to access the variables stored in Botpress and perform logic operations using basic JavaScript.

In our example, we add a code block to the node asking about lessons. By setting the "next message" variable based on the user's response, we can create personalized messages that align with their input.

Continuing the Chat Flow

The process of creating a chatbot involves adding more nodes and text blocks to guide the conversation. By capturing user preferences and intent, you can provide a tailored experience.

For example, you can add a node named "Which martial art" and ask the user to select from options like kickboxing, MMA, and karate. Remember to create a variable to track the chosen martial art type, such as "type of martial."

By following these steps, users can proceed through the chat flow while receiving customized messages based on their input.

Using Custom Code Blocks to Simplify Chatbot Development

In this section, we will explore how to use custom code blocks in chatbot development to optimize and simplify the overall structure of the bot. Custom code blocks allow us to set variables and customize messages based on user input, eliminating the need for multiple nodes and reducing complexity.

Personalizing Messages based on User Input

To provide a more tailored user experience, it is crucial to personalize messages based on specific user inputs. By using custom code blocks, we can achieve this customization efficiently. For example, when asked why they are interested in learning martial arts, if the user responds with "self-defense," the next message can be personalized to convey the importance of self-protection in today's world. This personalized message establishes a connection between the user's input and the value offered by the martial arts program.

Implementing Conditional Blocks with Execute Code

In some cases, we may encounter scenarios where a large conditional block is necessary. This can be easily handled using the execute code block in chatbot development. Although it may appear complicated, executing code blocks on a larger scale follows the same principles as smaller ones. By utilizing switch case statements, we can efficiently generate personalized responses for different combinations of user variables. This approach significantly reduces the number of nodes required, making the chatbot structure more streamlined.

Leveraging Knowledge Query Functionality

To enhance the chatbot's capabilities, we can integrate knowledge query functionality. This ensures that the chatbot can answer a wide range of user queries effectively. Our recommended approach involves utilizing both Botpress and Stack AI's knowledge query features. Botpress knowledge query acts as an initial query and if unable to provide an answer, triggers an API call to Stack AI's knowledge query using GPT4 or 3.5 turbo models. This layered approach ensures a more comprehensive coverage of user queries and increases the chances of obtaining accurate responses.

Setting up Botpress Knowledge Query

To configure the Botpress knowledge query, we need to create a knowledge base within Botpress itself. This can be done by uploading a text file containing frequently asked questions (FAQs) or support documents provided by the client. Once the knowledge base is set up, we enable the knowledge agent in the Agent section of Botpress. This enables the chatbot to query the knowledge base when users ask questions. By leveraging Botpress knowledge query, we can improve the chatbot's ability to provide accurate and timely responses.

Using Bot Press and Stack AI to Enhance Knowledge Queries

Bot Press and Stack AI are powerful tools that can be used to improve knowledge queries in chatbot systems. However, understanding how to configure and implement these tools can be confusing at times. In this article, we will guide you through the process, step by step.

Configuring the Knowledge Query Node in Bot Press

The first step is to configure the knowledge query node in Bot Press. This node allows the chatbot to query its knowledge base when a user asks a question. Here's how to set it up:

  1. Set the question that will be asked to the user when they arrive at the knowledge query node. For example, you can use the question "What would you like to know?"
  2. Change the input type from single Choice to Raw input. This allows the user to provide a freeform response.
  3. Create a new variable called "question" to capture the user's input.

Next, we need to set up the routing depending on the response from the knowledge base agent. Here's how to do it:

  1. Add an expression transition with the label "no answer from knowledge". This transition will be triggered if the knowledge base agent does not respond to the query.
  2. Set the condition of the transition to check if the knowledge agent has responded. If it hasn't, the chatbot will be directed to the next node.
  3. Add another transition with the condition "always true" at the top of the block. This transition will be triggered if the previous condition is not met.

By setting up this routing, we ensure that the chatbot takes the appropriate action based on the response from the knowledge base agent.

Enhancing Knowledge Queries with Stack AI

While Bot Press's knowledge base agent is powerful, it may not always provide the desired response to user queries. In such cases, we can leverage Stack AI to enhance the chatbot's capabilities. Here's how to integrate Stack AI into the chatbot system:

  1. Create a new node called "Stack AI query" below the knowledge query node.
  2. Add a single choice question in the Stack AI query node to ask the user if they have any further questions. The options can be "Yes" and "No".
  3. If the user chooses "Yes", route them back to the knowledge query node, creating an infinite loop for answering multiple questions.
  4. If the user chooses "No", direct them to the end of the conversation.

With this setup, the chatbot becomes more interactive, allowing users to ask multiple questions and receive accurate responses.

Testing the Chatbot's Knowledge Query Functionality

Before deploying the chatbot, it's essential to test its knowledge query functionality to ensure it provides accurate and relevant answers. Here's how to do it:

  1. Initiate a conversation with the chatbot and arrive at the knowledge query node.
  2. Provide a question to the chatbot and observe its response from the knowledge base.
  3. If the chatbot's response is unsatisfactory, navigate to the Stack AI query node and ask a further question.
  4. Verify that if the knowledge agent does not respond, the chatbot is directed to the Stack AI query node.

By thoroughly testing the chatbot's knowledge query functionality, we can ensure a seamless user experience and reliable responses.

Leveraging the Power of Stack AI for Advanced Queries

To answer more complex questions, we can integrate Stack AI's document database template. Here's how to set it up:

  1. Sign up for a Stack AI account, which is free to join.
  2. Access the document and database templates in Stack AI.
  3. Choose the document Q&A option to set up the document query system.
  4. Upload the relevant documents to be queried.
  5. Customize the prompt template to extract and insert relevant information into the response.
  6. Experiment with prompt engineering to personalize the answers using GPT 3.5 turbo language model.

By leveraging Stack AI's document database template, we can provide users with accurate and tailored responses to their queries, enhancing the chatbot's capabilities.

Deploying the Enhanced Chatbot

Once the chatbot's knowledge query functionality is augmented with Stack AI, it is ready for deployment. Here's how to deploy the enhanced chatbot:

  1. Follow the deployment process in Stack AI, ensuring that the JavaScript API call is implemented correctly.
  2. Copy the provided code and paste it into the Bot Press execute code block.
  3. Connect the execute code block to the Stack AI query node in the chatbot flow.

Now, the chatbot is armed with advanced capabilities to provide accurate responses to users' knowledge queries.

Using Botpress and Stack AI for Chatbot Development

In this article, we will explore how to utilize Botpress and Stack AI to develop a chatbot that can provide answers to user inquiries and capture leads.

Creating an API Endpoint with Stack AI

To begin, we need to set up an API endpoint with Stack AI. We can copy and paste code into an execute code block in Botpress. Before doing so, we obtain the necessary URL from Stack AI, ensuring that we have the correct endpoint. To access the endpoint, we add our Bearer token, which serves as our API key, to the code. Each user will have their own unique API key.

Once the endpoint is set up correctly, we can create a variable called API response to store the response from Stack AI. The input to Stack AI will be the question captured from the user, which is saved in the question variable. If the chatbot cannot answer the question using the knowledge base in Botpress, it will then query Stack AI using the same question. The output from Stack AI will be stored in the API response variable. This response will be displayed to the user as an answer to their query.

Capturing Leads

In addition to answering user questions, our chatbot will also be able to capture leads. We can initiate the lead capture process by asking the user if they have any questions regarding getting started. One of the options presented to the user is to receive information via email. If the user selects this option, the chatbot will prompt them to provide their email address and full name.

To capture leads, we create an execute code block that utilizes Zapier to make a POST request containing the lead data. In this code block, we set the zapierSuccess variable to false initially. We then include all the captured lead data as the payload for the API call. The URL used in the API call will be provided by Zapier, where we set up a custom webhook to receive the data and push it to a Google Sheet.

If the POST request is successful, the zapierSuccess variable is set to true. Based on the value of zapierSuccess, the chatbot will display a message indicating that the lead capture was successful and make an offer before asking if the user has any further questions. If the POST request fails, the chatbot will handle the error and notify the user accordingly.

Martial Arts Program for Children

The chatbot also has a section dedicated to enrolling children in a martial arts program. Once the user selects this option, the chatbot will ask why they want their child to learn martial arts. The user's response will be saved in the whyLessons variable. Following this, the chatbot presents the user with options such as building confidence, building strength, learning discipline, or all of the above.

Once the user provides their input, the chatbot stores the information and proceeds to the next node. The process for capturing user input and providing a personalized message based on that input is similar to the adult tree discussed earlier.

Building a Personalized Martial Arts Chatbot Using Bot Press

Bot Press Logo

In this article, we will guide you through the process of building a chatbot using Bot Press to help customers get information about martial arts classes and find the right program tailored to their needs. We will also cover aspects of custom knowledge-based querying and integration with Stack AI. Additionally, we will explore lead capture functionality that sends data to a Google sheet via Zapier integration.

Customizing the Chatbot

To start, we need to add a custom code block that will personalize the chatbot's responses based on user input. This code block will assign a personalized message to the next_message variable, depending on the user's previous answers.

// Custom code block
next_message = // assign personalized message based on user input

Next, we need to provide a single-choice question asking if the user has a martial art in mind. We will save the response to the type_of_martial_art variable.

  • Do you have a martial art in mind?
    • Kickboxing
    • MMA
    • Karate

Once the user selects an option, the chatbot will navigate to the appropriate branch based on their chosen martial art. For example, if the user selects "Karate," the bot will provide information specific to karate classes.

Publishing and Integrating the Chatbot

Once we have finished building and testing the chatbot, we can easily publish it by clicking on the "Publish" button in the top-right corner of the Bot Press interface. This will make the chatbot accessible through various integration options.

One integration option is embedding the chatbot in a web page. To do this, we can copy the pre-configured script tag provided by Bot Press and paste it into a web page. Clients can then share this web page link with their customers, allowing them to interact with the chatbot directly.

Another option is to provide the chatbot's script tag to clients, who can include it on their own website. This allows for a seamless user experience, as the chatbot will pop up on their site. It is even possible to customize the chatbot's UI further to match the client's branding.

Exploring Advanced Deployment Options

In addition to the basic integration options mentioned above, Bot Press offers other deployment options that can provide different services to clients.

By experimenting with these options, you can offer additional value-added services and generate more revenue. Some of these advanced deployment options include:

  • WhatsApp integration
  • Facebook Messenger integration
  • Amazon Alexa integration
  • Slack integration
  • And more!

These options allow you to expand the reach of your chatbot and provide a more comprehensive solution for your clients.

In this tutorial, we covered the essential elements involved in creating a chatbot from scratch using botpress. we explored node placement, text input, capturing user information, testing the chatbot, incorporating custom code blocks, and continuing the chat flow.

botpress offers a powerful platform for building chatbots with minimal coding knowledge. with the ability to customize messages and track user preferences, you can create engaging chatbots for various purposes.

by following this tutorial, beginners can acquire a solid foundation in chatbot development and gain insights into handling common chatbot elements. the example provided can serve as a template for your future clients or personal projects, allowing for modification according to your needs.

whether you are new to chatbot development or looking to enhance your skills, this tutorial offers valuable insights and guidance. take advantage of the opportunities botpress provides and start building your own chatbots with ease.
In this section, we explored the benefits of using custom code blocks to simplify the development of chatbots. custom code blocks allow us to personalize messages based on user input and handle conditional logic efficiently. additionally, we discussed the importance of incorporating knowledge query functionality in chatbots to enhance their abilities. by leveraging both botpress and stack ai's knowledge query features, we can build more robust and intelligent chatbots that can effectively address user queries.
By combining the power of bot press and stack ai, we can create chatbots with improved knowledge query functionalities. the seamless integration of these tools enhances the user experience and provides more accurate and tailored responses. with bot press's native knowledge base agent and stack ai's advanced document database template, chatbots can answer a wide range of questions effectively. implementing and testing these enhancements are crucial steps in building successful and efficient chatbot systems.
By combining the capabilities of botpress and stack ai, we can create a versatile chatbot that can answer user queries and capture leads effectively. whether it is providing information or guiding users through the lead capture process, this chatbot demonstrates the power of these tools in developing conversational ai applications.
and Next Steps

Congratulations on building a personalized martial arts chatbot using Bot Press! This tutorial has provided you with a solid foundation in using Bot Press and integrating it with Stack AI. We encourage you to continue exploring different features of the platform and experiment with building various types of chatbots.

To further enhance your learning experience, we invite you to join our community Discord, where you can participate in workshops and Q&A sessions. Our community is the largest AI automation community globally, and we have members successfully acquiring clients and achieving significant results. By joining the community, you will have access to valuable resources and support from like-minded individuals.

We also recommend watching our "Best Niches for AI Automation Agency" videos, which provide insights and strategies for starting your own AI automation agency. It is crucial to select the right niche and approach when launching your agency to maximize your chances of success.

Finally, be sure to subscribe to our channel for regular updates on AI automation topics. We release videos two to three times a week, focusing on delivering as much value as possible. Additionally, you can sign up for our AI automation newsletter to receive tips and tricks directly in your inbox.

Thank you for reading, and we hope this article has been useful in helping you build your own personalized martial arts chatbot using Bot Press!

Previous Post

Five Best AI Automation Services for Beginners

Next Post

AI Automation Agencies: The Future of Online Business

About The auther

New Posts

Popular Post