# Chat rules

> Create no-code rules that escalate a chat to your team, resolve it or send a notification when a customer says a keyword or the AI is unsure of its answer.

A chat rule is one trigger and one action: when a chat matches the trigger, AskVault does the action. Use rules to hand frustrated customers to your team, catch weak answers before the customer notices, or alert you when a topic comes up.

Rules are checked after every answer the AI writes, and no extra AI call is made to check them. Back to [Automation](/automation/).

## Before you start

- Decide the one situation you want to catch, and what should happen.
- To escalate, turn on live chat and [set up your team in the Inbox](/inbox/). A handed-off chat needs someone to take it.
- To notify by webhook, add a webhook endpoint first. See [webhooks](/developers/webhooks/).

## Steps

#### New dashboard

1. Open **Automation** in the sidebar, then the **Rules** tab.
2. Select to create a rule.
3. Enter a **Rule name**, such as "Escalate refund requests".
4. Under **When**, choose a trigger and fill in its details.
5. Under **Then**, choose an action. For a notification, choose **webhook** or **email**.
6. Add an optional reason or note that your agent will see, then select **Save rule**.

#### Previous dashboard

1. Open **Automation** › **Rules** (under **Advanced**). The page is headed **Inbox triggers**.
2. Select to create a rule.
3. Enter a **Rule name**, such as "Escalate refund requests".
4. Under **When**, choose a trigger and fill in its details.
5. Under **Then**, choose an action. For a notification, choose **webhook** or **email**.
6. Add an optional reason or note that your agent will see, then select **Save rule**.

## Triggers

| Trigger | Fires when | You set |
| --- | --- | --- |
| **Customer says specific keyword(s)** | The customer's message contains any of your keywords. | Keywords, separated by commas |
| **Bot confidence drops below threshold** | The AI's confidence in its last answer is below your number. | A number from 0 to 1 |

The list also shows **Conversation idle for N minutes**, which acts on a chat that has had no new message for that long. [Act when a chat goes quiet](/automation/when-a-chat-goes-quiet/) explains it, and the badge on that page shows when you can rely on it.

Each rule has one trigger. There is no separate conditions step.

## Actions

| Action | What it does |
| --- | --- |
| **Escalate to human agent (live chat)** | Hands the chat to your team in the Inbox. When someone can take it, the AI pauses and the visitor sees that a person is joining. |
| **Auto-resolve conversation** | Marks the conversation resolved. |
| **Send notification (webhook/email)** | Delivers an Automation Rule Notification through the channel you pick. |

## Recipes

- **Escalate frustrated customers.** Trigger: keyword match on `cancel, refund now, talk to manager`. Action: escalate.
- **Catch weak answers.** Trigger: confidence below 0.4. Action: escalate. Your team sees the chat before the customer gives up.
- **Alert on refund talk.** Trigger: keyword match on `refund, money back, chargeback`. Action: send notification by webhook to the endpoint your team watches.

## How rules interact

Every enabled rule is checked independently on every answer. There is no priority order, so one answer can fire more than one rule, for example a keyword match that is also a low-confidence reply. Rules do not react to each other.

## Check it worked

Send a test message that matches your trigger from your widget. The conversation should be escalated, resolved or notified as your rule says. There is no dry-run simulator, so test with a real message.

## If it doesn't work

**The rule never fires.** Check that it is enabled and that the keyword spelling matches what customers type. Keywords match the text of the customer's message.

**The chat escalated but nobody got it.** Nobody could take the chat, or live chat is off for that channel. The conversation is still marked escalated and the AI keeps answering.

**The webhook is silent.** Your endpoint must be subscribed to the Automation Rule Notification event. Check it under **Settings** › **Webhooks**.

## Related

- [Assign and claim conversations](/inbox/assignment/)
- [Hand a chat to a person](/actions/hand-off-to-a-person/)
- [Webhooks](/developers/webhooks/)
- [Chat rules by channel, with a message](/automation/rules-by-channel/)
- [Act when a chat goes quiet](/automation/when-a-chat-goes-quiet/)

Source: https://docs.askvault.co/automation/chat-rules/
