Chat with us
Up to 60% OFF with Recurring Discounts on Premium Upgrades & Whitelabel FlexUp to 60% OFF on Premium Upgrade & Whitelabel00:00:00:00Claim
Knowledgebase/WhatsApp AI Agent Configuration/Article

How to Build WhatsApp AI Agent in BotSailor

  • 30 Sep 2026
  • 14 min read
  • 0 views
TL;DR:

⚡ Quick Answer

Chatbot Manager→Bots/Accounts→select your WhatsApp bot→AI→Agents→Create Agent

Create one agent per job. In this guide a mobile shop uses a customer support agent (answers product questions and suggests phones) and a billing agent (completes the purchase). Give each agent a name, a description, and a system prompt, and attach a knowledge source such as a Google Sheet with your product data.

Create the labels and custom fields the agents will use before you save them. Then open AI Configuration, turn on AI Agent, select both agents under Active Agents, add Agent Routing rules, click Save Settings, and test from a different WhatsApp number.

Before You Begin

✓An active BotSailor account with a connected and active WhatsApp bot.
✓The labels and custom fields your agents will use must already exist. If they do not, data will fail to save and the AI Agent will not be created properly or will not work.
✓A Google Sheet (or another knowledge source) containing your shop data: available products, prices, and specifications, with a header in the first row (see Part 4). To use a Google Sheet, integrate it with BotSailor first.

What Is a Multi-Agent AI Setup in BotSailor?

A BotSailor AI Agent is a specialized assistant. It follows a system prompt, uses the business knowledge you attach, and takes actions such as adding a label, saving a custom field, transferring the chat to another agent, or assigning it to a human team. Instead of one agent doing everything, you create separate agents for separate jobs and let BotSailor route each conversation to the right one.

This guide uses a mobile shop, Bikroy Shop, as the working example. The same steps apply to any business; only the prompts and the knowledge source change.

AgentPrimary Responsibility
customer support agentAnswers smartphone questions from the knowledge source and suggests products based on budget, specifications, and other interests. Never guesses when data is missing.
billing agentTakes over when the customer is ready to buy: collects payment method, name, delivery address, and email, then sends an invoice-style order summary.

📌 Important

Creating an agent does not make it available to customers. After the agents are created, you must turn on AI Agent in AI Configuration and select them under Active Agents (Part 6).

1

Prepare Labels and Custom Fields

Your system prompts will tell the agents to add labels and save customer information into custom fields. These resources must exist before you write the prompts. Otherwise saving data fails and the agent will not work as expected.

1

Create a New Label

Follow the numbered markers in the screenshot:

  1. Dashboard.
  2. Subscriber Manager.
  3. Click Manage.
  4. Select Labels. The Manage Labels panel opens on the right.
  5. Click Create New Label, name it, and save.
Subscriber Manager > Manage > Labels > Create New Label (markers 1 to 5).

Subscriber Manager > Manage > Labels > Create New Label (markers 1 to 5).

Create the labels your agents will apply. In this example, one label marks customers who start a relevant product conversation, and one marks customers who complete a purchase.

2

Create Custom Fields

Open Subscriber Manager, click Manage, and choose Custom Fields. Use the create option to add a field for each piece of information the agents will save. In this example, that means the customer's product query, payment method, name, delivery address, and email.

💡 Tip

When you write a prompt, type ## and choose the action and the resource from the pop-up list instead of typing IDs by hand. BotSailor stores the ID of the label or custom field for you.

2

Open the AI Agents Section

Follow the Numbered Path

Log in to BotSailor and click through the items in the order shown by the numbered markers in the screenshot below:

  1. Dashboard.
  2. Chatbot Manager.
  3. Bots/Accounts. Select the WhatsApp bot that will run the AI Agent (here, Bikroy Shop).
  4. The AI tab.
  5. Agents.
  6. Create Agent. This opens the form for a new AI Agent.
Dashboard > Chatbot Manager > Bots/Accounts > AI > Agents > Create Agent (markers 1 to 6).

Dashboard > Chatbot Manager > Bots/Accounts > AI > Agents > Create Agent (markers 1 to 6).

3

Create the First Agent (Customer Support Agent)

1

Fill In the Agent Details

On the Create Agent form, complete the fields as shown in the screenshot:

  • Name: customer support agent. The Slug is generated automatically from the name.
  • Status: Active.
  • Description: explain in one line what the agent does, for example: help customers about their product queries, and suggest products when they ask, based on your knowledge base.
