# Chat Trigger

> Give a workflow a chat page people can talk to: a hosted link you share, or an endpoint your own widget posts to.

The **Chat Trigger** turns a workflow into something people can hold a conversation with. Every message they send starts a run, and whatever the last step produces comes back as the reply.

Two ways to use it. **Hosted Chat** gives you a ready-made chat page on a link you share. **Embedded Chat** gives you a URL to POST to from your own widget, so the conversation lives inside your product.

## Setting it up

### Add the trigger

Open **Tools** in the dock and choose **Chat Trigger** under **Start**.

### Pick a mode

**Hosted Chat** is the quickest way to something usable: Glow hosts the page, you share the link. Choose **Embedded Chat** when you already have a chat interface and only want the workflow behind it.

### Decide who may talk to it

**Authentication** defaults to **None**, which means anyone holding the link can chat. **Glow User Auth** admits only members of the team that owns the workflow.

### Build the reply

Add the steps that decide what to say. An [AI Prompt](/build/ai-features/ai-prompt) reading `{{ N.chatInput }}` is the usual starting point, where `N` is the Chat Trigger's step number.

### Try it before anyone else does

The step's **Chat** tab holds a conversation with your own workflow. Ask it something and watch the reply come back, using a sample message it provides if you would rather not type one.

### Go live

The chat URL appears once the workflow is **Live**. In Draft the panel shows a **Go live** button instead of a link.

## What it passes on

| Reference             | What it holds                                              |
| --------------------- | ---------------------------------------------------------- |
| `{{ N.chatInput }}`   | The message the visitor just sent                          |
| `{{ N.sessionId }}`   | Identifies one visitor's conversation across messages      |
| `{{ N.metadata }}`    | Anything your own widget sent alongside the message        |
| `{{ N.historyText }}` | The recent conversation as text, ready to drop in a prompt |

`historyText` is the one that makes a chat feel like a conversation rather than a series of unrelated questions. Put it in an AI step's instructions and the model can see what was already said.

## Giving it a memory

**Conversation memory (messages)** sets how many earlier messages of the same `sessionId` are handed to the workflow as history. Set it to 0 and every message is answered on its own, with no idea what came before.

A longer memory makes for better answers and a longer prompt. Start small and raise it if the model keeps losing the thread.

## Keeping the cost predictable

Every message runs the workflow and spends your team's credits, so an open link is a running cost as well as an open door.

**Messages per visitor per minute** caps how fast one person can send. A per-visitor rate limit is always applied when Authentication is **None**, and this setting is how you tighten it. For an internal tool, **Glow User Auth** is the stronger control: only your team can start a run at all.

## Making the page your own

Four settings shape the hosted page:

| Setting               | What it does                                                                                                          |
| --------------------- | --------------------------------------------------------------------------------------------------------------------- |
| **Chat title**        | The heading at the top of the page                                                                                    |
| **Welcome message**   | Shown before the visitor types. Display-only: it never reaches the workflow                                           |
| **Input placeholder** | The grey text in the message box                                                                                      |
| **Response mode**     | **When Last Step Finishes** holds the request open until the workflow completes, then returns the final step's output |

## Running Workflows from Slack

Beyond hosted chat links, team members can interact with workflows directly inside Slack channels:

1. **Natural Language Triggering:** Mention the Glow Slack Bot or Workflow Assistant with instructions (e.g. `@Glow summarize the latest Q3 pipeline leads`).
2. **Intent Matching:** The assistant matches the request to live published workflows in your workspace.
3. **Parameter Injection:** Key arguments mentioned in the message or thread (e.g., deal names, dates, or assignee emails) are parsed and mapped to the initial trigger fields.
4. **Execution & Reply:** The workflow runs in the background and posts the formatted output back into the Slack thread.

## Examples to copy

### A support bot over your own documentation

Chat Trigger → AI Prompt. In the instructions:

```text
Answer the question using our product documentation.

Conversation so far:
{{ 1.historyText }}

Question: {{ 1.chatInput }}
```

Set **Conversation memory** to 10 so follow-up questions like "and what about the Pro plan?" still make sense.

### An internal assistant, restricted to your team

Set **Authentication** to **Glow User Auth** and share the link internally. Only members of the workflow's team can open it, and no rate limit is needed for an audience you trust.

### A chat window inside your own product

Set **Mode** to **Embedded Chat** and POST each message as JSON to the URL from your widget. Put the message itself in a field (a key in the JSON body) called `chatInput`: it is the only field the endpoint requires. Send the same `sessionId` with every message from one visitor so their conversation continues; leave it out and each message starts fresh. Add a `metadata` object for your own fields, such as a customer id or the page they are on, and read them in the workflow as `{{ 1.metadata }}`.

## What's Next?

- [AI Prompt](/build/ai-features/ai-prompt): the step that usually writes the reply.
- [Webhook Triggers](/build/triggers/webhook): for starting a workflow from a system rather than a person.
- [Variable Syntax](/reference/variable-syntax): the full reference for `{{ }}`.
