Pular para o conteúdo

POST /v1/flows/{id}/test

POST
/v1/flows/{id}/test
curl --request POST \
--url https://seu-endereco-da-api/v1/flows/example/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "graph": { "nodes": [ {} ], "edges": [ {} ] }, "contactId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "channelId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "input": { "kind": "start", "text": "example" }, "state": { "waitingNodeId": "example", "attempts": 1, "vars": {}, "agentMessages": [ { "role": "user", "content": "example" } ], "warned": [ "example" ] } }'

Permissão que a Chave de acesso precisa: Gerenciar fluxos (flows:manage).

id
required
string
Media typeapplication/json
object
graph
required
object
nodes
required
Array<object>
object
edges
required
Array<object>
object
contactId
string format: uuid
nullable
channelId
string format: uuid
nullable
input
required
object
kind
required
string
Allowed values: start reply timeout charge_paid charge_failed
text
string
<= 4000 characters
state
object
waitingNodeId
required
string
>= 1 characters <= 200 characters
attempts
required
number
<= 100
vars
object
agentMessages
Array<object>
object
role
required
string
Allowed values: user assistant
content
required
string
<= 4000 characters
warned
Array<string>
Media typeapplication/json
object
events
required
Array<object>
object
kind
required
string
Allowed values: mensagem modelo acao espera api agente cobranca agendamento fim
nodeId
required
string
text
required

What the panel shows: the message, the template text, the described action, the wait, the api response, the agent reply, the described charge or the offered slots

string
detail
required

Media kind, template name, action type, api mode (exemplo or de_verdade), agent name or why the test stopped

string
nullable
steps
required
Array<object>
object
nodeId
required
string
nodeType
required
string
handle
required
string
nullable
outcome
required
string
Allowed values: passou esperando falhou encerrou
reason
required
string
nullable
state
required

Null when the test ended

object
waitingNodeId
required

The Pergunta, Agendamento or Agente block the test waits on

string
attempts
required
number
vars
required

The test variables only; send it back as is on the next call

object
agentMessages

The agent conversation of the test; send it back as is on the next call

Array<object>
object
role
required
string
Allowed values: user assistant
content
required
string
warned

The warnings already shown in this test, so the next call does not repeat them; send it back as is

Array<string>
ended
required
boolean
warnings
required

What would go wrong live on this turn, one per warning and block in the whole test

Array<object>
object
code
required
string
Allowed values: channel_disconnected exit_unwired window_closed template_not_approved template_media_missing contact_blocked api_would_fail
nodeId
required

The block the warning belongs to

string
message
required

What would go wrong live, ready to show

string

Example

{
"events": [
{
"kind": "mensagem"
}
],
"steps": [
{
"outcome": "passou"
}
],
"state": {
"agentMessages": [
{
"role": "user"
}
]
},
"warnings": [
{
"code": "channel_disconnected"
}
]
}