Skip to main content
Creates and attach a new action for an AI agent. Actions define specific tasks or behaviors that the agent can perform, such as booking appointments, sending follow-ups, or collecting information.
POST https://services.leadconnectorhq.com/conversation-ai/agents/{agentId}/actions

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Path parameters

agentId
string
required

Body

type
string
default:"triggerWorkflow"
required
Posibles valores: ‘triggerWorkflow’, ‘updateContactField’, ‘appointmentBooking’, ‘stopBot’, ‘humanHandOver’, ‘advancedFollowup’, ‘transferBot’
name
string
default:"Trigger a Workflow"
required
details
object
required
Action-specific details. The structure depends on the action type. For TRIGGER_WORKFLOW use triggerWorkflowDto, for UPDATE_CONTACT_FIELD use updateContactFieldDto, for APPOINTMENT_BOOKING use appointmentBookingDto, for STOP_BOT use stopBotDto, for HUMAN_HAND_OVER use humanHandOverDto, for ADVANCED_FOLLOWUP use advancedFollowupDto, and for TRANSFER_BOT use transferBotDto.

Respuestas

data
object
required
Created action details
success
boolean
default:"True"
required
Success status of the request
{
  "success": true
}
{}
{}
{}

Ejemplo

curl -X POST 'https://services.leadconnectorhq.com/conversation-ai/agents/YOUR_agentId/actions' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "type": "triggerWorkflow",
  "name": "Trigger a Workflow"
}'
const response = await fetch('https://services.leadconnectorhq.com/conversation-ai/agents/YOUR_agentId/actions', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"type": "triggerWorkflow", "name": "Trigger a Workflow"}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'POST',
    'https://services.leadconnectorhq.com/conversation-ai/agents/YOUR_agentId/actions',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"type": "triggerWorkflow", "name": "Trigger a Workflow"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/conversation-ai/agents/YOUR_agentId/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({'type': 'triggerWorkflow', 'name': 'Trigger a Workflow'}),
]);
$data = json_decode(curl_exec($ch), true);