# Enviar sticker

> Envía un sticker WebP, estático o animado, por WhatsApp.

Envía un sticker con `POST /v1/messages` y `type: "sticker"`. Solo WhatsApp acepta este tipo. Los campos comunes a todos los tipos (`to`, `reply_to`, `typing`, `delay_ms`, ventana de 24 h) están en [Campos comunes](/es/send/text/#campos-comunes).

  **cURL**

```bash
curl -X POST https://api.messajo.com/v1/messages \
  -H "Authorization: Bearer $MESSAJO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "connection_id": "con_123",
  "to": "5511999990000",
  "type": "sticker",
  "sticker": {
    "link": "https://cdn.ejemplo.com/pulgar.webp"
  }
}'
```

  **TypeScript**

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

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

const message = await messajo.messages.send({
  connection_id: "con_123",
  to: "5511999990000",
  type: "sticker",
  sticker: { link: "https://cdn.ejemplo.com/pulgar.webp" },
});
console.log(message.id, message.status);
```

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

```json
{
  "connection_id": "con_123",
  "to": "5511999990000",
  "type": "sticker",
  "sticker": {
    "link": "https://cdn.ejemplo.com/pulgar.webp"
  }
}
```

La respuesta es `201` con `id` (`msg_…`), `status: "queued"` y `conversation_id`. El estado final llega por webhook.

## Enlace o carga

Indica **exactamente uno** entre `link` y `media_id`. Enviar los dos, o ninguno, devuelve `400 validation_failed` con `exactly one of media_id or link is required`. Los stickers no tienen leyenda.

- `link`: URL del archivo `.webp`.
- `media_id` (`med_…`): viene de `POST /v1/media`, un `multipart/form-data` con `file` (y `connection_id`, salvo con una clave de conexión `mjc_…`). Exige el permiso `send`. El tipo se lee de los bytes del archivo, no de la extensión.

  **cURL**

```bash
curl -X POST https://api.messajo.com/v1/media \
  -H "Authorization: Bearer $MESSAJO_API_KEY" \
  -F connection_id=con_123 \
  -F file=@pulgar.webp
```

  **TypeScript**

```ts
import { readFile } from "node:fs/promises";

const media = await messajo.media.upload({
  file: new Blob([await readFile("pulgar.webp")]),
  connection_id: "con_123",
});

await messajo.messages.send({
  connection_id: "con_123",
  to: "5511999990000",
  type: "sticker",
  sticker: { media_id: media.id },
});
```

La carga devuelve el `id` del medio (`med_…`), que usas en `sticker.media_id`.

## Formato y tamaño

Solo **WebP**. La carga detecta en el archivo si el sticker es animado:

| Tipo | Tamaño máximo |
| --- | --- |
| Estático | 100 KiB |
| Animado | 500 KiB |

Por encima del límite, la carga devuelve `413 media_too_large`.

## Instagram y Messenger

No aceptan stickers: `type: "sticker"` devuelve `422 type_not_supported_by_channel`.

## Errores

| Código | Estado | Cuándo |
| --- | --- | --- |
| `validation_failed` | 400 | `link` y `media_id` juntos, o ninguno de los dos |
| `media_too_large` | 413 | Más de 100 KiB (estático) o 500 KiB (animado) |
| `media_type_not_supported` | 415 | El archivo no es WebP |
| `media_error` | 422 | Meta no pudo procesar el medio |
| `type_not_supported_by_channel` | 422 | Instagram o Messenger |
| `outside_service_window` | 422 | Mensaje libre fuera de la ventana de 24 h |
