# Send reaction

> React to a message with an emoji, or remove the reaction, with POST /v1/messages on WhatsApp, Instagram and Messenger.

`POST /v1/messages` with `type: "reaction"` puts an emoji on a message that already exists in the conversation. It works on WhatsApp, Instagram and Messenger. The fields shared by every send are in [Common fields](/en/send/text/#common-fields).

## Before you start

- An API key with the `send` permission (see [Authentication](/en/api/authentication/)).
- An **Active** connection for the channel.
- A reaction follows the service window: outside 24 hours ([windows](/en/api/limits/#windows)) the send is refused.

## React to a message

**cURL**

```bash
curl https://api.messajo.com/v1/messages \
  -H "Authorization: Bearer $MESSAJO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
      "connection_id": "conn_...",
      "to": "5511999999999",
      "type": "reaction",
      "reaction": {
        "message_id": "msg_...",
        "emoji": "👍"
      }
    }'
```

**TypeScript**

```ts
import { Messajo } from "@messajo/sdk";

const messajo = new Messajo({ apiKey: process.env.MESSAJO_API_KEY! });

const sent = await messajo.messages.send({
  "connection_id": "conn_...",
  "to": "5511999999999",
  "type": "reaction",
  "reaction": {
    "message_id": "msg_...",
    "emoji": "👍"
  }
});
```

**n8n**

n8n HTTP Request: POST https://api.messajo.com/v1/messages

```json
{
  "connection_id": "conn_...",
  "to": "5511999999999",
  "type": "reaction",
  "reaction": {
    "message_id": "msg_...",
    "emoji": "👍"
  }
}
```

## Remove the reaction

To take the reaction off, send the same body with an empty `emoji`.

**cURL**

```bash
curl https://api.messajo.com/v1/messages \
  -H "Authorization: Bearer $MESSAJO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
      "connection_id": "conn_...",
      "to": "5511999999999",
      "type": "reaction",
      "reaction": {
        "message_id": "msg_...",
        "emoji": ""
      }
    }'
```

**TypeScript**

```ts
import { Messajo } from "@messajo/sdk";

const messajo = new Messajo({ apiKey: process.env.MESSAJO_API_KEY! });

const sent = await messajo.messages.send({
  "connection_id": "conn_...",
  "to": "5511999999999",
  "type": "reaction",
  "reaction": {
    "message_id": "msg_...",
    "emoji": ""
  }
});
```

**n8n**

n8n HTTP Request: POST https://api.messajo.com/v1/messages

```json
{
  "connection_id": "conn_...",
  "to": "5511999999999",
  "type": "reaction",
  "reaction": {
    "message_id": "msg_...",
    "emoji": ""
  }
}
```

## Fields

| Field | Rule |
|---|---|
| `reaction.message_id` | The target message: the Messajo id (`msg_…`) or the Meta id. Messajo swaps `msg_…` for the Meta id before sending. 1 to 256 characters. |
| `reaction.emoji` | Up to 16 characters. An empty string (`""`) removes the reaction. |

## Instagram like

On Instagram, `type: "like"` sends the heart, with no body. It exists on Instagram only.

## Common errors

- [`not_found`](/en/errors#not_found) (404): the `msg_…` in `message_id` does not exist.
- [`outside_service_window`](/en/errors#outside_service_window) (422): outside the 24 hours. The window end is in `details[0].message`.
- [`validation_failed`](/en/errors#validation_failed) (400): `emoji` over 16 characters or an unknown field.
