This guide will walk you through setting up and using webhooks with atoms.
Setting Up Webhooks
Step 1: Add a Webhook
- Navigate to your dashboard
- Go to the “Webhook” section
- Click on “Create”
- Enter your webhook URL where you want to receive events
- (Optional) Add a small description
- Click “Add endpoint” to create your webhook
Step 2: Attach Webhook to Your Agent
- Go to your agent’s configuration page
- Press the “add webhook” button
- Select the webhook url from dropdown and choose which events you want to receive
- Save your changes
You should start recieving events on your agent calls. You can check all webhook events directly from your dashboard.
Webhook Event Types
Your webhook will receive the following types of events:
pre-conversation
: When an agent call begins
post-conversation
: When an agent call completes
Each webhook event includes different data based on the event type. You can view the payload for each event type below:
{
"url": "https://webhook-test.com/abc123",
"description": "test webhook",
"event": "agent123.pre-conversation",
"metadata": {
"agentId": "agent123",
"eventType": "pre-conversation",
"conversationType": "telephonyOutbound",
"toPhone": "+1234567890",
"fromPhone": "+0987654321"
},
"id": "webhook123"
}
{
"url": "https://webhook-test.com/abc123",
"description": "test webhook",
"event": "agent123.pre-conversation",
"metadata": {
"agentId": "agent123",
"eventType": "pre-conversation",
"conversationType": "telephonyOutbound",
"toPhone": "+1234567890",
"fromPhone": "+0987654321"
},
"id": "webhook123"
}
{
"url": "https://webhook-test.com/abc123",
"description": "test webhook",
"event": "agent123.post-conversation",
"metadata": {
"agentId": "agent123",
"eventType": "post-conversation",
"conversationType": "telephonyOutbound",
"callData": {
"answer_time": "2024-03-21 10:00:01",
"call_direction": "outbound",
"call_duration": "30",
"call_state": "completed",
"end_time": "2024-03-21 10:00:31",
"from_number": "1234567890",
"hangup_cause_code": "4000",
"hangup_cause_name": "Normal Hangup",
"hangup_source": "API Request",
"initiation_time": "2024-03-21 10:00:00",
"to_number": "0987654321"
},
"logs": [
{
"id": "log123",
"role": "agent",
"timestamp": "2024-03-21T10:00:01Z",
"eventType": "agent",
"eventBody": "Hello, how can I help you today?",
"latency": 150
},
...
]
},
"id": "webhook123"
}