Agent form showing the name, slug, status, description, and system prompt for the customer support agent.

Agent form showing the name, slug, status, description, and system prompt for the customer support agent.

2

Write the System Prompt

In System Prompt, tell the agent its role and how to work: what to answer, when to greet, what to check before replying, and which action to run in which situation. Before you write, click the i button beside System Prompt to see what each command does. Typing ## in the box also opens a pop-up with the available actions.

The prompt used for the customer support agent in this example:

You are the customer support agent of a mobile shop. You have to provide information about smartphones what are asked by the customers. Also, suggest products to them based on their interests such as budget, specifications etc. Before answering, you must cross check your reply with your knowledgebase data. If there is no data, don't give them vague or guessed answers. And, before answering for the first time you should greet them 'hi or hello'.

##add_label##: 455729 when relevant question is asked and a relevant conversation begins.

##save_custom_field##: 76551 when user's query is totally irrelevant and when needed to pin-point his/her product query, ##ask_information##

##follow_up##: 76551 when product is not available, tell the customer that, we will notify you when the product is available and ##add_note##: Customer wants a callback — save an internal inbox note (not sent to the customer)

##add_label##: 455729 when a customer is ready to purchase and proceed to begin the buying process ##transfer_agent##

The numbers after each action are the IDs of the label or custom field in this demo account. Yours will differ; select them from the ## pop-up.

Action in the PromptWhat It Does in This Agent
##add_label##Adds a label to the customer when a relevant conversation begins and when the customer is ready to buy.
##save_custom_field##Saves information from the chat into a custom field, here the customer's product query.
##follow_up##Sets up a follow-up when a requested product is not available.
##add_note##Saves an internal inbox note that is not sent to the customer, here "Customer wants a callback".
##transfer_agent##Hands the chat to another active AI agent, here the billing agent once the customer is ready to purchase.
4

Add a Knowledge Source

The system prompt controls behavior. The knowledge source supplies the facts the agent answers from. Because this agent supports a mobile shop, it needs the shop's data: which smartphones are available, the price of each, and their specifications.


1

Choose or Create a Knowledge Set

Scroll down to Knowledge Sources on the same form and follow the markers in the screenshot:

  1. Open the Knowledge Set drop-down and choose Create New. Choose Select Existing if you have already built a set you want to reuse.
  2. Name or select the knowledge set. In this example it is mobile shop_inventory.
  3. Choose Google Sheet as the content type.
Knowledge Sources: create a new set, name it, and attach a Google Sheet (markers 1 to 3).

Knowledge Sources: create a new set, name it, and attach a Google Sheet (markers 1 to 3).

2

Prepare the Google Sheet

Your sheet is the agent's source of truth, so keep it clean: one product per row along with a header in the first row. This example sheet has 50 rows covering smartphones and accessories, with these columns:

ColumnWhat It HoldsExample
IDA running number for each product23
BrandThe manufacturer or brandApple
CategoryProduct typeSmartphone
Product Model & VariantModel name with memory or storage variantApple iPhone 13 (128GB)
Approx. Market Price (BDT)Price or price range৳72,000 - ৳78,000
Warranty StatusWarranty type and durationOfficial (Apple BD)
Core Specs / Key HighlightsShort description of what the product offersGateway entry to premium iOS ecosystem, dual reliable cameras.
3

Attach the Google Sheet

BotSailor offers several ways to add knowledge: Content, URL, File, Media, Google Sheet, and API. This guide uses a Google Sheet that was prepared in advance and integrated with BotSailor. Select the integrated sheet and the tab that holds your product data. It then appears under Attached Knowledge, as in the highlighted area of the screenshot. If your sheet is not integrated yet, follow How to Integrate Google Sheet with BotSailor for Data Fetch Campaign first.

4

Save the Agent

Click Save Agent. Your first AI Agent is ready.

5

Create the Second Agent (Billing Agent)

Go back to Agents and click Create Agent again. Create the second agent the same way, with its own name, description, and prompt.

1

Fill In the Agent Details

  • Name: billing agent (slug: billing-agent).
  • Status: Active.
  • Description: help the customer complete the purchase and payment process.
Agent form for the billing agent with its description and system prompt.

Agent form for the billing agent with its description and system prompt.

2

Write the System Prompt

You are the billing agent. You will help customers to complete the purchase including billing process.

##save_custom_field##: 76551 ##ask_information##: In which process they want to complete the purchase - COD or in cash, their name, delivery address and email

