# groups.campaign_health

Saúde da campanha de grupos. Nota de 0 a 100, nível (`ok`, `attention`, `critical`), os motivos em português e a próxima ação (`nextAction`: rótulo e aba onde resolver). Considera números, grupos, alertas abertos e a última entrada.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/groups.campaign_health` (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_campaign_health`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `groups.campaign_health`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `campaignId` | string (uuid) | sim |  |

<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)$"
    }
  },
  "required": [
    "campaignId"
  ]
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs groups.campaign_health --json '{"campaignId":"00000000-0000-4000-8000-000000000001"}'
```

MCP: ferramenta `groups_campaign_health` 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": {
    "score": {
      "type": "number"
    },
    "level": {
      "type": "string",
      "enum": [
        "ok",
        "attention",
        "critical"
      ]
    },
    "reasons": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "nextAction": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "tab": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "groups",
                "capture",
                "messages",
                "settings"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "label",
        "tab"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "score",
    "level",
    "reasons",
    "nextAction"
  ],
  "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).
