Ver .md

cadences.create

Criar cadência de follow-up. Cria a cadência em phases (1 a 10 fases, até 20 passos no total, cada fase com ao menos um passo; passo = type, priority, waitMinutes 0 a 129600, title, description até 2000 caracteres, durationMinutes 5 a 1440). Cada passo vira uma tarefa quando chega a vez. Deu certo -> pula para a próxima fase (na última, conclui); sem sucesso -> segue para o próximo passo (no fim, esgota). stageId (etapa aberta) inicia a cadência sozinha quando a oportunidade entra nela e tira a etapa de outra cadência que a usava. businessHoursCalendarId empurra prazos para o horário de atendimento (sem ele vale o calendário principal). dailyLimitPerAttendant (1 a 500) passa o passo para o dia seguinte quando o atendente atinge o limite. Começa ativa.

  • Endpoint: POST https://app.atomiks.com.br/api/v1/cadences.create (corpo JSON)
  • Quem pode chamar: administrador da conta
  • Escopo da chave: crm:write
  • Grava dados: sim
  • Pela chave de API: sim
  • Ferramenta MCP: cadences_create
  • Ficha em JSON: https://app.atomiks.com.br/api/v1/openapi.json (operationId cadences.create)

Entrada

CampoTipoObrigatórioNota
namestringsim
descriptionstring | nullnão
isActivebooleannão
stageIdstring (uuid) | nullnão
businessHoursCalendarIdstring (uuid) | nullnão
dailyLimitPerAttendantinteger | nullnão
phasesobject[]sim
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ]
    },
    "isActive": {
      "type": "boolean"
    },
    "stageId": {
      "anyOf": [
        {
          "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)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "businessHoursCalendarId": {
      "anyOf": [
        {
          "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)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "dailyLimitPerAttendant": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 500
        },
        {
          "type": "null"
        }
      ]
    },
    "phases": {
      "minItems": 1,
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          },
          "steps": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "call",
                    "whatsapp",
                    "meeting",
                    "task"
                  ]
                },
                "priority": {
                  "default": "none",
                  "type": "string",
                  "enum": [
                    "none",
                    "urgent",
                    "high",
                    "medium",
                    "low"
                  ]
                },
                "waitMinutes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 129600
                },
                "durationMinutes": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 5,
                      "maximum": 1440
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "description": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 2000
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "type",
                "waitMinutes",
                "title"
              ]
            }
          }
        },
        "required": [
          "steps"
        ]
      }
    }
  },
  "required": [
    "name",
    "phases"
  ]
}

Exemplo

curl -X POST https://app.atomiks.com.br/api/v1/cadences.create \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Reativação de lead frio","phases":[{"name":"Retomada","steps":[{"type":"whatsapp","priority":"none","waitMinutes":0,"title":"Retomar a conversa com uma novidade"},{"type":"call","priority":"high","waitMinutes":1440,"title":"Ligar para entender o momento"}]}]}'

CLI:

node cli/atomiks.mjs cadences.create --json '{"name":"Reativação de lead frio","phases":[{"name":"Retomada","steps":[{"type":"whatsapp","priority":"none","waitMinutes":0,"title":"Retomar a conversa com uma novidade"},{"type":"call","priority":"high","waitMinutes":1440,"title":"Ligar para entender o momento"}]}]}'

MCP: ferramenta cadences_create com a mesma entrada.

Saída

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

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "isActive": {
      "type": "boolean"
    },
    "stageId": {
      "type": [
        "string",
        "null"
      ]
    },
    "stageName": {
      "type": [
        "string",
        "null"
      ]
    },
    "businessHoursCalendarId": {
      "type": [
        "string",
        "null"
      ]
    },
    "dailyLimitPerAttendant": {
      "type": [
        "number",
        "null"
      ]
    },
    "phaseNames": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "position": {
            "type": "number"
          },
          "phase": {
            "type": "number"
          },
          "type": {
            "type": "string",
            "enum": [
              "call",
              "whatsapp",
              "meeting",
              "task"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "none",
              "urgent",
              "high",
              "medium",
              "low"
            ]
          },
          "waitMinutes": {
            "type": "number"
          },
          "durationMinutes": {
            "type": [
              "number",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "position",
          "phase",
          "type",
          "priority",
          "waitMinutes",
          "durationMinutes",
          "title",
          "description"
        ],
        "additionalProperties": false
      }
    },
    "liveRuns": {
      "type": "number"
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "name",
    "description",
    "isActive",
    "stageId",
    "stageName",
    "businessHoursCalendarId",
    "dailyLimitPerAttendant",
    "phaseNames",
    "steps",
    "liveRuns",
    "createdAt",
    "updatedAt"
  ],
  "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).