> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sahut.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Automate Conversations with Sahut Rules and Chatbots

> Set up automation rules, auto-replies, and chatbot flows in Sahut to handle common questions and route conversations without manual effort.

Sahut's automation features let you handle repetitive tasks automatically — from sending instant first replies to routing conversations to the right team based on keywords. This frees your agents to focus on conversations that need a human touch.

## Automation rules

Automation rules trigger actions when certain conditions are met. For example: assign any WhatsApp conversation containing "harga" (price) to the Sales team.

### Create an automation rule

1. Go to **Settings → Automation**
2. Click **Buat Aturan** (Create Rule)
3. Set the **Trigger** — the event that starts the rule:
   * Conversation created
   * Conversation updated
   * Message created
4. Add **Conditions** — filters that must match for the rule to run:
   * Channel is \[WhatsApp / Email / etc.]
   * Message contains \[keyword]
   * Contact tag is \[tag name]
   * Assigned agent is \[agent]
5. Add **Actions** — what the rule does:
   * Assign to agent
   * Assign to team
   * Add label
   * Send message
   * Resolve conversation
6. Click **Simpan** (Save) and toggle the rule to **Active**

<Note>Rules run in order from top to bottom. Use the drag handle to reorder rules. When a conversation matches multiple rules, all matching rules execute unless you add a **Stop processing further rules** action.</Note>

### Common automation examples

**Auto-assign by channel**

* Trigger: Conversation created
* Condition: Channel is Instagram
* Action: Assign to team → Social Media Team

**Keyword-based routing**

* Trigger: Message created
* Condition: Message contains "komplain" OR "keluhan"
* Action: Add label → complaint; Assign to team → Support

**Away message outside business hours**

* Trigger: Conversation created
* Condition: Created outside business hours
* Action: Send message → "Terima kasih telah menghubungi kami. Kami akan membalas pada jam kerja berikutnya."

## Auto-replies (per channel)

Each channel can have its own auto-reply — a message sent automatically when a new conversation starts. This gives customers an instant acknowledgment while your team gets ready to respond.

To set a channel auto-reply:

1. Go to **Settings → Channels**
2. Click the channel you want to configure
3. Scroll to **Pesan Otomatis** (Auto Messages)
4. Toggle on **Auto Reply** and enter your message
5. Click **Simpan** (Save)

You can use placeholders in your auto-reply message:

| Placeholder           | Replaced with          |
| --------------------- | ---------------------- |
| `{{contact.name}}`    | Customer's name        |
| `{{agent.name}}`      | Assigned agent's name  |
| `{{conversation.id}}` | Conversation ID number |

## Canned responses

Canned responses are pre-written replies your agents can insert with a shortcut. They're not automatic — agents choose when to use them — but they speed up replies significantly.

### Create a canned response

1. Go to **Settings → Canned Responses**
2. Click **Tambah** (Add)
3. Enter a **Shortcut** (e.g., `jam-kerja`) and the **Content** (the full reply text)
4. Click **Simpan** (Save)

To use a canned response in the inbox, type `/` followed by the shortcut in the reply box and select from the dropdown.

## Chatbot integration (via API)

If you have a chatbot or AI assistant, you can connect it to Sahut via the API. The typical pattern:

1. Set up a webhook in Sahut (see [Webhooks API](/api/webhooks)) to receive all new messages
2. Your chatbot service receives the webhook event and generates a reply
3. Your service calls the [Messages API](/api/messages) to send the reply back through Sahut

This lets your chatbot handle conversations automatically until a customer asks to speak with a human agent, at which point your automation rules can assign the conversation to the right team.

<Tip>Use the **Assign to agent** action in an automation rule to hand off from bot to human. Set a keyword like "agen" or "manusia" as the trigger condition to detect when a customer wants a human.</Tip>
