Creates a new AI agent for the account. The agent will be created with the specified configuration including name, role, actions, and behavior settings.
POST https://services.leadconnectorhq.com/conversation-ai/agents
Autorización
Bearer token generado desde el portal Leadway. Ver Autenticación .
Version
string
default: "2021-07-28"
required
Versión de la API.
Body
name
string
default: "John Doe"
required
Name of the agent.
businessName
string
default: "Tech Corp"
Name of the business the agent represents.
mode
string
default: "auto-pilot"
Mode of operation - OFF, SUGGESTIVE, or AUTO_PILOT Posibles valores: ‘off’, ‘suggestive’, ‘auto-pilot’
Communication channels the agent can operate on
Indicates if this agent is a primary agent.
Wait time before agent responds (max 5 for minutes, 300 for seconds)
Unit for wait time - SECONDS or MINUTES Posibles valores: ‘minutes’, ‘seconds’
Indicates if sleep functionality is enabled.
Duration of sleep period (required if sleepEnabled is true). Set to null for indefinite sleep. (max 2880 for minutes, 172800 for seconds, 48 for hours)
Unit of sleep time - HOURS, MINUTES, or SECONDS (required if sleepEnabled is true). Set to null for indefinite sleep. Posibles valores: ‘hours’, ‘minutes’, ‘seconds’
personality
string
default: "Friendly and helpful"
required
Personality traits of the agent.
goal
string
default: "Assist customers with inquiries."
required
The goal of the agent.
instructions
string
default: "Provide customer service."
required
Instructions for the agent.
Maximum number of messages in auto-pilot mode before requiring human intervention. (max: 100, min: 1)
Array of knowledge base IDs associated with this agent.
Allow agent to respond to images
Allow agent to respond to audio
Enable sleep when a manual outbound message is sent.
Enable sleep when a workflow outbound message is sent.
Respuestas
201 - Successful response
id
string
default: "emp_123"
required
Unique identifier for the agent.
name
string
default: "John Doe"
required
Name of the agent.
businessName
string
default: "Tech Corp"
Name of the business the agent represents.
mode
string
default: "auto-pilot"
required
Current operating mode of the agent. Posibles valores: ‘off’, ‘suggestive’, ‘auto-pilot’
Communication channels the agent operates on.
waitTime
number
default: "30"
required
Wait time before agent responds.
waitTimeUnit
string
default: "seconds"
required
Unit for wait time. Posibles valores: ‘minutes’, ‘seconds’
sleepEnabled
boolean
default: "False"
required
Indicates if sleep functionality is enabled.
Duration of sleep period.
Unit of sleep time. Posibles valores: ‘hours’, ‘minutes’, ‘seconds’
List of actions associated with this agent. id
string
default: "actionId123"
required
Unique identifier for the action.
type
string
default: "triggerWorkflow"
required
type of action. Posibles valores: ‘triggerWorkflow’, ‘updateContactField’, ‘appointmentBooking’, ‘stopBot’, ‘humanHandOver’, ‘advancedFollowup’, ‘transferBot’
isPrimary
boolean
default: "False"
required
Indicates if this agent is a primary agent.
autoPilotMaxMessages
number
default: "25"
required
Maximum number of messages in auto-pilot mode before requiring human intervention.
goal
string
default: "Assist customers with inquiries"
The goal of the agent.
personality
string
default: "Friendly and helpful"
Personality traits of the agent.
instructions
string
default: "Provide excellent customer service"
Instructions for the agent.
Array of knowledge base IDs associated with this agent.
Whether the bot sleeps on manual outbound messages.
Whether the bot sleeps on workflow outbound messages.
{
"id" : "emp_123" ,
"name" : "John Doe" ,
"businessName" : "Tech Corp" ,
"mode" : "auto-pilot" ,
"channels" : [
"SMS" ,
"Live_Chat"
],
"waitTime" : 30 ,
"waitTimeUnit" : "seconds" ,
"sleepEnabled" : false ,
"sleepTime" : 2 ,
"sleepTimeUnit" : "hours" ,
"actions" : [
{
"id" : "actionId123" ,
"type" : "triggerWorkflow"
}
],
"isPrimary" : false ,
"autoPilotMaxMessages" : 25 ,
"goal" : "Assist customers with inquiries" ,
"personality" : "Friendly and helpful" ,
"instructions" : "Provide excellent customer service" ,
"knowledgeBaseIds" : [
"kb_123" ,
"kb_456"
],
"sleepOnManualMessage" : false ,
"sleepOnWorkflowMessage" : false
}
422 - Unprocessable Entity
Ejemplo
curl -X POST 'https://services.leadconnectorhq.com/conversation-ai/agents' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"name": "John Doe",
"businessName": "Tech Corp",
"mode": "auto-pilot",
"channels": [
"SMS",
"Live_Chat",
"WhatsApp"
],
"isPrimary": true,
"waitTime": 2,
"waitTimeUnit": "seconds",
"sleepEnabled": false,
"sleepTime": 2,
"sleepTimeUnit": "hours",
"personality": "Friendly and helpful",
"goal": "Assist customers with inquiries.",
"instructions": "Provide customer service.",
"autoPilotMaxMessages": 75,
"knowledgeBaseIds": [
"string"
],
"respondToImages": true,
"respondToAudio": true,
"sleepOnManualMessage": false,
"sleepOnWorkflowMessage": false
}'
const response = await fetch ( 'https://services.leadconnectorhq.com/conversation-ai/agents' , {
method: 'POST' ,
headers: {
Authorization: `Bearer ${ process . env . LEADWAY_TOKEN } ` ,
Version: '2021-07-28' ,
'Content-Type' : 'application/json' ,
},
body: JSON . stringify ({ "name" : "John Doe" , "businessName" : "Tech Corp" , "mode" : "auto-pilot" , "channels" : [ "SMS" , "Live_Chat" , "WhatsApp" ], "isPrimary" : true , "waitTime" : 2 , "waitTimeUnit" : "seconds" , "sleepEnabled" : false , "sleepTime" : 2 , "sleepTimeUnit" : "hours" , "personality" : "Friendly and helpful" , "goal" : "Assist customers with inquiries." , "instructions" : "Provide customer service." , "autoPilotMaxMessages" : 75 , "knowledgeBaseIds" : [ "string" ], "respondToImages" : true , "respondToAudio" : true , "sleepOnManualMessage" : false , "sleepOnWorkflowMessage" : false }),
});
const data = await response . json ();
import os, requests
response = requests.request(
'POST' ,
'https://services.leadconnectorhq.com/conversation-ai/agents' ,
headers = {
'Authorization' : f "Bearer { os.environ[ 'LEADWAY_TOKEN' ] } " ,
'Version' : '2021-07-28' ,
'Content-Type' : 'application/json' ,
},
json = { "name" : "John Doe" , "businessName" : "Tech Corp" , "mode" : "auto-pilot" , "channels" : [ "SMS" , "Live_Chat" , "WhatsApp" ], "isPrimary" : true, "waitTime" : 2 , "waitTimeUnit" : "seconds" , "sleepEnabled" : false, "sleepTime" : 2 , "sleepTimeUnit" : "hours" , "personality" : "Friendly and helpful" , "goal" : "Assist customers with inquiries." , "instructions" : "Provide customer service." , "autoPilotMaxMessages" : 75 , "knowledgeBaseIds" : [ "string" ], "respondToImages" : true, "respondToAudio" : true, "sleepOnManualMessage" : false, "sleepOnWorkflowMessage" : false},
)
data = response.json()
<? php
$ch = curl_init ( 'https://services.leadconnectorhq.com/conversation-ai/agents' );
curl_setopt_array ( $ch , [
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv ( 'LEADWAY_TOKEN' ),
'Version: 2021-07-28' ,
'Content-Type: application/json' ,
],
CURLOPT_POSTFIELDS => json_encode ({ 'name' : 'John Doe' , 'businessName' : 'Tech Corp' , 'mode' : 'auto-pilot' , 'channels' : [ 'SMS' , 'Live_Chat' , 'WhatsApp' ], 'isPrimary' : true , 'waitTime' : 2 , 'waitTimeUnit' : 'seconds' , 'sleepEnabled' : false , 'sleepTime' : 2 , 'sleepTimeUnit' : 'hours' , 'personality' : 'Friendly and helpful' , 'goal' : 'Assist customers with inquiries.' , 'instructions' : 'Provide customer service.' , 'autoPilotMaxMessages' : 75 , 'knowledgeBaseIds' : [ 'string' ], 'respondToImages' : true , 'respondToAudio' : true , 'sleepOnManualMessage' : false , 'sleepOnWorkflowMessage' : false }),
]);
$data = json_decode ( curl_exec ( $ch ), true );