> Every page of the Heythere docs is listed in https://heythere.io/docs/llms.txt: fetch it to find a page instead of guessing its URL.

# Automations: automate replies on your WhatsApp number

> Decide what your WhatsApp number does when a customer writes. Your agent drafts the steps, you review them in the console, an administrator publishes.

When Camille writes to her repair shop's WhatsApp number, the shop's automation asks her name, checks whether her bike is ready, and hands her to the team when she asks for a person.

An automation is a graph that messages a [contact](https://heythere.io/docs/concepts/contacts) and reacts to their replies. Each WhatsApp number the workspace connects has one. The shop's manager describes what they want to their agent, the agent writes the graph, and the manager reviews it in the console, beside its number, before anything reaches a customer.

## What makes a graph?

- **[Triggers](https://heythere.io/docs/concepts/triggers)** are its entry points: `message.received` starts a run when a contact writes to the automation's number, at the step it leads to.
- **[Steps](https://heythere.io/docs/concepts/steps)** send messages, ask questions, use [AI](https://heythere.io/docs/concepts/ai), wait, and write values.
- **Transitions** lead from a trigger or a step to the next step. Each reply button or list row has its own.

Every trigger and step has an ID its author chooses, such as `ask_name`, unique within the graph. A graph has at most 20 triggers and 100 steps, and no transition leads back to an earlier step.

## How does an automation reach contacts?

1. Connecting a number gives it an empty automation, whose draft a member or their agent writes.
2. They save the draft as a [version](https://heythere.io/docs/concepts/versions), with a message saying what changed.
3. An administrator publishes that version.
4. A contact who writes to that number starts a [run](https://heythere.io/docs/concepts/runs): one contact going through that version.

## How does an agent write a draft?

`replaceAutomationDraft` writes the whole draft at once, in the shape `getAutomation` returns. Read the draft before replacing it, since a member may have changed it meanwhile, and build it over a few replacements, so a watching member sees it take shape.

Saving refuses a draft that breaks a drafting rule, such as a step no trigger reaches. A saved draft may still hold what publishing would refuse, listed as `draftProblems`, which the console page shows on their nodes. Its `templatePreviews` hold what a contact reads of each [template](https://heythere.io/docs/concepts/message-templates) a `send_template` step sends.

## How does an automation answer in several languages?

An automation that lists its `languages`, such as `["en", "fr"]`, answers each [contact](https://heythere.io/docs/concepts/contacts) in their `language` when it offers it, and in its first language otherwise. Each text a contact reads is then either one text for every language, such as a link, or one per language, such as `{ "en": "Hi!", "fr": "Bonjour !" }`. A `send_template` step names its template's language and variables once or per language. The steps, buttons, and transitions stay the same in every language. Publishing refuses a text missing one of the automation's languages.

Heythere does not guess a contact's language. A `classify` step that tells it from their first message, or a question that asks it, leads to a `set_value` step that sets `contact.language`, and the following steps answer in it. The console shows the texts in the language picked in the canvas corner.

## In the API

Every operation is a REST endpoint and, unless marked REST only, an MCP tool of the same name. [The OpenAPI document](https://app.heythere.io/api/openapi.json) describes their parameters, payloads, and errors.


- `getAutomation`: Get an automation. `GET /api/organizations/{organizationId}/workspaces/{workspaceId}/automations/{automationId}`
- `replaceAutomationDraft`: Replace an automation's draft. `PUT /api/organizations/{organizationId}/workspaces/{workspaceId}/automations/{automationId}/draft`
- `watchAutomation` (REST only): Watch an automation. `GET /api/organizations/{organizationId}/workspaces/{workspaceId}/automations/{automationId}/changes`
