readyDocs Open the appOpen the app

AI reply agents

An AI reply agent answers your contacts' texts for you. These endpoints do what the bar above an inbox conversation does (its Take over and Resume AI buttons): see which agent is handling a conversation, stop it so a person can reply, and hand the conversation back. You can also switch an agent on or off. Each reply an agent sends costs 1 × your per-segment rate on top of the text itself. An agent is made in the dashboard, and each one runs inside an automation.

#List AI agents

Every AI reply agent on your account, oldest first. Needs the manage_campaigns permission.

Returns
dataobject[]
One object per agent. Read id, name and status. The other fields describe how the agent is set up and can change, so don’t rely on them.
data[].statusenum
auto replies on its own, suggest writes drafts for a person to send, off does nothing.
Errors
HTTPCodeWhen
500agents_unavailableWe couldn’t read your agents. Retry.

#See which agent has a conversation

Which AI agent is handling a contact’s conversation, and whether it is paused. Needs the view_messages permission.

Parameters

contactIdinteger, pathRequired
The contact’s id.
Returns
data.agentobject | null
The agent’s id, name and status. null when no agent that is switched on has answered or been paused on this contact. The other fields below are then left out.
data.engagedboolean
Always true when agent is set.
data.pausedinteger
1 when the agent has stopped replying to this contact, else 0.
data.paused_byenum | null
Who paused it: human (a takeover), ai (the agent handed off by itself) or automation. null when not paused.
data.handoff_labelstring | null
Why the agent handed off, as a sentence to show a person. Set only when paused_by is ai. Its wording can change, so don’t match on it.
Errors
HTTPCodeWhen
400invalid_fieldcontactId isn’t a whole number.
403CONVERSATION_NOT_ASSIGNEDYour seat sees only its assigned contacts, and this conversation is a teammate’s.
500agents_unavailableWe couldn’t read the AI status. Retry.

#Turn an agent on or off

Switches the automation the agent runs in, the same switch as turning that automation on or off in the dashboard. Off, the agent stops replying to everyone and nothing is billed. On, it starts answering again, and each reply it sends costs 1 × your per-segment rate on top of the text itself. Sending the same value twice changes nothing. Needs the manage_campaigns permission.

Parameters

idinteger, pathRequired
The agent’s id, from List your agents.
enabledbooleanRequired
true turns the agent on, false turns it off. There is no default.
Returns
data.idinteger
The agent’s id.
data.enabledboolean
The state you set.
data.statusenum
The agent’s status now: off after you turn it off, and its saved mode (auto or suggest) after you turn it back on.
Errors
HTTPCodeWhen
400invalid_enabledenabled is missing or isn’t true or false. A path id that isn’t a whole number answers 400 invalid_field.
404agent_not_foundNo agent with this id on your account.
409AGENT_HAS_NO_AUTOMATIONThe agent isn’t part of an automation yet, so there is nothing to switch. Add it to one in the dashboard.
409AUTOMATION_UNFINISHEDTurning on is refused because the automation isn’t finished. The message says what is missing. Finish it in the dashboard.
400SHEETS_ACTIVATION_FAILEDTurning on is refused because the automation’s Google Sheets trigger couldn’t start. Fix it in the dashboard, then try again.
404automation_not_foundThe agent’s automation is gone.
500agents_unavailableNothing changed. Retry.

#Take over a conversation

Stops the agent from replying to one contact, so a person can reply. The agent keeps answering everyone else. Sending it again changes nothing. Needs the manage_campaigns permission.

Parameters

idinteger, pathRequired
The agent’s id, from See which agent has a conversation.
contact_idintegerRequired
The contact whose conversation you take over.
Returns
successboolean
true. Nothing else.
Errors
HTTPCodeWhen
400contact_requiredcontact_id is missing or isn’t a whole number.
404agent_not_foundNo agent with this id on your account. A path id that isn’t a whole number answers 400 invalid_field.
404contact_not_foundNo contact with this id on your account.
403CONVERSATION_NOT_ASSIGNEDYour seat sees only its assigned contacts, and this conversation is a teammate’s.
500agents_unavailableNothing changed. Retry.

#Hand a conversation back

Lets the agent reply to this contact again, whoever paused it. Its count of replies to the contact starts over. Sending it again changes nothing. Needs the manage_campaigns permission.

Parameters

idinteger, pathRequired
The agent’s id.
contact_idintegerRequired
The contact whose conversation you hand back.
Returns
successboolean
true. Nothing else.
Errors

The same as Take over a conversation.

#Try an agent

Gets the reply the agent would send to a practice conversation. Nothing is sent or saved, and the agent’s tools (tags, bookings) don’t run. Needs the manage_campaigns permission.

Parameters

idinteger, pathRequired
The agent’s id.
messagesobject[]Required
The conversation so far, oldest first, at least one. Each is { "direction": "inbound", "body": "..." }: inbound is the contact, outbound is the agent. Only the last 40 are read, and only the first 1000 characters of each.
Returns
data.replystring
The agent’s reply.
data.handoffboolean
true when the agent would hand this conversation to a person.
Errors
HTTPCodeWhen
400invalid_fieldmessages is missing, empty or not a list.
404agent_not_foundNo agent with this id on your account.
429noneToo many AI requests from your account. Wait a few minutes.
502ai_unavailableThe AI didn’t answer. Retry later.
503ai_unavailableThe monthly AI spending limit for agent replies is reached. It fails until the month resets.