# Set up what happens when a message comes in

> A message workflow starts with Message received. Filter by channel, endpoint, keywords or contact, then add an Agent step, an email or a text.

Source: https://useline.io/help/workflows/message-workflows  
Section: Workflows  
Last updated: 2026-11-05  
Roles: Owner, Admin

A message workflow starts with the **Message received** trigger. It runs for SMS, WhatsApp, Web Chat and email. Every message is in the Inbox before any workflow runs, so a person can always answer it.

## Before you start

- You need the **Owner** or **Admin** role.

## How message workflows run

1. A message comes in. Line saves it in the Inbox.
2. Line runs every enabled message workflow whose trigger matches, oldest first.
3. The first workflow that reaches a reply sends the reply. Other workflows still run their other steps, such as an email.
4. If no custom workflow replies, the default message workflow for that number, widget or inbox runs last.

Each number, widget and inbox has a default message workflow. At first it has only a trigger, so messages wait in the Inbox. You can edit it, publish it or remove it.

## Choose which messages start the workflow

Select the **Message received** trigger. It has two parts.

**Messages**

- **Channel**: select **SMS**, **WhatsApp**, **Web Chat** or **Email**.
- **Sent to**: select the numbers, widgets or inboxes.

Both must match. A level with nothing selected shows **Any**. With no Channel, no Sent to and no filters, the workflow runs for every message.

**Filters**

1. Select **Add filter**.
2. Select **Keywords** or **Contact**.
3. For **Keywords**, select **Contains** or **Does not contain**, then type the words, for example "quote, price".
4. For **Contact**, select **Known** or **Unknown**.

Filters in a group join with **And** or **Or**. Select **Add filter group** to add another group.

## Steps for messages

| Step | What it does |
|------|--------------|
| **Agent** | Your agent replies. In **Mode**, select **Act** to send or **Draft** to save the reply for a person. |
| **Time Rule** | Splits the path into **Open hours** and **Outside hours**. |
| **Team Availability** | Splits the path by how many team members are available. |
| **Send an Email** | Emails a verified address with the message details. |
| **Send an SMS** | Texts a number, such as the sender. You must select the **From** number. |
| **Send WhatsApp** | Sends a WhatsApp reply or an approved template. The trigger must be limited to WhatsApp. |

A message workflow does not need a final step. When a path ends without a reply, the message waits in the Inbox for a person. A **Time Rule** or **Team Availability** step still needs a step on both branches.

## Make your agent reply to messages

1. Make sure that the agent has **Messages** or **Email** turned on, and that it is published.
2. Open the message workflow for the number, widget or inbox. You can use the default message workflow.
3. Add an **Agent** step.
4. In **Agent**, select the agent.
5. In **Mode**, select **Act** or **Draft**.
6. Select **Publish**.

## Web Chat without an agent

If no workflow on a Web Chat widget has an **Agent** step, the widget tells the visitor that the team will follow up. The chat waits in the Inbox.

## Common problems

**Two workflows match, but only one reply goes.** This is correct. The first workflow that reaches a reply sends it. Use filters so that each workflow matches different messages.

**A Send WhatsApp step shows an issue.** Set **Channel** in the trigger to **WhatsApp** only.

**An automatic email does not start the workflow.** Line does not run workflows for automated email, such as out-of-office replies. This stops email loops.

## Related articles

- [How workflows decide what happens to calls and messages](https://useline.io/help/workflows/how-workflows-work.md): Workflows alone decide what happens. A call runs one workflow for its number. A message runs every matching workflow, then the default.
- [Build and publish a workflow](https://useline.io/help/workflows/build-a-workflow.md): In Workflows, select New workflow, choose a template, set the trigger and steps, fix every issue, then select Publish.
- [Choose if your agent sends replies or drafts them](https://useline.io/help/ai-agents/agent-modes.md): The Agent step in a workflow has a mode. Act sends replies. Draft saves each reply for a person to approve. Calls run only in Act.
- [Add the Web Chat widget to your website](https://useline.io/help/messaging/web-chat.md): Add a widget in Channels > Web Chat, copy the script from Install, and paste it once before the closing body tag of your website.
