Ver .md

cadences.tasks_create

Criar uma sequência de tarefas para uma oportunidade. Cadência avulsa do "novo item de agenda": cria uma tarefa por passo (steps, 1 a 20), com o prazo de cada uma contado da anterior (waitMinutes acumulado a partir de agora; o primeiro passo conta a partir do momento da chamada). type whatsapp vira tarefa de mensagem. attendantId (padrão: o dono da oportunidade, ou quem chamou) precisa ver o contato. O texto de automation.message entra nas anotações da tarefa como mensagem planejada: o Atomiks ainda não envia essa mensagem sozinho nem para ao receber resposta. Não usa execução de cadência (não aparece em cadences.runs_list). Devolve as tarefas criadas.

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

Entrada

CampoTipoObrigatórioNota
opportunityIdstring (uuid)sim
attendantIdstring (uuid)não
stepsobject[]sim
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "opportunityId": {
      "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)$"
    },
    "attendantId": {
      "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)$"
    },
    "steps": {
      "minItems": 1,
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "waitMinutes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 129600
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "type": {
            "default": "whatsapp",
            "type": "string",
            "enum": [
              "call",
              "whatsapp",
              "meeting",
              "task"
            ]
          },
          "description": {
            "type": "string",
            "maxLength": 2000
          },
          "durationMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 5,
                "maximum": 1440
              },
              {
                "type": "null"
              }
            ]
          },
          "automation": {
            "type": "object",
            "properties": {
              "channel": {
                "type": "string",
                "const": "whatsapp"
              },
              "channelInstanceId": {
                "type": "string",
                "maxLength": 100
              },
              "templateId": {
                "type": "string",
                "maxLength": 200
              },
              "templateParams": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "message": {
                "type": "string",
                "maxLength": 5000
              },
              "stopOnReply": {
                "type": "boolean"
              }
            }
          }
        },
        "required": [
          "waitMinutes",
          "title"
        ]
      }
    }
  },
  "required": [
    "opportunityId",
    "steps"
  ]
}

Exemplo

curl -X POST https://app.atomiks.com.br/api/v1/cadences.tasks_create \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"opportunityId":"00000000-0000-0000-0000-000000000000","steps":[{"waitMinutes":0,"title":"Mandar apresentação","type":"whatsapp","automation":{"message":"Olá! Tudo bem?"}}]}'

CLI:

node cli/atomiks.mjs cadences.tasks_create --json '{"opportunityId":"00000000-0000-0000-0000-000000000000","steps":[{"waitMinutes":0,"title":"Mandar apresentação","type":"whatsapp","automation":{"message":"Olá! Tudo bem?"}}]}'

MCP: ferramenta cadences_tasks_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": {
    "tasks": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "dueAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "kind",
          "dueAt"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "tasks"
  ],
  "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).