##add_label##: 455729 after completing the purchase process, thank them and give a summary like an invoice mentioning their name, purchased model, amount, delivery date (delivery date will be the day after tomorrow) and order no.

##assign_human_role##: 76551 if the customer wants to talk with a human agent before buying, you must handover the chat to human agent and notify the customer and then if the user wants to change his / her decision and want to choose another smartphone ##transfer_agent## to choose the desired product.
Action in the PromptWhat It Does in This Agent
##save_custom_field##Saves the payment method, name, delivery address, and email that the agent asks the customer for.
##add_label##Adds a label after the purchase is completed, when the agent thanks the customer and sends the summary.
##assign_human_role##Hands the chat to a human team role if the customer wants to talk to a person before buying.
##transfer_agent##Sends the customer back to the customer support agent if they want to choose a different smartphone.

Click Save Agent. Both agents are now created, but neither is live yet.

6

Turn On AI and Select the Active Agents

1

Open AI Configuration

Go to Chatbot Manager > Bots/Accounts > select your bot > AI and open the AI Configuration tab (next to Agents).

2

Activate the Agents

  • Turn on the AI Agent switch.
  • In the Active Agents box, select the two agents you created: billing agent and customer support agent.
AI Configuration with AI Agent switched on and both agents selected under Active Agents.

AI Configuration with AI Agent switched on and both agents selected under Active Agents. The overview panel confirms 2 active agents.

Only agents selected here can take part in routing and agent-to-agent transfers.

7

Configure Agent Routing and Other AI Settings

1

Add Agent Routing Rules

Agent Routing decides which agent replies first, based on the customer's message. Click Add Rule, then fill in two fields:

  • Message type / when to use this agent: the keywords that signal the topic.
  • Assign agent: the agent that should handle that topic.
Message Type / When to Use This AgentAssign Agent
buy / CODbilling agent
productcustomer support agent

Add as many keywords as you need for each rule. Use the trash icon to remove a rule. After the first reply, agents can still pass the chat to each other through ##transfer_agent##.

Agent Routing rules, AI Response Mode, Context & Memory, Assignment, and Misc. Settings.

Agent Routing rules, AI Response Mode, Context & Memory, Assignment, and Misc. Settings.

2

Choose the AI Response Mode

Keep AI Agent for All Queries switched on so the AI responds to every incoming message. AI as a Fallback Only is switched off in this example. In that mode, bot flows and keywords run first and the AI answers only when nothing matches.

3

Set Context & Memory

Turn on Enable Contextual Memory so the agents remember earlier messages, and use the drop-down to choose the Memory Window. This example uses 20 conversations. A larger window results in higher AI token consumption, so raise or lower it as needed.

4

Configure Assignment

Turn on Assign to Team or Department, select a Team / Department (a required field), and write the Assignment Message the customer sees when a chat is handed to your team. Example: "Your conversation has been assigned to our team. We will get back to you shortly."

5

Review Misc. Settings and Save

Under Misc. Settings, Do Not Assign Agent in Business Off Hour and Enable Typing Indicator are optional switches; both are off in this example. Scroll down and click Save Settings. The AI Assistant Overview panel on the right then summarizes your Response Mode, Contextual Memory, Restricted Topics, and AI Reasoning Level.

✓

Verification: Test the AI Agents on WhatsApp

Message the Bot From Another Number

From a different WhatsApp number, send a message to the WhatsApp number that has the AI Agent automation. Ask about a product, then say you want to buy it, and watch how each agent responds.

Review the Output

The conversation below shows the two agents working together.

Bikroy Shop
Hi, do you have iPhone?4:57 PM✓✓
Yes, we have several iPhone models in stock:
  1. Apple iPhone 13 (128GB) - ৳72,000 - ৳78,000
  2. Apple iPhone 15 (128GB) - ৳95,000 - ৳1,02,000
  3. Apple iPhone 16 (128GB) - ৳1,10,000 - ৳1,20,000
  4. Apple iPhone 16 Pro Max (256GB) - ৳1,75,000 - ৳1,92,000
