# Enviar mensagem rica (AI rich)

`POST /send/rich`

Pasta: **Enviar Mensagem**

## Autenticação

```http
token: {{token}}
```

## Descrição

# Enviar mensagem rica

Envia uma mensagem AI Rich composta por vários blocos (texto, código, tabela, LaTeX) em uma única mensagem.

## Endpoint

```http
POST {{baseUrl}}/send/rich
```

## Autenticação

Envie o token da instância no header:

```http
token: {{token}}
```

## Corpo da requisição

| Campo | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- |
| number | string | Sim* | Destinatário |
| chatid | string | Sim* | Alternativa a number |
| jid | string | Sim* | Alternativa a number/chatid |
| items | array | Sim | Lista de blocos ricos |
| items[].type | string | Sim | text | code | table | latex |
| items[].text | string | Condicional | Para type=text ou latex |
| items[].code | string | Condicional | Para type=code |
| items[].language | string | Condicional | Linguagem do code |
| items[].headers | string[] | Condicional | Cabeçalhos (table) |
| items[].rows | string[][] | Condicional | Linhas (table) |
| items[].expressions | string[] | Condicional | Expressões LaTeX |
| native_rich | bool | Não | Usa renderização nativa rica quando disponível |

## Exemplo de Requisição

```bash
curl -X POST "{{baseUrl}}/send/rich" \
  -H "token: {{token}}" \
  -H "Content-Type: application/json" \
  -d '{"number": "{{remoteJid}}", "native_rich": false, "items": [{"type": "text", "text": "Resultado da análise"}, {"type": "table", "headers": ["Métrica", "Valor"], "rows": [["CPU", "12%"], ["RAM", "512Mi"]]}, {"type": "code", "language": "go", "code": "fmt.Println(\"ok\")"}]}'
```

## Resposta de Sucesso

```json
{
  "success": true,
  "message": {
    "id": "3EB0A1B2C3D4E5F6",
    "timestamp": "2026-07-17T12:34:56Z",
    "sender": "5511888888888@s.whatsapp.net"
  }
}
```

## Erros comuns

- `chatid, number or jid is required`
- `unsupported rich item type: ...`
- `items` ausente

## Corpo (exemplo)

```json
{
  "number": "{{remoteJid}}",
  "native_rich": false,
  "items": [
    { "type": "text", "text": "Resultado da análise" },
    { "type": "table", "headers": ["Métrica", "Valor"], "rows": [["CPU", "12%"], ["RAM", "512Mi"]] },
    { "type": "code", "language": "javascript", "code": "console.log('ok')" },
    { "type": "latex", "text": "Fórmula", "expressions": ["E=mc^2"] }
  ]
}
```

## cURL

```bash
curl -X POST "{{baseUrl}}/send/rich" \
  -H "token: {{token}}" \
  -H "Content-Type: application/json" \
  -d '{
  "number": "{{remoteJid}}",
  "native_rich": false,
  "items": [
    { "type": "text", "text": "Resultado da análise" },
    { "type": "table", "headers": ["Métrica", "Valor"], "rows": [["CPU", "12%"], ["RAM", "512Mi"]] },
    { "type": "code", "language": "javascript", "code": "console.log('\''ok'\'')" },
    { "type": "latex", "text": "Fórmula", "expressions": ["E=mc^2"] }
  ]
}'
```

---

[Índice da pasta](./index.md) · [Índice geral](../index.md) · [UI](https://gozap.dev/docs?op=enviar-mensagem/enviar-mensagem-rica-ai-rich)
