# Send WhatsApp messages from n8n, Zapier or Make

> Send an approved WhatsApp template when a row is added to a sheet, a form is sent or an order comes in, with the HTTP step of n8n, Zapier or Make, and start a workflow when a customer replies.

In this guide you connect app2email to the automation tool you already use. When something happens in another app (a new row in Google Sheets, a form submission, a new order), the workflow sends the customer an approved WhatsApp template with their own values in it.

**What the customer sees:** a WhatsApp message from your business a few seconds after the event: "Hi John, your order #1234 has shipped."

**What you see:** the run in n8n, Zapier or Make, the message in the app2email Activity Log and in the conversation, and its status (sent, delivered, read, or failed with a reason) as webhook events. When the customer answers, a second workflow can start from that answer.

No code is needed. Every tool has a step that sends an HTTP request, and that step is all you need: one `POST` to `https://api.app2email.com/v1/YOUR_NUMBER/messages` with your key in the `X-API-KEY` header and a JSON body. The cURL, Node.js and Python versions are here too, so you can try the exact request once before you build the step.

## How it works

1. The trigger fires in your tool: a new row, a form answer, an order.
2. The HTTP step sends `POST /messages` with `"type": "template"`, the customer's number in `to`, and the trigger's fields as the template's values.
3. app2email checks the template, the values, the number and your limits, and WhatsApp accepts the message. The answer comes back to the step at once.
4. app2email sends `message.status` events as the message is sent, delivered and read. A second workflow, started by a webhook trigger, can pick up these events and the customer's reply (`message.received`).

## What you need

