Configuring Webhooks
Learn how to configure webhook endpoints for your AI agents to receive real-time call events and conversation data.What are Webhooks?
Webhooks allow your applications to receive real-time notifications about call events, transcriptions, and conversation outcomes. When a voice call completes or specific events occur, Hamsa sends HTTP POST requests to your configured endpoint with relevant data.Real-time Events
Instant notifications as calls progress, from start to completion
Call Data
Full transcripts, recordings, and extracted information
Custom Parameters
Pass ANY custom data that gets echoed back for identification
Secure Delivery
HTTPS-only with Bearer token authentication support
Prerequisites
Before setting up webhooks, ensure you have:A publicly accessible server
Your webhook endpoint must be reachable from the internet. Use ngrok for local development.
Webhook URL Requirements
Valid Examples:Local Development Setup
For local development, use ngrok to expose your localhost:Authentication Options
Option 1: No Authentication (Development Only)
Use for development or testing:Option 2: Bearer Token Authentication (Recommended)
Use for production environments:- Must include the word “Bearer” followed by your token
- Example:
Bearer sk_live_abc123xyz789 - Token should be long and randomly generated
- Never commit tokens to source control
Adding Webhook to Your Agent
Webhooks are configured per agent. Each agent can have its own webhook URL and authentication settings.
Event Types
Your webhook receives various events throughout a call’s lifecycle:| Event | When It Fires | Contains |
|---|---|---|
| call.started | Call begins | Caller info, timestamp, custom params |
| call.answered | Call connected | Connection details, ring duration |
| transcription.update | User/agent speaks | Real-time text, speaker identification |
| tool.executed | Agent uses a tool | Tool name, input, output, duration |
| call.ended | Call completes | Full transcript, recording, outcome data |
Testing Your Webhook
Test with cURL
Test from Dashboard
- Configure your webhook URL and authentication
- Save your agent configuration
- Make a test call to your agent
- Monitor your webhook endpoint for incoming events
- Verify you receive the
call.endedevent with full data
Common Issues
Webhook Not Receiving Data
Possible Causes:- Webhook URL is not publicly accessible
- Webhook URL not configured in Hamsa dashboard
- Firewall/security rules blocking POST requests
- Server not running or crashed
- HTTPS certificate invalid
Authentication Failures
Possible Causes:- Bearer token mismatch
- Token format incorrect (missing “Bearer” prefix)
- Token changed in dashboard but not in code
- Verify token format:
Bearer sk_live_abc123xyz789 - Ensure token matches exactly between dashboard and your code
- Check for extra spaces or formatting issues
Next Steps
Now that you’ve configured webhooks in the dashboard, learn how to implement webhook handlers:Build Webhook Handlers
Complete guide to implementing webhook endpoints and processing events
Webhooks Feature Overview
Learn about webhook concepts and patterns
Outcomes Configuration
Configure what data your agent extracts
Testing Webhooks
Test your webhook integration
Best Practices
Security- Always use HTTPS endpoints in production
- Implement Bearer token authentication
- Rotate tokens periodically
- Never commit tokens to source control
- Store tokens in environment variables or secret managers
- Ensure your webhook endpoint returns 200 OK within 5 seconds
- Implement proper error handling
- Use async processing for time-consuming operations
- Monitor webhook delivery and processing
- Test webhook configuration before going live
- Verify all event types are received correctly
- Test with various call scenarios
- Monitor webhook logs during initial deployment