# attendants.activity_summary

Resumo de atividade de um atendente. Cartão-resumo que aparece ao passar o mouse no avatar da linha do tempo: nome e tipos, atividades (total, 7 e 30 dias, série diária dos últimos 30 dias, hora de pico no fuso da conta, tipos mais frequentes), oportunidades (em aberto, ganhas e valor ganho nos últimos 30 dias, em centavos) e as 5 atividades mais recentes. Conta as 100 linhas mais recentes de cada fonte de `attendants.activity`.

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

## Entrada

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

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "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": [
    "id"
  ]
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs attendants.activity_summary --json '{"id":"00000000-0000-0000-0000-000000000000"}'
```

MCP: ferramenta `attendants_activity_summary` 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": {
    "attendant": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "types": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "emoji": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "color": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "emoji",
              "color"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "name",
        "types"
      ],
      "additionalProperties": false
    },
    "activity": {
      "type": "object",
      "properties": {
        "total": {
          "type": "number"
        },
        "last7Days": {
          "type": "number"
        },
        "last30Days": {
          "type": "number"
        },
        "timeseries": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string"
              },
              "count": {
                "type": "number"
              }
            },
            "required": [
              "date",
              "count"
            ],
            "additionalProperties": false
          }
        },
        "peakHour": {
          "type": [
            "number",
            "null"
          ]
        },
        "peakHourCount": {
          "type": "number"
        },
        "topEventTypes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "eventName": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "count": {
                "type": "number"
              }
            },
            "required": [
              "eventName",
              "label",
              "count"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "total",
        "last7Days",
        "last30Days",
        "timeseries",
        "peakHour",
        "peakHourCount",
        "topEventTypes"
      ],
      "additionalProperties": false
    },
    "opportunities": {
      "type": "object",
      "properties": {
        "open": {
          "type": "number"
        },
        "wonLast30Days": {
          "type": "number"
        },
        "wonValueLast30Days": {
          "type": "number"
        }
      },
      "required": [
        "open",
        "wonLast30Days",
        "wonValueLast30Days"
      ],
      "additionalProperties": false
    },
    "recent": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "eventName": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "eventName",
          "label",
          "createdAt"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "attendant",
    "activity",
    "opportunities",
    "recent"
  ],
  "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).