- **A WhatsApp number connected to app2email**, on a paid plan and live. Without a plan every call answers 403 `plan_not_allowed`; a paused service answers 403 `service_not_live`. See [Getting started](https://www.app2email.com/docs/onboarding).
- **An approved template.** Workflows usually write first, often days after the customer last wrote to you, so a free-form text would be refused with 422 `outside_24h_window`. A template can be sent at any time. This guide uses `order_update`, a UTILITY template with the text `Hi {{1}}, your order {{2}} has shipped.` See [Send order and appointment notifications](/guides/how-to-order-notifications) to create and approve one.
- **An API key** from [the API key page](https://www.app2email.com/dashboard/apikey). Make one key for each tool, and name it after the tool: the name shows in the request log and in `GET /me`.

| Scope | Why the workflow needs it |
| --- | --- |
| `messages:send` | Send the template (`POST /messages`) |
| `messages:read` | See which templates you have and what values they need (`GET /templates`), follow one message (`GET /messages/{message_id}`) |
| `webhooks:manage` | Only for the reply trigger: register its URL once (`POST /webhooks`). You can also add the webhook on the API key page under Webhooks, without a key |

The key goes in the header `X-API-KEY: YOUR_API_KEY`. `Authorization: Bearer YOUR_API_KEY` works the same; use the one your tool makes easier.

<Tip>
**Try it before you go live.** Two kinds of test key send nothing to WhatsApp, so a workflow can be built and run as often as you like:

- **A sandbox key on your own number:** tick **Sandbox key** when you make a key on the API key page. Every check runs for real against your account (templates, values, numbers, Do Not Call list, limits), the answer has `"sandbox": true`, message ids start with `wamid.SANDBOX.`, and the `message.status` events sent, delivered and read still arrive at your webhook. Swap in a normal key when the workflow works.
- **The instant sandbox, with no account:** `POST https://api.app2email.com/v1/account/sandbox` (no key, no body), or the `create_sandbox` tool of the Management MCP server, answers a key (`a2es_...`, valid 7 days) for the demo number `12025550100`. It has the `order_update` template and pretend customers: `12025550101` answers, `12025550103` fails, `12025550104` opts out. It writes only to them, and it has no webhooks (use `GET /events` there).

Details: [Sandbox](/api/sandbox) and [Send your first WhatsApp message in 5 minutes](/guides/how-to-first-message-sandbox).
</Tip>

## Ready-made connectors

app2email's reference lists these connectors next to the plain HTTP request:

| Tool | What the reference names | What it has |
| --- | --- | --- |
| n8n | the community node `n8n-nodes-app2email` | actions and triggers (webhook events) |
| Zapier | the Zapier app `app2email` | |
| Make | the OpenAPI description, `https://api.app2email.com/v1/openapi.json` (no key needed) | every call, with its fields |
| Power Automate | a custom connector from the Swagger 2.0 description | |

<Note>
Check that a connector is listed in your tool (or, for the n8n node, in the npm registry) before you plan around it. This guide uses the HTTP step every one of these tools has. It needs nothing installed, and it sends exactly the request the API reference documents, so every field in [the reference](/api/overview) works in it.
</Note>

## Send a template from your workflow

<Steps>
  <Step title="Check your key">
    `GET /me` works with any valid key, whatever its scopes. Use it as the "test connection" step of your tool. In every request, `YOUR_NUMBER` is the WhatsApp number you send from: country code first, digits only (the instant sandbox: `12025550100`).

    <CodeGroup>

    ```bash cURL
    curl https://api.app2email.com/v1/YOUR_NUMBER/me \
      -H "X-API-KEY: YOUR_API_KEY"
    ```

    ```javascript Node.js
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/me", {
      headers: { "X-API-KEY": process.env.API_KEY },
    });
    console.log(await res.json());
    ```

    ```python Python
    import os, requests

    res = requests.get("https://api.app2email.com/v1/YOUR_NUMBER/me",
                       headers={"X-API-KEY": os.environ["API_KEY"]}, timeout=10)
    print(res.json())
    ```

    </CodeGroup>

    **What you get back:**

    ```json
    {
      "success": true,
      "request_id": "a7k3p",
      "key_valid": true,
      "api_version": "v1",
      "number": "4976659348270",
      "plan": "standard_5000",
      "service_status": "LIVE",
      "key": { "name": "Zapier", "scopes": ["messages:read", "messages:send"], "ip_allow": "" },
      "limits": { "max_numbers_per_request": 1000, "requests_per_second": 20, "burst": 50, "rate_limit_mode": "enforce", "webhooks_max": 5 }
    }
    ```

    `service_status` must be `LIVE`, and `key.scopes` must list `messages:send` (or `*` for full access). A sandbox key also shows `"sandbox": true`.
  </Step>
  <Step title="See what the template needs">
    `GET /templates` (scope `messages:read`) lists every template of your WhatsApp account with its `status`, `can_send`, what values it `needs`, and, for an approved template, a complete `example_request`. That `example_request` is the body your HTTP step sends: copy it and replace the sample values with the trigger's fields.

    ```bash
    curl https://api.app2email.com/v1/YOUR_NUMBER/templates \
      -H "X-API-KEY: YOUR_API_KEY"
    ```

    **What you get back** (shortened to one template):

    ```json
    {
      "success": true,
      "request_id": "t5pl2",
      "from": "4976659348270",
      "send_url": "https://api.app2email.com/v1/4976659348270/messages",
      "templates": [
        {
          "name": "order_update",
          "language": "en",
          "category": "UTILITY",
          "status": "APPROVED",
          "can_send": true,
          "example_request": {
            "to": "61412345678",
            "type": "template",
            "template": {
              "name": "order_update",
              "language": { "code": "en" },
              "components": [
                { "type": "body", "parameters": [
                  { "type": "text", "text": "John" },
                  { "type": "text", "text": "#1234" }
                ] }
              ]
            }
          }
        }
      ]
    }
    ```

    The values go in the order of the placeholders: the first `parameters` entry fills `{{1}}`, the second fills `{{2}}`. `language.code` must match exactly (`en` and `en_US` are different languages).
  </Step>
  <Step title="Send the request once from a terminal">
    Before you build the step, send the exact request once, so you know the body is right. With the instant sandbox key, put `12025550100` in the URL and `12025550101` in `to`. Add `"dry_run": true` to check everything with a live key and send nothing: the answer has `status` `dry_run`, and nothing is sent, logged or counted.

    <CodeGroup>

    ```bash cURL
    curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/messages \
      -H "X-API-KEY: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: order-1234" \
      -d '{
        "to": "61412345678",
        "type": "template",
        "template": {
          "name": "order_update",
          "language": { "code": "en" },
          "components": [
            { "type": "body", "parameters": [
              { "type": "text", "text": "John" },
              { "type": "text", "text": "#1234" }
            ] }
          ]
        },
        "callback_data": "order-1234"
      }'
    ```

    ```javascript Node.js
    const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/messages", {
      method: "POST",
      headers: {
        "X-API-KEY": process.env.API_KEY,
        "Content-Type": "application/json",
        "Idempotency-Key": "order-1234",
      },
      body: JSON.stringify({
        to: "61412345678",
        type: "template",
        template: {
          name: "order_update",
          language: { code: "en" },
          components: [
            { type: "body", parameters: [{ type: "text", text: "John" }, { type: "text", text: "#1234" }] },
          ],
        },
        callback_data: "order-1234",
      }),
    });
    console.log(res.status, await res.json());
    ```

    ```python Python
    import os, requests

    res = requests.post(
        "https://api.app2email.com/v1/YOUR_NUMBER/messages",
        headers={"X-API-KEY": os.environ["API_KEY"], "Idempotency-Key": "order-1234"},
        json={
            "to": "61412345678",
            "type": "template",
            "template": {
                "name": "order_update",
                "language": {"code": "en"},
                "components": [
                    {"type": "body", "parameters": [{"type": "text", "text": "John"}, {"type": "text", "text": "#1234"}]}
                ],
            },
            "callback_data": "order-1234",
        },
        timeout=30,
    )
    print(res.status_code, res.json())
    ```

    </CodeGroup>

    **What you get back** (HTTP 200):

    ```json
    {
      "success": true,
      "request_id": "kxrkf",
      "message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
      "status": "accepted",
      "from": "4976659348270",
      "to": "61412345678",
      "template": { "name": "order_update", "language": "en", "category": "UTILITY" },
      "text": "Hi John, your order #1234 has shipped.",
      "conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_...",
      "note": "accepted by WhatsApp. delivery and read status appear in your app2email Activity Log (WhatsApp sent).",
      "contacts": [{ "input": "61412345678", "wa_id": "61412345678" }]
    }
    ```

    `accepted` means WhatsApp took the message; `text` is the message as the customer sees it. A sandbox key adds `"sandbox": true`, and its `message_id` starts with `wamid.SANDBOX.`. `callback_data` (your own value, up to 512 characters) comes back in every `message.status` event of this message, so a later step can find the row or order it belongs to.

    The same request again with the same `Idempotency-Key` within 24 hours sends nothing: it gets this answer again, with the header `Idempotent-Replayed: true`.
  </Step>
  <Step title="Build the HTTP step in your tool">
    Add the trigger first (for example a new row in Google Sheets with the columns **Name**, **Phone** and **Order**), run it once so the tool has a sample row, then add the HTTP step from the tab of your tool below. The body is the request from the step before, with the sample values replaced by the trigger's fields.
  </Step>
  <Step title="Test with the sandbox key, then switch keys">
    Run the workflow once with a sandbox key. For the instant sandbox, put `12025550101` in the sheet's Phone column and `12025550100` in the URL. The step's output is the answer above, with `"sandbox": true`. When it works, change the key (and the number in the URL) to your live key. Nothing else changes.
  </Step>
</Steps>

## The HTTP step, tool by tool

The three tabs send the same request. Field names in the tools' editors can differ a little between versions.

<Tabs>
  <Tab title="n8n">

Add an **HTTP Request** node after the trigger.

| Setting | Value |
| --- | --- |
| Method | `POST` |
| URL | `https://api.app2email.com/v1/YOUR_NUMBER/messages` |
| Authentication | Generic Credential Type, then Header Auth. In the new credential: Name `X-API-KEY`, Value your API key. n8n keeps it encrypted with its credentials |
| Send Headers | On. Name `Idempotency-Key`, Value `{{ "order-" + $json.Order }}` |
| Send Body | On. Body Content Type: JSON. Specify Body: Using JSON |
| JSON | The body below, as an expression |

```json n8n: JSON
{
  "to": {{ JSON.stringify(String($json.Phone)) }},
  "type": "template",
  "template": {
    "name": "order_update",
    "language": { "code": "en" },
    "components": [
      {
        "type": "body",
        "parameters": [
          { "type": "text", "text": {{ JSON.stringify(String($json.Name)) }} },
          { "type": "text", "text": {{ JSON.stringify(String($json.Order)) }} }
        ]
      }
    ]
  },
  "callback_data": {{ JSON.stringify("order-" + $json.Order) }}
}
```

`JSON.stringify(String(...))` writes each value with its quotes and escapes, so a name with a `"` in it, or an order number the sheet stores as a number, still makes valid JSON. Change `$json.Phone`, `$json.Name` and `$json.Order` to your trigger's field names; for a form or a shop trigger they are whatever its sample output shows.

Run the node once: its output is the answer of `POST /messages`. A 4xx or 5xx answer makes the node fail and shows the answer's `error.code` and `how_to_fix`. In the node's settings, **Retry On Fail** is safe with the `Idempotency-Key`: a retry never sends the message twice.

  </Tab>
  <Tab title="Zapier">

Add an action step: **Webhooks by Zapier**, event **Custom Request** (check that your Zapier plan includes Webhooks by Zapier).

| Setting | Value |
| --- | --- |
| Method | `POST` |
| URL | `https://api.app2email.com/v1/YOUR_NUMBER/messages` |
| Data | The body below |
| Headers | `X-API-KEY`: your API key. `Content-Type`: `application/json`. `Idempotency-Key`: `order-` followed by the Order field |

```json Zapier: Data
{
  "to": "PHONE",
  "type": "template",
  "template": {
    "name": "order_update",
    "language": { "code": "en" },
    "components": [
      { "type": "body", "parameters": [
        { "type": "text", "text": "NAME" },
        { "type": "text", "text": "ORDER" }
      ] }
    ]
  },
  "callback_data": "order-ORDER"
}
```

Replace `PHONE`, `NAME` and `ORDER` with the trigger's fields: delete the word and insert the field from the list, so it shows as a field, inside the quotes. A value with a double quote or a line break in it breaks the JSON (400 `invalid_json`): clean such a field with a Formatter step first.

Test the step: Zapier shows the answer of `POST /messages`. Anyone who can edit the Zap can read the header, so give this key `messages:send` only.

  </Tab>
  <Tab title="Make">

Add the module **HTTP**, **Make a request**.

| Setting | Value |
| --- | --- |
| URL | `https://api.app2email.com/v1/YOUR_NUMBER/messages` |
| Method | `POST` |
| Headers | `X-API-KEY`: your API key. `Idempotency-Key`: `order-` followed by the mapped Order item |
| Body type | Raw |
| Content type | JSON (application/json) |
| Request content | The body below |
| Parse response | Yes, so later modules can map `message_id` and `status` |

```json Make: Request content
{
  "to": "PHONE",
  "type": "template",
  "template": {
    "name": "order_update",
    "language": { "code": "en" },
    "components": [
      { "type": "body", "parameters": [
        { "type": "text", "text": "NAME" },
        { "type": "text", "text": "ORDER" }
      ] }
    ]
  },
  "callback_data": "order-ORDER"
}
```

Replace `PHONE`, `NAME` and `ORDER` with items mapped from the trigger module, inside the quotes. When a value can contain quotes or line breaks, build the body with the **JSON**, **Create JSON** module and map its output into Request content instead.

Run the module once: the output bundle is the answer of `POST /messages`. With "Evaluate all states as errors" on, a 4xx or 5xx answer stops the run and shows the answer's `error.code` and `how_to_fix`. A retry with the same `Idempotency-Key` never sends the message twice.

  </Tab>
</Tabs>

<Info>
**Power Automate** works the same way: the reference names a custom connector made from the Swagger 2.0 description; or send the same URL, headers and body from an HTTP action.
</Info>

## Fill the template from the trigger

Each placeholder of the template gets one value from the trigger:

| Template part | Request field | From a sheet row | From a form | From an order |
| --- | --- | --- | --- | --- |
| Who gets it | `to` | the Phone column | the phone field | the customer's phone |
| `{{1}}` | first `parameters` entry of the `body` | the Name column | the name field | the customer's first name |
| `{{2}}` | second `parameters` entry of the `body` | the Order column | the reference you give the form | the order number |
| No doubles | `Idempotency-Key` header | sheet name and row, or the Order column | the form answer's own id | the order id |
| Find it again | `callback_data` | the row | the answer's id | the order id |

Rules that save a failed run:

- **The number needs its country code.** `to` takes digits; spaces, `+` and `-` are removed for you, so `+61 412 345 678` works. A local number without its country code (`0412 345 678`) reaches the wrong person or nobody: ask for the country code in the form, or add it in a formatter step. An empty phone field answers 400 `invalid_to`.
- **One value per placeholder, none empty.** Too few or too many values answer 422 `template_parameters_invalid`, with the problems in `error.details.problems` and a correct `example_request`. Give an optional field a default (for example "there" for a missing name).
- **Named placeholders.** A template made with named placeholders (`{{first_name}}`) takes `"parameter_name": "first_name"` next to each value; `example_request` shows which kind yours has.
- **A picture or a PDF in the header.** A template with a media header takes a `header` component with a `link` to the file: `{"type": "header", "parameters": [{"type": "image", "image": {"link": "https://example.com/photo.jpg"}}]}`. Leave it out to send the template's own sample image.
- **A link button with a value.** A URL button with a placeholder takes a `button` component: `{"type": "button", "sub_type": "url", "index": "0", "parameters": [{"type": "text", "text": "1234"}]}`.

## Start a workflow when a customer replies

The second half: when the customer answers ("Can I pick it up instead?"), app2email sends the event `message.received` to a URL. Each tool has a trigger that gives you such a URL.

<Tabs>
  <Tab title="n8n">

Start a new workflow with a **Webhook** node.

| Setting | Value |
| --- | --- |
| HTTP Method | `POST` |
| Path | for example `app2email` |
| Respond | Immediately |

Copy the **Production URL**; it answers only while the workflow is active. The event arrives as `$json.body`, so the fields are `$json.body.type`, `$json.body.data.from`, `$json.body.data.name` and `$json.body.data.text`, and your custom header (below) is in `$json.headers` (in lower case). Add an **If** node: `{{ $json.body.type }}` is equal to `message.received`, and `{{ $json.body.test }}` is not `true`.

  </Tab>
  <Tab title="Zapier">

Start a new Zap with **Webhooks by Zapier**, event **Catch Hook**, and copy its URL. After a test event (below), the fields show with their path: Type, Data From, Data Name, Data Text. Add a **Filter by Zapier** step: Type, (Text) Exactly matches, `message.received`. To check the custom header (below), use **Catch Raw Hook** instead, which also gives the request's headers.

  </Tab>
  <Tab title="Make">

Start a new scenario with **Webhooks**, **Custom webhook**. Add a webhook, copy its address, and leave the module waiting to determine the data structure; then send a test event (below). Turn on "Get request headers" in its advanced settings to check the custom header. Add a filter after it: `type` Equal to `message.received`. The fields are `data.from`, `data.name` and `data.text`.

  </Tab>
</Tabs>

Then tell app2email the URL: on [the API key page](https://www.app2email.com/dashboard/apikey) under Webhooks (no code), or with `POST /webhooks` (scope `webhooks:manage`). `headers` adds up to 5 custom headers to every event: a long random value of your own lets the workflow drop requests that do not come from app2email.

<CodeGroup>

```bash cURL
curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/webhooks \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://hooks.example.com/app2email", "headers": {"X-Webhook-Token": "a-long-random-value"}}'
```

```javascript Node.js
const res = await fetch("https://api.app2email.com/v1/YOUR_NUMBER/webhooks", {
  method: "POST",
  headers: { "X-API-KEY": process.env.API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://hooks.example.com/app2email", headers: { "X-Webhook-Token": "a-long-random-value" } }),
});
const { webhook } = await res.json();
console.log(webhook.id, webhook.secret);
```

```python Python
import os, requests

res = requests.post("https://api.app2email.com/v1/YOUR_NUMBER/webhooks",
                    headers={"X-API-KEY": os.environ["API_KEY"]},
                    json={"url": "https://hooks.example.com/app2email",
                          "headers": {"X-Webhook-Token": "a-long-random-value"}}, timeout=10)
webhook = res.json()["webhook"]
print(webhook["id"], webhook["secret"])
```

</CodeGroup>

Put the URL your tool gave you in `url`. **What you get back** (201 Created, shortened):

```json
{
  "success": true,
  "request_id": "w8hk2",
  "webhook": {
    "id": "wh_a1b2c3d4e5f6g7h8",
    "url": "https://hooks.example.com/app2email",
    "secret": "whsec_...",
    "created": "2026-11-21T09:00:00.000Z",
    "active": true,
    "format": "app2email"
  }
}
```

Now send a test event, while the trigger waits for one: `POST /webhooks/{id}/test` with `{"type": "message.received"}`, or the test button under Webhooks on the API key page. Up to 30 tests an hour per number.

```bash
curl -X POST https://api.app2email.com/v1/YOUR_NUMBER/webhooks/wh_a1b2c3d4e5f6g7h8/test \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type": "message.received"}'
```

This is what the trigger receives (a text message; a test event also has `"test": true` and the header `X-App2email-Test: true`):

```json
{
  "id": "evt_Xq3k9m2Lw8Rt5Yp1Zs01",
  "type": "message.received",
  "created": "2026-11-06T01:00:00.000Z",
  "number": "4976659348270",
  "data": {
    "message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
    "from": "61412345678",
    "name": "Sample Contact",
    "type": "text",
    "text": "Hi, is my order on its way?",
    "conversation_url": "https://www.app2email.com/conversation/61412345678_4976659348270_SAMPLEk3XbQ9rTzP2mW",
    "timestamp": "2026-11-06T01:00:00.000Z",
    "from_user_id": "AU.1234567890123456"
  }
}
```

- `type` says which event it is. **Every webhook gets every event**, including a `message.status` for each message you send, so filter by `type` first. In Zapier and Make every run can count against your plan's tasks or operations.
- `id` (also the header `X-App2email-Delivery`) is the same when the event is sent again: it is what you dedupe by.
- `data.from` is the customer's number. A customer who uses a WhatsApp username may come with `from_user_id` and no number; that id works in `to` wherever a number does.
- `data.type` is `text`, `image`, `button` (a template's quick reply button, with `button.payload`) and more.

**Answer the customer from the workflow.** For 24 hours after the customer's message you can reply with free text: the same HTTP step, with this body and `data.from` mapped into `to`. After that, only a template.

```json
{
  "to": "61412345678",
  "type": "text",
  "text": { "body": "Yes, you can pick it up from 2 pm at our shop." }
}
```

## What happens on WhatsApp

1. A new row arrives in the sheet, the workflow runs, and the HTTP step's answer says `accepted`.
2. The customer gets "Hi John, your order #1234 has shipped." from your business. You see it in the Activity Log and the conversation.
3. Your webhook gets `message.status` for the message: `sent`, then `delivered`, then `read`. With a sandbox key these arrive within seconds too.

```json
{
  "id": "evt_Xq3k9m2Lw8Rt5Yp1Zs02",
  "type": "message.status",
  "created": "2026-11-06T01:00:03.000Z",
  "number": "4976659348270",
  "data": {
    "message_id": "wamid.HBgLNjE0MTIzNDU2NzgVAgARGBJTQU1QTEVfVEVTVF9FVkVOVAA=",
    "to": "61412345678",
    "status": "delivered",
    "timestamp": "2026-11-06T01:00:03.000Z",
    "sent_by": "api",
    "whatsapp_status": "delivered",
    "pricing": { "billable": true, "pricing_model": "PMP", "type": "regular", "category": "utility" },
    "callback_data": "order-1234"
  }
}
```

A message that could not be delivered comes as `message.status` with `status: "failed"` and an `error` object (`code` is Meta's code, `error_code` app2email's, with `how_to_fix`), and also as `message.failed`. A workflow can write that back to the row it found by `callback_data`. Without a webhook, `GET /messages/{message_id}` (scope `messages:read`) gives a message's status.

## Production checklist

<Check>
**Send each message once.** Give every send an `Idempotency-Key` built from the trigger's own id (the order id, the form answer's id, the sheet and row). Tools run a step again (a retry, a replayed run, a trigger that fires twice): the same request with the same key within 24 hours sends nothing and gets the first answer, with `Idempotent-Replayed: true`. Same key, other body: 422 `idempotency_key_reused`. 409 `idempotency_request_in_progress`: wait and retry with the same key. A request refused before anything was sent leaves the key free, so a fixed request can reuse it.
</Check>

<Check>
**Use a template outside the 24 hour window.** Free-form messages (`"type": "text"`) work only within 24 hours of the customer's last message (app2email stops 15 minutes early); anything else answers 422 `outside_24h_window`. A workflow started by another app almost always needs a template. Keep order and appointment updates in a UTILITY template with no offers in it.
</Check>

<Check>
**Marketing needs consent.** Marketing templates are not sent to numbers on your Do Not Call list (403 `recipient_opted_out`), and when the number's opt-in rule is on, only to contacts with an opt-in record (403 `recipient_not_opted_in`). Utility templates still go out. A customer who stops promotions sends `contact.opted_out`. See [Send a marketing broadcast that respects opt-ins](/guides/how-to-marketing-broadcast).
</Check>

<Check>
**Respect the limits.** Every answer has `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` and `X-RateLimit-Policy`; `GET /me` shows your key's `limits`. A sheet import of 500 rows starts 500 runs at once: over the limit you get 429 `rate_limited` with a `Retry-After` header. Wait that long and retry with the same `Idempotency-Key`, or send one list in one call (`to` with several numbers, or `recipients` with each number's own values). WhatsApp's own limits (429 `whatsapp_rate_limit`, `too_many_messages_to_recipient`) need minutes, not seconds.
</Check>

<Check>
**Put a cap on the key.** A key can have a daily cap (429 `daily_cap_reached` after it) and an approval gate: a send to more contacts than its limit answers 202 with `status: "pending_approval"` and waits until a person approves it on the dashboard. A tool shows the 202 as a success, so check `status`. A cap stops a looping workflow from using up the month. 429 `monthly_limit_reached` means the plan's messages are used up; the `usage.threshold` event warns at 80% and 100%.
</Check>

<Check>
**Keep the key small and private.** One key per tool, with `messages:send` only (add `messages:read` and `webhooks:manage` only where you need them). Anyone who can edit the workflow can read a key typed into a header; n8n's credentials keep it apart. Revoke a key on the API key page when a tool is no longer used.
</Check>

<Check>
**Trust only real events.** The trigger URL is public. Add a custom header with a long random value (`headers` on the webhook) and filter on it, or, where your tool can compute an HMAC-SHA256 over the raw body (n8n can, with the Webhook node's Raw Body option), check `X-App2email-Signature` as described in [Webhooks](/api/webhooks). Drop test events (`"test": true`) in production.
</Check>

<Check>
**Dedupe and answer fast.** An event that was not answered with a 2xx within 10 seconds is sent again (after 10 s, 1 min, 5 min ... for about 32 hours), with the same `id`. Let the trigger answer at once (all three do by default), and skip ids you have handled, for example in a table or a data store. Events can arrive out of order: use `data.timestamp`.
</Check>

<Check>
**Keep the webhook on.** After 20 events in a row that were not delivered within their first 4 tries (over at least 24 hours), app2email switches the webhook off. That happens when a workflow is turned off or deleted and its URL stops answering. `GET /webhooks` shows `active`; `PATCH /webhooks/{id}` with `{"active": true}` turns it on again.
</Check>

## If it does not work

| What you see | Why | Fix |
| --- | --- | --- |
| 401 `missing_api_key` | No key reached the API | Check the header name `X-API-KEY` (or `Authorization: Bearer ...`) and that the step sends it |
| 401 `invalid_authorization_header` | The Authorization header is not `Bearer` and the key | Send `Bearer ` followed by the whole key, or use `X-API-KEY` |
| 401 `invalid_api_key`, `api_key_revoked`, `api_key_expired` | A wrong key, a replaced one, or an expired one (an instant sandbox key lasts 7 days) | Use a key listed on the API key page, or get a new instant key |
| 403 `api_key_number_mismatch` | The key belongs to another number than the one in the URL | Put the key's own number in the URL. The instant sandbox key works only with `12025550100` |
| 400 `invalid_number_in_url` | The number in the URL has `+`, spaces or dashes | Digits only, country code first |
| 403 `insufficient_scope` | The key lacks a permission (`details.required_scope`) | Make a key with `messages:send` (and `webhooks:manage` to register the trigger URL) |
| 403 `plan_not_allowed`, `service_not_live` | No paid plan, or the service is paused | Choose a plan; a paused service goes live with "Go Live" on the Settings page |
| 415 `unsupported_content_type` | The body was sent as a form, not JSON | Send `Content-Type: application/json` (Zapier: in Headers; Make: content type JSON; n8n: Body Content Type JSON) |
| 400 `invalid_json` | The body is not valid JSON, often from a mapped value with a `"` or a line break | n8n: `JSON.stringify(...)`; Zapier: a Formatter step; Make: the Create JSON module |
| 400 `invalid_to` | The phone field was empty or not a number | Filter out rows without a phone; check the field mapping |
| 404 `template_not_found`, `template_language_not_found` | The template name or language does not match | Copy both from `GET /templates`; names are lower case, `en` and `en_US` differ |
| 422 `template_not_approved` | The template is pending, rejected, paused or disabled | Wait for approval, or pick one with status APPROVED |
| 422 `template_parameters_invalid` | Too few or too many values, or an empty one | Compare with `example_request` in the error; give optional fields a default |
| 422 `outside_24h_window` | A free-form text to a customer who has not written in 24 hours | Send an approved template |
| 403 `recipient_opted_out`, `recipient_not_opted_in` | A marketing template to a number on the Do Not Call list, or without an opt-in record | Do not send marketing to them; utility templates still work |
| 422 `recipient_unreachable` | WhatsApp could not deliver to this number | Check the number has its country code and uses WhatsApp |
| 403 `whatsapp_payment_issue` | Meta could not charge your WhatsApp account | Fix the payment method in Meta's WhatsApp Manager |
| 422 `sandbox_recipient` | The instant sandbox writes only to its pretend customers | Use `12025550101` to `12025550105` in the Phone column |
| 403 `not_in_instant_sandbox` | The demo number does not have this call (webhooks, for one) | Use a sandbox key on your own number for the reply trigger |
| 422 `idempotency_key_reused` | The same key with a different body, often a key built from a column that repeats | Build the key from something unique per message |
| 429 `rate_limited` | Too many calls at once for this key | Wait `Retry-After` seconds, then retry with the same `Idempotency-Key` |
| 429 `daily_cap_reached`, `monthly_limit_reached` | The key's daily cap, or the plan's messages for the month | Wait (`retry_after_seconds`), raise the cap, or change the plan |
| 202 with `status: "pending_approval"` | Not an error: the key's approval gate holds the send | A person approves it on the dashboard (`approval.url`) |
| 422 `invalid_webhook_url` | The trigger URL is not a public https address | Copy the production URL of the trigger, with https |
| 429 `too_many_tests` | More than 30 test events in an hour | Wait, or send a real message to your number from your phone |
| The reply trigger gets nothing | The webhook is off, the workflow is not active, or the URL changed | `GET /webhooks` shows `active` and the last delivery; `PATCH` the new `url` or `{"active": true}` |

Every answer has a `request_id`. `GET /requests/{id}` (scope `messages:read`) shows what was logged for it, with the name of the key that sent it, and support@app2email.com can find it too. All codes: [Errors](/api/errors).

## FAQ

<AccordionGroup>
  <Accordion title="Can I send to a whole sheet at once instead of one run per row?">
    Yes. One `POST /messages` takes a list: `to` with several numbers (the same values for each), or `recipients` with each number's own `components`. It is recorded as a broadcast with a report page, up to your number's broadcast limit (`max_numbers_per_request` in `GET /me`, up to 1000). Add `"background": true` for a big list, because some tools stop waiting after about 30 seconds. See [Send a marketing broadcast that respects opt-ins](/guides/how-to-marketing-broadcast).
  </Accordion>
  <Accordion title="Can I check a run without sending anything?">
    Yes, two ways. `"dry_run": true` in the body checks everything for real (template, values, numbers, Do Not Call list, monthly limit) and sends nothing, logs nothing and counts nothing; the answer's `status` is `dry_run`. A sandbox key goes one step further: the send is simulated and the `message.status` events still arrive, so the reply workflow can be tested too.
  </Accordion>
  <Accordion title="My tool cannot receive webhooks. Can it fetch the events instead?">
    Yes: `GET /events?wait=25` (scope `messages:read`) answers the same events a webhook gets, with the same `id`. Call it from a scheduled trigger with `types=message.received`, keep the answer's `cursor`, and pass it as `after` on the next call; skip ids you have handled. The first call switches the number's feed on, and events are kept 72 hours.
  </Accordion>
  <Accordion title="Do I need this for Shopify or WooCommerce orders?">
    Not always. app2email connects a Shopify or WooCommerce store directly (Integrations, Store messages on the dashboard) and sends order confirmed, shipped, delivered, cash-on-delivery and abandoned checkout messages without a workflow. Use n8n, Zapier or Make when you want your own message or your own rules.
  </Accordion>
  <Accordion title="Can I schedule the message for later?">
    Yes: add `"send_at"` with a time zone (`"2026-11-02T09:00:00+11:00"`, 1 minute to 29 days ahead) to a template send. The answer is HTTP 202 with `status: "scheduled"` and a broadcast code; `POST /broadcasts/{code}/cancel` cancels it.
  </Accordion>
  <Accordion title="What does each message cost?">
    Each template counts as one message of your app2email plan. Meta bills you directly for templates, per message, by category. `GET /usage` shows what is used and left this month, with Meta's categories in `meta_pricing`.
  </Accordion>
</AccordionGroup>

## More how-to guides

<CardGroup cols={2}>
  <Card title="Send your first WhatsApp message in 5 minutes" href="/guides/how-to-first-message-sandbox">
    An instant sandbox key, a first template, its status and the reply.
  </Card>
  <Card title="Send order and appointment notifications" href="/guides/how-to-order-notifications">
    Create a utility template, get it approved, and follow every message.
  </Card>
  <Card title="Send a marketing broadcast that respects opt-ins" href="/guides/how-to-marketing-broadcast">
    Import contacts, record opt-ins and send a broadcast with results per number.
  </Card>
  <Card title="Import contacts and keep them in sync with your CRM" href="/guides/how-to-contacts-crm-sync">
    Contacts, tags, custom fields and consent from your own system.
  </Card>
</CardGroup>

[All how-to guides](https://www.app2email.com/docs#how-to)
