Custom Agents
Developers

Webhooks

Real-time event notifications for messages, contacts, and agent activity.

Overview

Webhooks allow you to receive real-time notifications when events happen in your Custom Agents account. Configure a URL endpoint and select the events you want to receive.

Events

EventDescription
message.receivedA new message was received by an agent
message.sentAn agent sent a message
message.draftedAn agent drafted a message for review
contact.createdA new contact was added to the CRM
contact.updatedA contact's information was updated
escalation.triggeredAn escalation rule was triggered
agent.updatedAn agent's configuration was changed

Payload format

{
  "event": "message.received",
  "timestamp": "2025-01-15T10:30:00Z",
  "data": {
    "messageId": "msg_xyz789",
    "agentId": "agent_abc123",
    "from": "customer@example.com",
    "subject": "Question about my order",
    "body": "Hi, I was wondering about the status of...",
    "threadId": "thread_def456"
  }
}

Setup

Via API

POST /v1/webhooks
{
  "url": "https://yourapp.com/webhook",
  "events": ["message.received", "message.sent", "escalation.triggered"],
  "secret": "your-webhook-secret"
}

Verification

All webhook payloads include an X-CustomAgents-Signature header. Verify the signature using your webhook secret to ensure the request came from Custom Agents.

import crypto from 'crypto';

function verifyWebhook(payload: string, signature: string, secret: string): boolean {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}

Connect your systems

Receive real-time events from your AI agents via webhooks.