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

# Send a message

> Send a Messenger message from your Page.

Send a Messenger message through a connected HookMyApp channel.

Use the connected Page id in the path. Use the inbound `sender.id` as the outbound `recipient.id`.

Supports:

* `text`: Plain text replies
* `attachment`: `image`, `video`, `audio` or `file` by public https URL
* `messaging_type: MESSAGE_TAG` with `tag`: Send outside the 24-hour window
* `recipient.comment_id`: Private reply to a comment, instead of `recipient.id`
* `sender_action`: `mark_seen`, `typing_on`, `typing_off`

## Authentication

Use the `hmat_` channel token from `GET /meta/channels/{id}/token` or `hookmyapp channels token <channel>`. Do not use an `hmok_` API key for this call.

```bash theme={null}
Authorization: Bearer hmat_...
```

## Path parameters

<ParamField path="pageId" type="string" required>
  The connected Page id.
</ParamField>

## Request body

<ParamField body="recipient.id" type="string">
  Page-scoped id (PSID) from the inbound webhook `sender.id`. Required unless `recipient.comment_id` is set.
</ParamField>

<ParamField body="recipient.comment_id" type="string">
  A comment id on one of the Page's posts, for a private reply. One per comment, within 7 days of the comment.
</ParamField>

<ParamField body="message" type="object">
  The message payload: `text` or `attachment`. Omit when sending a `sender_action`.
</ParamField>

<ParamField body="messaging_type" type="string">
  `MESSAGE_TAG` when sending outside the 24-hour window. Requires `tag`.
</ParamField>

<ParamField body="tag" type="string">
  `CONFIRMED_EVENT_UPDATE`, `POST_PURCHASE_UPDATE`, `ACCOUNT_UPDATE` or `HUMAN_AGENT`.
</ParamField>

<ParamField body="sender_action" type="string">
  `mark_seen`, `typing_on` or `typing_off`. Free, not counted as a message.
</ParamField>

## Example

```bash theme={null}
curl -X POST "https://gateway.hookmyapp.com/meta/v25.0/{PAGE_ID}/messages" \
  -H "Authorization: Bearer hmat_..." \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": { "id": "200000000000001" },
    "message": { "text": "Hello from HookMyApp" }
  }'
```

## Successful response

```json theme={null}
{
  "recipient_id": "200000000000001",
  "message_id": "m_AbCdEfGhIjKlMnOpQrSt"
}
```

## Outside the 24-hour window

A free-form message to a person who last wrote more than 24 hours ago is rejected with HTTP 409: "This person last messaged you more than 24 hours ago. Send a message tag or wait for them to write again." A person who cannot receive messages from your Page returns 409 too. Neither can succeed on retry.

See [Send messages](/facebook/send-messages) for the guide.
