Endpoint ·
POST /conversation/actionsassign_ai_employee assigns it (optionally running it) and unassign_ai
removes it (the conversation hands off to a human).
assign_ai_employee
Assigns an AI employee to the conversation. With run: true, it also runs it
immediately (only then does it count as an AI-triggering action).
Fields
ai_employee—{ name }of the AI employee (required).run— boolean (optional, defaultfalse). Withtrueit runs the employee immediately after assigning it.instructions— optional text with specific instructions for that run. Only applies withrun: true.scheduled_message_action—reassign|cancel. What to do with the conversation’s active scheduled message. Sendcancelby default (see the warning).
The run may leave a scheduled message behind. If the employee’s instructions or the conversation lead it to schedule itself, the conversation may end up with an active AI scheduled message. In an action list that affects the actions that follow: in a later
assign_ai_employee always send scheduled_message_action (otherwise it may fail with SCHEDULED_MESSAGE_ACTION_REQUIRED), and a later cancellation or unassign_ai cancels the follow-up the employee just promised the customer. The run may also cancel the pending scheduled message. This capability is being enabled gradually. A v2 employee (new engine) doesn’t decide to schedule or cancel in this run, but its powers can change the active scheduled message: handing off to a human cancels it if an AI employee was handling the conversation, and assigning to another employee cancels it or, if an AI employee was already handling the conversation and the business configured it that way, transfers it.Employees on the new engine (v2). A v2 employee is assigned the same way as a classic one, and with
scheduled_message_action: reassign the conversation’s scheduled message moves to it. With run, it runs: if the v2 engine is turned off, or if a classic employee in its chain runs it as the assigned one (run_assigned), the group is rejected with AI_EMPLOYEE_V2_NOT_SUPPORTED (422) and nothing is reassigned. Without run it’s always assigned. If the v2 engine is off, the conversation goes to pending when the customer writes, and if the scheduled message you moved to it with reassign fires while the engine is off, it’s cancelled without reaching the customer and the conversation goes to pending at that point. See How it runs.unassign_ai
Removes the AI employee (the conversation hands off to a human). No fields;
idempotent (a successful no-op if the conversation already has no AI). Cancels
the AI’s active scheduled message, if any.
actions array of a POST /conversation/actions — see Assembling an action list.
Executable example
Two actions manage the AI employee of a conversation identified by phone and channel:assign_ai_employee assigns it (with run: true it also runs it) and
unassign_ai removes it. Send scheduled_message_action: cancel by default; use
reassign only when reassigning from one AI employee to another while keeping its
scheduled message.
Request
Response
202 Accepted — the group was accepted and runs in the background. The
per-action result does not travel in the response (query it later — see How it runs).