Skip to main content

Webhook Integration for Developers

Learn how to build production-ready webhook handlers to receive and process real-time call events from Hamsa voice agents.
Prerequisites:
  • Webhook URL configured in dashboard (Setup Guide)
  • Basic understanding of HTTP POST requests and JSON
  • Node.js, Python, or your preferred backend framework

Understanding Webhook Data

Custom Parameters (Echo Pattern)

The most powerful feature of Hamsa webhooks is the echo pattern. All custom parameters you send during agent initiation are echoed back in the webhook response. What You Send:
What You Receive in Webhook:
This pattern allows you to match webhook responses to your database records without maintaining state.

Event Structure

All webhook events follow this structure:

Call Ended Event (Most Important)

The call.ended event contains complete conversation data:

Implementing Webhook Handlers

Node.js/Express Implementation

Python/Flask Implementation

Advanced Topics

Async Processing with Queues

Always process webhooks asynchronously to avoid timeouts:

Idempotency

Prevent duplicate processing:

Error Handling

Comprehensive error handling:

Common Use Cases

CRM Integration

Notification System

Troubleshooting

Cannot Match Webhook to Record

Problem: Missing application_id in outcomeResult Solution:

Missing or Null Fields

Problem: Expected fields are null or undefined Solution:

Duplicate Events

Problem: Receiving same event multiple times Solution: Implement idempotency (see above section)

Testing

Local Testing with cURL

Monitoring

Next Steps

Configure Webhooks

Set up webhook URLs in the dashboard

Webhooks Overview

Learn webhook concepts and patterns

Outcomes Configuration

Configure what data to extract from calls

API Reference

Complete API documentation