# Chat ended

Starts a workflow when a website chat with your AI chatbot ends, with the visitor's details, the summary and the transcript.

Updated Oct 28, 2026. Source: https://smallbusinesschatbot.com/docs/workflows/triggers/chat-ended

## What this does

In Small Business Chatbot, this trigger starts a run in every published workflow that uses it, once for each website chat.

- **Label in the app:** Chat Widget Conversation Ended
- **Fires:** About a minute after the visitor closes the chat or leaves the page
- **Carries:** The fields below, as `{{trigger.…}}`
- **Settings:** None. Its window shows "No settings for this node yet."

## When it fires

- The visitor closes the chat window or leaves the page. The app then waits about a minute in case they come back, and starts the runs.
- If the same visitor still has the chat open in another tab, the runs start when the last tab closes. One chat starts one run per workflow.
- A chat in **Chat Widget › Playground** is a real chat and starts runs too.
- The owner's summary email for the chat goes out at the same point.

## What it carries

| Variable | Type | What it holds |
|---|---|---|
| `trigger.first_name` | text | The visitor's first name. Empty when not given. |
| `trigger.phone` | text | The phone number the visitor gave in the chat. Empty when not given. |
| `trigger.email` | text | The email the visitor gave. Empty when not given. |
| `trigger.action_items` | text | The chat summary: what the visitor wants and what to do next, written to you |
| `trigger.contact_information_collected` | true or false | `true` when the visitor gave a phone number or an email |
| `trigger.company_name` | text | Your company name as the chatbot has it |
| `trigger.chatbot_url` | text | The address of your chat assistant |
| `trigger.llm_model` | text | The AI model that answered |
| `trigger.conversation_history_id` | id | The saved conversation's id |
| `trigger.session_id` | id | The chat session's id |
| `trigger.conversation_type` | text | Always `Bot` |
| `trigger.date_created` | date and time | When the chat was summarised, as `2026-10-27 14:03:11` |
| `trigger.number_of_messages` | number | Messages in the chat, both sides |
| `trigger.messages` | list | The transcript. Each message has `role` (`user` for the visitor, `assistant` for the chatbot) and `content`. |
| `trigger.token_usage` | object | AI usage counts for the chat |
| `trigger.event_name` | text | Always `conversation_ended`. The same value is in `trigger.event_type` and `trigger.event.name`. |
| `trigger.event_source` | text | Always `chatbot_websocket_disconnect` |
| `trigger.public_config_id` | id | Your account's id. Also in `trigger.workspace.public_config_id`. |
| `trigger.contact.*` | object | The CRM contact linked to the chat. All fields are empty when there isn't one. The fields are listed in [Contact events](https://smallbusinesschatbot.com/docs/workflows/triggers/contact-events#contact-fields). |
| `trigger.summary.*` | object | `first_name`, `phone`, `email`, `action_items` and `contact_information_collected`, grouped |
| `trigger.chatbot.*` | object | `chatbot_url`, `company_name` and `llm_model`, grouped |
| `trigger.conversation.*` | object | `conversation_history_id`, `session_id`, `conversation_type`, `date_created`, `number_of_messages`, `messages` and `token_usage`, grouped |
| `trigger.conversation_record.*` | object | The conversation as saved, with its original field names, such as `First_Name` and `Action_Items` |

`trigger.conversation_record.Lead_Quality_Score` holds A, B, C or D when **Allow Lead Grading in the Summary?** is **Yes** under **Chat Widget › Look and Feel**.

> **Note:** `trigger.contact` is filled only when the chat is linked to a CRM contact. That needs **Save contacts** or **Log activity** on for **Chat widget** under **CRM › Contacts › Settings**, and a phone number or email from the visitor. **Stop workflows when contact replies** and **Only enrol each contact once** match runs by this contact. With **Only enrol each contact once** on, a chat with no contact is blocked and shows **Blocked due to re-enrol**.

## Example

A trimmed run:

```json trigger
{
  "first_name": "Dana",
  "phone": "416-555-0133",
  "email": "dana@example.com",
  "action_items": "Dana wants a quote for a new furnace. Call her back this week.",
  "contact_information_collected": true,
  "number_of_messages": 9,
  "messages": [
    { "role": "assistant", "content": "Hi, how can I help?" },
    { "role": "user", "content": "I need a quote for a new furnace." }
  ],
  "contact": { "contact_id": "c_1042", "first_name": "Dana", "phone": "+14165550133", "tags": [] }
}
```

## Used in

- [Your first workflow](https://smallbusinesschatbot.com/docs/user-guides/workflows/your-first-workflow): text and email the visitor after the chat.
- [Triggers](https://smallbusinesschatbot.com/docs/user-guides/workflows/triggers): how to pick this trigger.
- [HTTP request](https://smallbusinesschatbot.com/docs/integrations/automation/http-request): send the chat's details to another tool.