All come with Official Apple BD warranty. Which one would you like to know more about?4:57 PM
I wanna buy iPhone 135:03 PM✓✓
Great choice! The Apple iPhone 13 (128GB) is priced between ৳72,000 and ৳78,000 with Official Apple BD warranty. It's a great gateway to the premium iOS ecosystem with dual reliable cameras.
Before proceeding, could you please confirm your budget for this purchase?5:03 PM
Yeah, budget is no problem5:04 PM✓✓
Great! The Apple iPhone 13 (128GB) is priced between ৳72,000 and ৳78,000 with Official Apple BD warranty.
To proceed with your purchase, please confirm your payment method: Cash on Delivery (COD) or Card?5:04 PM
Today
Cod9:58 AM✓✓
Perfect. Since you selected Cash on Delivery, we need your shipping address. Please provide your full delivery address.9:58 AM
112, terokhadia, rajshahi9:59 AM✓✓
Thank you! I have your delivery address: 112, terokhadia, rajshahi
Now I need your full name for the order. Could you please provide it?9:59 AM
Abir9:59 AM✓✓
Thank you, Abir! I need your email address to complete the order. Could you please provide it?9:59 AM
Abiralmahafuz@gmail9:59 AM✓✓
Before I complete your order, could you please confirm the final amount you'd like to proceed with? The iPhone 13 (128GB) is priced between 72,000 and 78,000 BDT. Which price would you like to lock in?10:00 AM
7200010:00 AM✓✓
Thanks, Abir!
Let me confirm your order details:
  • Product: Apple iPhone 13 (128GB)
  • Amount: 72,000 BDT
  • Payment method: Cash on Delivery (COD)
  • Full name: Abir
  • Email: Abiralmahafuz@gmail
  • Delivery address: 112, terokhadia, rajshahi
Could you confirm if these details are correct so I can proceed with placing your order?10:00 AM
Yes10:00 AM✓✓
Thank you for your purchase, Abir! Your order has been placed successfully. We appreciate your business and your iPhone 13 will be delivered soon.10:00 AM
Message

The customer support agent answers the iPhone question from the Google Sheet. Once the customer wants to buy, the billing agent collects the payment method, address, name, and email, confirms the price and the details, and sends the order summary. The name, address, and email in this test are sample data.

To confirm it, you may open the shared inbox of BotSailor and check the chat history. You will find how the agents were switched.

Shared inbox conversation showing the agent handoff.

You can also open Subscriber Manager to confirm that the expected labels and custom-field values were saved for the test subscriber.

!

Common Troubleshooting

The AI Agent does not reply at all

Creating an agent does not activate it. Open AI Configuration, make sure the AI Agent switch is on, and confirm both agents appear under Active Agents. Click Save Settings afterward.

The wrong agent answers, or routing does not match

Review Agent Routing. Keep each rule's keywords distinct so two agents do not compete for the same message, and use the words your customers actually type.

The agent gives no product information or wrong prices

Confirm the Google Sheet is attached under Knowledge Sources, that the correct tab is selected, and that the sheet has column headers and current data. If the knowledge source and the system prompt disagree, the system prompt takes priority.

The agent forgets details the customer already gave

Turn on Enable Contextual Memory and increase the Memory Window. A larger window uses more AI tokens.

Next Steps: Add More Agents and Live Data

Once the two agents work, you can add more specialists (for example, a lead qualification or order agent), restrict topics the AI should not discuss, and set business hours for human handoff. To use live inventory and prices instead of a sheet, see How to Connect Shopify with BotSailor AI Agent Using HTTP API for Live Inventory & Pricing. For a fuller picture of multi-agent setups, read Part 01 and Part 02 of the Multi-Agent AI guide.

Zihad Jony

Zihad Jony

Team
FAQ

Frequently Asked Questions

Find answers to common questions about this topic

Go to Chatbot Manager > Bots/Accounts, select your bot, open AI > Agents, and click Create Agent. Add a name, description, and system prompt, attach a knowledge source if needed, and click Save Agent. Then enable the agent in AI Configuration.

The system prompt uses actions such as adding a label and saving a custom field. If those resources do not exist, data cannot be saved and the agent may not work properly.

Yes. Integrate the Google Sheet with BotSailor, then attach it under Knowledge Sources when you create the agent. Knowledge sources also include content, URLs, files, media, and APIs.

Agent Routing rules match keywords in the customer’s message to an agent. After that, agents can pass the chat to another active agent with the transfer action when the topic changes.

The system prompt defines the agent’s role, behavior, and actions. The knowledge source supplies business facts such as products, prices, and policies. If they conflict, the system prompt takes priority.

Use the assign-to-human action in the prompt and turn on Assign to Team or Department in AI Configuration, with a team selected and an assignment message. Human assignment can follow your configured business hours, while AI agents can keep replying.