Create a new action for a voice AI agent. Actions define specific behaviors and capabilities for the agent during calls.
POST https://services.leadconnectorhq.com/voice-ai/actions
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
agentId
string
default:"507f1f77bcf86cd799439011"
required
Agent ID to attach the action to
locationId
string
default:"507f1f77bcf86cd799439012"
required
Account ID
actionType
string
default:"CALL_TRANSFER"
required
Type of action Posibles valores: ‘CALL_TRANSFER’, ‘DATA_EXTRACTION’, ‘IN_CALL_DATA_EXTRACTION’, ‘WORKFLOW_TRIGGER’, ‘SMS’, ‘APPOINTMENT_BOOKING’, ‘CUSTOM_ACTION’, ‘KNOWLEDGE_BASE’
name
string
default:"Transfer to Manager"
required
Human-readable name for this action
Action parameters - structure varies by actionType
Respuestas
201 - Action created successfully
id
string
default:"507f1f77bcf86cd799439011"
required
Unique identifier for the created action
actionType
string
default:"CALL_TRANSFER"
required
Type of action Posibles valores: ‘CALL_TRANSFER’, ‘DATA_EXTRACTION’, ‘IN_CALL_DATA_EXTRACTION’, ‘WORKFLOW_TRIGGER’, ‘SMS’, ‘APPOINTMENT_BOOKING’, ‘CUSTOM_ACTION’, ‘KNOWLEDGE_BASE’
name
string
default:"Transfer to Manager"
required
Human-readable name for this action
Action parameters - structure varies by actionType
{
"id": "507f1f77bcf86cd799439011",
"actionType": "CALL_TRANSFER",
"name": "Transfer to Manager"
}
422 - Unprocessable Entity
Ejemplo
curl -X POST 'https://services.leadconnectorhq.com/voice-ai/actions' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"agentId": "507f1f77bcf86cd799439011",
"locationId": "507f1f77bcf86cd799439012",
"actionType": "CALL_TRANSFER",
"name": "Transfer to Manager"
}'
const response = await fetch('https://services.leadconnectorhq.com/voice-ai/actions', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"agentId": "507f1f77bcf86cd799439011", "locationId": "507f1f77bcf86cd799439012", "actionType": "CALL_TRANSFER", "name": "Transfer to Manager"}),
});
const data = await response.json();
import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/voice-ai/actions',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"agentId": "507f1f77bcf86cd799439011", "locationId": "507f1f77bcf86cd799439012", "actionType": "CALL_TRANSFER", "name": "Transfer to Manager"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/voice-ai/actions');
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({'agentId': '507f1f77bcf86cd799439011', 'locationId': '507f1f77bcf86cd799439012', 'actionType': 'CALL_TRANSFER', 'name': 'Transfer to Manager'}),
]);
$data = json_decode(curl_exec($ch), true);