# 25 · Bots and AI inside a chat: start or stop a workflow, hand a chat between the AI and your team, and what the AI remembers

**Purpose:** see in one conversation whether a workflow, the AI agent or your team is answering, start a workflow for one customer, take a chat over and give it back, and check or correct what the AI remembers about the customer.

## Before you start

- Workflows need a plan with workflows, and at least one workflow that is switched on (published). Building and publishing one is in [04 · Chatbot and workflows](https://wsapme.com/guides/chatbot-workflows.md).
- The AI parts need a plan with the AI agent, and an AI agent that is switched on for the WhatsApp number of the chat (see [05 · AI agent and knowledge](https://wsapme.com/guides/ai-agent-and-knowledge.md)). Without that, the **AI** button and the **Conversation memory** card are not shown.
- Bots and the AI work in one-to-one chats only, never in groups. A workflow also needs the chat's WhatsApp number to still be connected.
- **Start workflow** is for owners and admins. Anyone on the team who can see the chat can stop a workflow, take the chat from the AI and hand it back.

> In this guide nothing was sent, started, stopped, paused or saved. The demo workspace has real connected numbers, its AI agent is off and none of its workflows is switched on, so the workflow list, the workflow bar, the **AI** button and the **Conversation memory** card were shown with a made-up state that the browser answered by itself (the workflows "Demo: Senarai harga kek" and "Demo: Tempahan kek hari jadi", a customer note and a chat summary). The screens are the real ones; the names and texts in them are invented, and that is why they are not blurred while the rest of the chat is. Demo mode was on.

**Watch first (3:59, Malay narration):** [Bots and AI inside a chat](https://wsapme.com/guide-media/video/25-bots-and-ai-inside-a-chat-malay.mp4). Starting a workflow from a chat, the workflow bar and Stop, the AI button with What the AI remembers, taking a chat from the AI and handing it back, and the Conversation memory card with its history; shown with a made-up state, so nothing is started, paused or sent.

## Part 1 · One chat, one owner

At any moment one of three answers a customer:

| Who | When | How you see it in the chat |
|---|---|---|
| A **workflow** (the bot) | It was started by its trigger, or by hand from the chat (Part 2) | A violet bar above the messages: "… is handling this chat" (Part 3) |
| The **AI agent** | It is switched on for this number and nothing else is handling the chat | The **AI** button at the top of the chat (Part 4) |
| **Your team** | Someone replied, took the chat from the AI, or a workflow handed it over | The **Team** button with **Hand back to AI** next to it (Part 5) |

They take turns by themselves:

- While a workflow runs, the AI agent waits. In the AI menu this shows as "A workflow is handling this chat". When the workflow ends, the AI may answer again.
- When someone on the team replies, from the inbox or from the phone itself, a running workflow stops at once and the AI agent steps back.
- A workflow that its trigger would start does not start while your team is handling the chat (for example after a team reply or a handover). Starting one by hand (Part 2) still works.

## Part 2 · Start a workflow from a chat

1. In the sidebar, click **Inbox** and open the conversation.
2. Click the small arrow next to **Close** (**More status options**), then **Start workflow**. You can also press **Ctrl K** and choose **Start a workflow**.

   ![The menu next to Close with Start workflow](https://wsapme.com/guide-media/img/25-bots-and-ai-inside-a-chat/01-start-workflow-menu.webp)

3. The window **Start a workflow** says "The bot takes over this chat until it ends, or until someone on the team replies." Click **Choose a workflow**.
4. Simple sequences are listed under **Sequences**, flows built on the canvas under **Workflows**. A workflow whose trigger is **Started by hand** is marked **(manual)**: this is the only way it starts. Only workflows that are switched on are listed. If none is, the window says "No workflow is switched on. Create one on the Workflows page."

   ![Start a workflow with the list open: Sequences and Workflows](https://wsapme.com/guide-media/img/25-bots-and-ai-inside-a-chat/02-start-workflow-dialog.webp)

5. Pick one and click **Start**. *(Start was not clicked in this guide; the rest of this step is from the documentation, not captured.)* A message "… started." appears and the workflow bar shows above the chat. The workflow's first steps run straight away, so a first message can reach the customer at once.

**Start workflow** is not offered while a workflow is already running in the chat. If two people start one at the same moment, the second sees "A workflow is already running in this chat."

## Part 3 · The workflow bar: see and stop a running workflow

1. While a workflow runs in the chat, a violet bar sits above the messages: the workflow's name, "is handling this chat", and what it is doing now, for example **waiting for the customer to answer**, **waiting until** a date and time (a Wait step), or the kind of step it is on (**Question**, **Menu**, **Sending a message**, **Checking a condition**, **Handing to the team** and so on). On a wide screen it ends with "· replying stops it".

   ![The workflow bar with Stop](https://wsapme.com/guide-media/img/25-bots-and-ai-inside-a-chat/03-workflow-bar.webp)

2. To take over, simply reply. Any message from the team (in the inbox, or typed on the phone) stops the workflow; it counts as handed to the team.
3. To stop it without replying, click **Stop** on the bar. The message "Workflow stopped. The chat is with your team." appears and the bar goes away. *(In this guide the Stop was answered by the browser; no workflow was running.)*

After **Stop** the workflow is ended, not paused: to run it again, start it again (Part 2). If the AI agent answers this number, it can answer the customer again after a **Stop**, because nothing on the team has replied yet. Reply, or take the chat from the AI (Part 5), if you want it to stay quiet.

What the bot leaves in the chat *(from the documentation, not captured: no workflow has run in the demo workspace)*:

- Messages the workflow sends show the label **Bot** under the bubble, where your own replies show your name, **Phone** or **AI**.
- With **Add notes to the inbox when the bot decides** ticked in the workflow's trigger settings (it is on unless you untick it), the bot writes short internal notes that only your team sees, starting with "Bot - " and the workflow name. They explain a **Detect intent** decision (which intent, and how sure it was, or why it took the other way), a jump to another workflow, and a follow-up or workflow started because the customer did not reply in time.

## Part 4 · The AI button: who is answering

When the AI agent is switched on for the chat's number, an **AI** button sits at the top of the chat, next to the assign button.

1. Click **AI**. The menu starts with **The AI agent is answering** and "It steps back when someone in your team replies, then takes over again after the time set in AI agent settings."

   ![The AI menu: The AI agent is answering, What the AI remembers, Edit memory, Forget this customer and Stop the AI for this chat](https://wsapme.com/guide-media/img/25-bots-and-ai-inside-a-chat/04-ai-agent-answering.webp)

2. When the AI is not answering, the button reads **Team** instead, and its menu says **Your team is answering** with the reason and when the AI comes back:

   | Reason in the menu | Why the AI stopped |
   |---|---|
   | **Your team replied** | Someone on the team answered the customer. |
   | **Customer asked for a person** | The customer wrote one of your handoff keywords. |
   | **AI handed over** | The AI could not answer from your knowledge and passed the chat on. |
   | **Daily AI reply limit reached** | The daily limit of AI replies was used up. |
   | **Paused by your team** | Someone clicked **Stop the AI for this chat** (Part 5). |
   | **24-hour window closed (official number)** | On an official number the customer has not written for 24 hours, so a free reply is not allowed. |
   | **A workflow is handling this chat** | A workflow is running (Part 3). |

   After the reason it shows "AI resumes" and a date and time, or "AI stays off until you resume it" when it was stopped by hand. The time comes from **Resume AI after** in the AI agent settings ([guide 36](https://wsapme.com/guides/ai-agent-settings-reference.md), Part 7).
3. **AI agent settings** at the bottom of the menu opens the agent's settings.

When the AI agent does not answer a chat but **Tag and summarize conversations** is ticked (AI Agent → Settings → **Inbox**), the button shows what the customer wants instead (for example a price enquiry or an order), and clicking it shows the mood and a one-line summary. The AI writes this about 10 minutes after the chat goes quiet; each reading uses credits like an AI reply.

## Part 5 · Take a chat from the AI and hand it back

1. Click **AI**, then **Stop the AI for this chat**. The button changes to **Team** and **Hand back to AI** appears next to it. The AI stays quiet in this chat until you hand it back; it keeps answering every other chat.

   ![Your team is answering, with Hand back to AI](https://wsapme.com/guide-media/img/25-bots-and-ai-inside-a-chat/05-your-team-answering.webp)

2. Answer the customer yourself.
3. When you are done, click **Hand back to AI** (the button, or the same item in the **Team** menu). If the customer is still waiting for an answer, the AI replies to that message straight away.

You do not have to stop the AI before you reply: a reply from the team makes it step back by itself, and it comes back after the **Resume AI after** time. Use **Stop the AI for this chat** when you want it to stay out of the chat for longer. *(In this guide both buttons were answered by the browser; the AI was not paused.)*

## Part 6 · What the AI remembers about a customer

With **Remember customers** switched on ([guide 36](https://wsapme.com/guides/ai-agent-settings-reference.md), Part 7), the AI keeps a short note about each customer that it uses in later chats, also on other numbers and channels: a preferred name, usual items, delivery area, past issues, language. It never keeps health details (allergies included), religion, race, political views, IC or passport numbers, payment or bank details or passwords; lines like that are dropped, and long numbers are replaced with "[number removed]".

1. Click **AI**. Under **What the AI remembers** you see the note.
2. To correct it, click **Edit memory** (or **Add memory** when there is no note yet). Your browser opens a small box "What the AI remembers about this customer (preferences only):". Change the text and click **OK**. The note can be up to 1,500 characters, and the same rules apply: sensitive lines are removed when you save.
3. To delete it, click **Forget this customer** and confirm "Forget everything the AI remembers about this customer?". Saving an empty note in **Edit memory** does the same.

*Edit memory and Forget this customer were not used in this guide; steps 2 and 3 are from the documentation, not captured.*

The note goes with the contact: it is included when you export the contact's data, it is erased when the contact is erased, and when two contacts are merged their notes are joined.

## Part 7 · The Conversation memory card

The AI agent reads only the last 20 messages of a chat. With **Conversation memory** switched on (Part 8), each chat gets a short summary and key facts, and the agent reads them before every reply. Your team sees them in the contact panel.

1. Open the conversation and the contact details on the right (the **Show contact details** button at the top of the chat, if the panel is hidden).
2. Scroll down to **Conversation memory**. It shows the summary, then the facts it found: **Name**, **Location**, **Need**, **Interested in**, **Hesitations**, **Budget**, **Preferred time**, **Stage** (New, Interested, Ready to buy, Booked or ordered, Not interested, After sale), **Language** and **Deal stage**. A fact marked "· records" was taken from your own records (a contact field or the lead), not guessed from the chat.

   ![The Conversation memory card in the contact panel](https://wsapme.com/guide-media/img/25-bots-and-ai-inside-a-chat/06-conversation-memory.webp)

3. Under it: "Updated … · version …", and "Used by the AI agent before it replies, and available to your workflows and follow-ups."
4. The memory updates itself when the chat has gone quiet after at least 6 new messages, or when a chat gets busy. To update it now, click **Refresh**. Each update uses AI credits (the button's tooltip shows how many); if nothing new was said you see "Nothing new to remember yet." *(Refresh was not clicked in this guide.)*
5. Click **History** to open **Memory history**: "Every update is kept as a new version (the last 10). Nothing is overwritten." Each version shows its summary and facts, and why it was made (**First reading**, **Chat went quiet**, **Busy chat** or **Refreshed by a team member**), how many messages it read and the credits it used. The time span it covered is hidden while Demo mode is on.

   ![Memory history with three versions](https://wsapme.com/guide-media/img/25-bots-and-ai-inside-a-chat/07-memory-history.webp)

Before the first update the card says "Nothing remembered yet. The AI writes it after about 6 messages once the chat goes quiet, or press Refresh." If Conversation memory is switched off later, the card keeps the last memory and says "Conversation memory is off, so the AI agent no longer reads this." with a link **Turn it on in AI settings**.

Workflows and follow-ups can use the memory in their messages: `{{memory_name}}`, `{{memory_location}}`, `{{memory_need}}`, `{{memory_stage}}` and `{{memory_summary}}`. They are empty when unknown, so add a fallback, for example `{{memory_name|there}}`.

## Part 8 · Where these are switched on

All in **AI Agent → Settings**, then **Save settings** (owners and admins). *Shown in the video, nothing changed.*

- **Inbox** section: **Conversation memory: remember earlier messages (summary + key facts)** (off until you turn it on) and **Tag and summarize conversations**.
- **Handing over to your team** section: **Handoff keywords**, **Message when handing over**, **Leave the team a note when handing over**, **Remember customers** (on unless you untick it) and **Resume AI after** (10 minutes to 7 days).
- In each workflow's trigger settings: **Add notes to the inbox when the bot decides**.

More on these settings in [05 · AI agent and knowledge](https://wsapme.com/guides/ai-agent-and-knowledge.md) and [16 · AI agent: selling and quality](https://wsapme.com/guides/ai-agent-selling-and-quality.md).

## Common problems

| Problem | What to do |
|---|---|
| **Start workflow** is not in the menu | You need to be an owner or admin, and the plan must include workflows. It is also hidden while a workflow already runs in the chat, in group chats, and in chats whose WhatsApp number was removed. |
| The list says "No workflow is switched on" | Publish the workflow first (see [04 · Chatbot and workflows](https://wsapme.com/guides/chatbot-workflows.md)). Drafts are not listed. |
| "A workflow is already running in this chat." | Someone or a trigger started one first. Wait for it to end, or click **Stop** on the bar. |
| A workflow stopped in the middle | Someone on the team replied, from the inbox or from the phone. That ends the run on purpose. Start it again if needed. |
| A workflow's trigger did not start it for this customer | The team is handling the chat (a team reply or a handover paused the AI). Start it by hand, or hand the chat back to the AI first. |
| There is no **AI** button | The AI agent is off, or not switched on for this chat's number, or the chat is a group. |
| The AI answered again after I clicked **Stop** on a workflow | Stopping a workflow gives the chat back to the AI agent. Click **AI → Stop the AI for this chat**, or reply. |
| The AI does not come back after a team reply | It waits for **Resume AI after**. Click **Hand back to AI** to bring it back now. |
| The **Conversation memory** card is missing | Tick **Conversation memory** in AI Agent → Settings → Inbox. The card is not shown in group chats. |
| A line I typed in **Edit memory** disappeared | It mentioned something the AI may not keep (health, religion, ID, bank details and so on), so it was removed. |

## Related

- [02 · Team inbox](https://wsapme.com/guides/team-inbox.md)
- [04 · Chatbot and workflows](https://wsapme.com/guides/chatbot-workflows.md)
- [05 · AI agent and knowledge](https://wsapme.com/guides/ai-agent-and-knowledge.md)
- [10 · Test your chatbot](https://wsapme.com/guides/testing-chatbots.md)
- [16 · AI agent: selling and quality](https://wsapme.com/guides/ai-agent-selling-and-quality.md)
