# groups.messages_list

Listar mensagens de grupos. Mensagens da biblioteca da campanha, da mais recente alterada para a mais antiga. `search` filtra por título ou texto; `kind` por tipo.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/groups.messages_list` (corpo JSON)
- Quem pode chamar: membro da conta
- Escopo da chave: `marketing:read`
- Grava dados: não
- Pela chave de API: sim
- Ferramenta MCP: `groups_messages_list`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `groups.messages_list`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `campaignId` | string (uuid) | sim |  |
| `search` | string | não |  |
| `kind` | "text" \| "media" \| "link" \| "poll" \| "contact" | não |  |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "campaignId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "search": {
      "type": "string",
      "maxLength": 120
    },
    "kind": {
      "type": "string",
      "enum": [
        "text",
        "media",
        "link",
        "poll",
        "contact"
      ]
    }
  },
  "required": [
    "campaignId"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/groups.messages_list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"campaignId":"00000000-0000-0000-0000-000000000000"}'
```

CLI:

```bash
node cli/atomiks.mjs groups.messages_list --json '{"campaignId":"00000000-0000-0000-0000-000000000000"}'
```

MCP: ferramenta `groups_messages_list` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "text",
              "media",
              "link",
              "poll",
              "contact"
            ]
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "media": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "storagePath": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "mime": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "mediaKind": {
                    "type": "string",
                    "enum": [
                      "image",
                      "video",
                      "audio",
                      "document"
                    ]
                  },
                  "fileName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "storagePath",
                  "mime",
                  "mediaKind",
                  "fileName",
                  "size"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "poll": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "options": {
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 100
                    }
                  },
                  "selectable": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "name",
                  "options",
                  "selectable"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "phone": {
                    "type": "string",
                    "maxLength": 30
                  }
                },
                "required": [
                  "name",
                  "phone"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "mentionAll": {
            "type": "boolean"
          },
          "isWelcome": {
            "type": "boolean"
          },
          "version": {
            "type": "number"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "kind",
          "body",
          "media",
          "poll",
          "contact",
          "mentionAll",
          "isWelcome",
          "version",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
