playbooks.thread_set
Escolher o playbook ou marcar o progresso de uma conversa. Com playbookId (escopo livechat), a conversa passa a usar esse playbook e o progresso volta ao início (primeira etapa, nenhuma pergunta marcada). Sem playbookId, grava o progresso: stageId (etapa do playbook) e/ou coveredQuestionIds (perguntas do playbook; as desconhecidas são ignoradas). Se a conversa ainda usava o playbook do pipeline, ele passa a ser o dela. playbookId: null volta a seguir o pipeline. Devolve o mesmo formato de playbooks.thread_get.
- Endpoint:
POST https://app.atomiks.com.br/api/v1/playbooks.thread_set(corpo JSON) - Quem pode chamar: membro da conta
- Escopo da chave:
messages:send - Grava dados: sim
- Pela chave de API: sim
- Ferramenta MCP:
playbooks_thread_set - Ficha em JSON:
https://app.atomiks.com.br/api/v1/openapi.json(operationIdplaybooks.thread_set)
Entrada
| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
threadId | string (uuid) | sim | |
playbookId | string (uuid) | null | não | |
stageId | string | não | |
coveredQuestionIds | string[] | não |
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"threadId": {
"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)$"
},
"playbookId": {
"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"
}
]
},
"stageId": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"coveredQuestionIds": {
"maxItems": 600,
"type": "array",
"items": {
"type": "string",
"maxLength": 80
}
}
},
"required": [
"threadId"
]
}Exemplo
curl -X POST https://app.atomiks.com.br/api/v1/playbooks.thread_set \
-H "Authorization: Bearer $ATOMIKS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"threadId":"00000000-0000-0000-0000-000000000000","playbookId":"00000000-0000-0000-0000-000000000000"}'CLI:
node cli/atomiks.mjs playbooks.thread_set --json '{"threadId":"00000000-0000-0000-0000-000000000000","playbookId":"00000000-0000-0000-0000-000000000000"}'MCP: ferramenta playbooks_thread_set com a mesma entrada.
Saída
Sucesso: {"data": ...} com o formato abaixo.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"playbook": {
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"scopes": {
"type": "array",
"items": {
"type": "string",
"enum": [
"meeting",
"whatsapp",
"livechat",
"flows"
]
}
},
"stages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"key": {
"type": "string",
"maxLength": 40,
"pattern": "^[a-z0-9_-]*$"
},
"title": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"objective": {
"default": "",
"type": "string",
"maxLength": 600
},
"talkTrack": {
"default": "",
"type": "string",
"maxLength": 6000
},
"watchOut": {
"default": "",
"type": "string",
"maxLength": 600
},
"questions": {
"default": [],
"maxItems": 30,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"text": {
"type": "string",
"maxLength": 300
}
},
"required": [
"id",
"text"
],
"additionalProperties": false
}
}
},
"required": [
"id",
"title",
"objective",
"talkTrack",
"watchOut",
"questions"
],
"additionalProperties": false
}
},
"tones": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"when": {
"type": "string"
},
"delivery": {
"type": "string"
}
},
"required": [
"id",
"name",
"when",
"delivery"
],
"additionalProperties": false
}
},
"keywords": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"terms": {
"type": "array",
"items": {
"type": "string"
}
},
"title": {
"type": "string"
},
"text": {
"type": "string"
},
"tone": {
"type": "string",
"enum": [
"info",
"warning",
"urgent"
]
}
},
"required": [
"id",
"terms",
"title",
"text",
"tone"
],
"additionalProperties": false
}
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"url": {
"type": "string"
},
"mimeType": {
"type": "string"
},
"size": {
"type": "number"
}
},
"required": [
"id",
"name",
"url",
"mimeType",
"size"
],
"additionalProperties": false
}
},
"guardrails": {
"type": "array",
"items": {
"type": "string"
}
},
"createdAt": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
},
"required": [
"id",
"name",
"description",
"scopes",
"stages",
"tones",
"keywords",
"attachments",
"guardrails",
"createdAt",
"updatedAt"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"progress": {
"anyOf": [
{
"type": "object",
"properties": {
"stageId": {
"type": [
"string",
"null"
]
},
"coveredQuestionIds": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"stageId",
"coveredQuestionIds"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"source": {
"anyOf": [
{
"type": "string",
"enum": [
"thread",
"pipeline"
]
},
{
"type": "null"
}
]
}
},
"required": [
"playbook",
"progress",
"source"
],
"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).