# Send message

> Send a text reply on Instagram or Facebook, or a WhatsApp template.

Canonical: <https://www.tryadeli.com/docs/api/messages/send-message>

`POST https://app.tryadeli.com/api/v1/messages`

Authorization: `Bearer <API key>` — see [Authentication](https://www.tryadeli.com/docs/authentication)

**Body**

| Name        | Type                        | Required | Description                                                                                                                       |
| ----------- | --------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `platform`  | `"instagram" \| "facebook"` | Yes      |                                                                                                                                   |
| `accountId` | `uuid`                      | Yes      | A connected Instagram account or Facebook Page in your organization.                                                              |
| `profileId` | `uuid`                      |          | Optional, because accountId names its profile. If you pass both, they must agree.                                                 |
| `recipient` | `string`                    | Yes      | The provider-scoped participant id, 1–200 characters. Take it from the `sender` field of an inbound message, not from a username. |
| `text`      | `string`                    | Yes      | 1–1,000 characters.                                                                                                               |

A Facebook reply has the same shape. `accountId` is the connected Page, and
`recipient` is the person's PSID, from the `sender` field of their inbound
message:

```json
{
  "platform": "facebook",
  "accountId": "00000000-0000-0000-0000-000000000002",
  "recipient": "6200000000000001",
  "text": "Yes, we deliver on Saturdays."
}
```

WhatsApp sends an approved template instead of text; see
[WhatsApp](https://www.tryadeli.com/docs/api/messages#whatsapp) for its body.

Success returns `201` and a bare message object with `direction: "outbound"`,
`type: "text"`, and `status: "sent"`.

> **Note: Meta's messaging rules still apply**
>
> A business can message a person only inside the window Meta's policy opens,
> which begins when that person messages the business. When Meta refuses a send
> because that window has closed, the response is `409 window_closed`. Wait for
> the person to message again before retrying.

**Errors** — `401 unauthorized`, `400 invalid_request`, `404 profile_not_found`,
`404 account_not_found`, `409 window_closed`, `409 page_not_selected` (Facebook),
`403 missing_permission` (Facebook), `422 connection_expired`,
`422 provider_not_configured`, `422 provider_not_supported`,
`502 provider_error`.

## Request examples

**cURL**

```bash
curl --fail-with-body -X POST "https://app.tryadeli.com/api/v1/messages" \
  -H "Authorization: Bearer $ADELI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "platform": "instagram",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "recipient": "17841400000000001",
  "text": "Yes, we ship to Canada."
}'
```

**JavaScript**

```javascript
const response = await fetch("https://app.tryadeli.com/api/v1/messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    platform: "instagram",
    accountId: "00000000-0000-0000-0000-000000000000",
    recipient: "17841400000000001",
    text: "Yes, we ship to Canada.",
  }),
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

response = requests.post(
    "https://app.tryadeli.com/api/v1/messages",
    headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"},
    json={
        "platform": "instagram",
        "accountId": "00000000-0000-0000-0000-000000000000",
        "recipient": "17841400000000001",
        "text": "Yes, we ship to Canada.",
    },
)
print(response.json())
```

## Responses

### 201

```json
{
  "id": "instagram_message_aWdfbWlkMg",
  "providerId": "aWdfbWlkMg",
  "platform": "instagram",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "profileId": "00000000-0000-4000-8000-000000000001",
  "direction": "outbound",
  "type": "text",
  "recipient": "17841400000000001",
  "sender": "17841400000000000",
  "body": "Yes, we ship to Canada.",
  "status": "sent",
  "occurredAt": "2026-04-01T12:05:00.000Z",
  "createdAt": "2026-04-01T12:05:00.000Z"
}
```

### 409

```json
{
  "error": {
    "code": "window_closed",
    "message": "Instagram's 24-hour reply window has closed for this recipient"
  }
}
```
