Skip to main content
AlonChat

Webhooks Overview

Send real-time event notifications to external systems when things happen in AlonChat

Webhooks let your AI agent notify external systems in real time when key events occur — new leads, bookings, orders, payments, and form submissions. Use them to integrate with CRMs, accounting, fulfillment, notification services, and custom apps.

Webhook settings are available on Business and Enterprise plans. Active trials may access gated features during the trial, subject to trial limits.


How Webhooks Work#

  1. You configure a webhook endpoint URL for your agent
  2. You select which event types to subscribe to
  3. When an event occurs, AlonChat sends an HTTP POST request to your endpoint
  4. Your endpoint verifies the signature and processes the event
  5. If delivery fails, AlonChat keeps retrying for about three hours

Creating a Webhook#

From the Dashboard#

  1. Go to your agent dashboard
  2. Click Settings > Webhooks
  3. Click Add Webhook
  4. Enter your endpoint URL (must be HTTPS)
  5. Select the events you want to receive
  6. Turn on Include file download links only if this endpoint should receive the photos and files customers send through Custom Forms
  7. Copy and securely store the signing secret
  8. Save

Managing webhooks needs Settings access plus Actions and CRM access, because deliveries can carry form submissions.

Via the API#

These management routes use a signed-in AlonChat session. A project API key cannot create or edit webhooks.

Endpoint: POST /api/agents/{agentId}/webhooks

json
{
  "name": "My CRM Integration",
  "endpoint_url": "https://your-server.com/webhooks/alonchat",
  "events": ["leads.submit", "order.confirmed"],
  "description": "Sync leads to CRM",
  "include_file_links": false,
  "custom_headers": {
    "X-Custom-Header": "value"
  }
}

Response:

json
{
  "id": "webhook-uuid",
  "secret_key": "a3f5c8d9e2b1f4a7c6d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}

Important: The secret_key is only returned once at creation time. Store it securely for signature verification. If lost, delete the webhook and create a new one.


Security#

AlonChat takes webhook security seriously with multiple layers of protection.

Signature Verification#

Every webhook request includes an HMAC-SHA256 signature so you can verify it came from AlonChat:

  • Header: x-alonchat-signature
  • Algorithm: HMAC-SHA256
  • Format: sha256=<hex_digest>
javascript
const crypto = require('crypto')

function verifySignature(rawBody, signature, secret) {
  const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(rawBody).digest('hex')

  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
}

See the Security guide for full verification examples in multiple languages.

Idempotency#

Each delivery includes an x-alonchat-delivery-id header. Use this to detect and deduplicate retried deliveries.

URL Validation#

  • HTTPS required — all webhook endpoints must use HTTPS (except localhost during development)
  • SSRF protection — AlonChat blocks delivery to private IP ranges and internal networks

Request Format#

All webhook requests are sent as HTTP POST with these headers:

HeaderValue
Content-Typeapplication/json
x-alonchat-signaturesha256=<hex_digest>
x-alonchat-delivery-idUnique delivery identifier. Live ids start with whd_.
x-alonchat-eventThe eventType for this delivery
User-AgentAlonChat-Webhooks/1.0

Plus any custom headers you configured.

Payload Structure#

json
{
  "eventType": "leads.submit",
  "chatbotId": "agent-uuid",
  "timestamp": "2026-03-15T12:00:00Z",
  "payload": {
    "conversationId": "conv-uuid",
    "customerEmail": "john@example.com",
    "customerName": "John Doe"
  }
}

The HMAC signature is computed over this entire JSON body. All timestamps are ISO 8601 format in UTC.


Available Events#

EventTrigger
leads.submitCustomer submits lead/contact details
message.sentAI sends a message
tool.executedAI action completes successfully
booking.createdA booking is created
booking.cancelledA booking is cancelled
booking.rescheduledA booking is moved to a new time
order.confirmedA customer confirms an order
custom_form.submittedA custom form is submitted
payment.proof_receivedA customer submits proof of payment
payment.verification_pendingA payment is awaiting approval
payment.verifiedA payment is approved
payment.rejectedA payment is rejected
record.createdA Data Log record is created
procedure.alert.createdA Procedure notifies someone while the AI continues
procedure.approval.requestedA Procedure pauses for approval
procedure.approval.resolvedA Procedure approval is approved or rejected
procedure.handoff.requestedA Procedure routes the conversation to a team
procedure.escalatedA Procedure reaches its fallback escalation

Subscribe to tool.executed for completed actions. action.executed is an older internal name and cannot be selected on a new webhook.

See Event Types for detailed payload examples.


Retry Policy#

Failed deliveries are retried automatically, up to 10 attempts in total. The wait between attempts starts at 30 seconds and doubles up to one hour, so a delivery keeps trying for about three hours, long enough to outlast a restart or short outage on your side.

A delivery is considered failed if your endpoint:

  • Returns a non-2xx HTTP status code
  • Does not respond within about 10 seconds
  • Is unreachable

After the final failed attempt, the delivery is marked as failed and logged. If a delivery fails inside AlonChat before it reaches you, for example while preparing file links, it is retried later without using up attempts or counting against your endpoint.

A redirect (3xx) is not followed. AlonChat treats it as a configuration error and stops that delivery without retrying, so register the endpoint's final URL. A URL AlonChat will not call, such as one that resolves to a private network, fails the same way.

Alert webhooks#

A webhook chosen as an alert destination, for example where payment proof or a team alert goes, receives the same signed POST with an x-alonchat-delivery-id that stays the same on every try. It is retried twice within a few seconds when your endpoint:

  • Does not respond within about 10 seconds, or is unreachable
  • Returns 404, 408, 409, 429, or any 5xx

Any other non-2xx response and any redirect end the delivery without a retry. The alert then shows that delivery as failed with the status your endpoint returned.

Repeated failures#

If an endpoint keeps failing, AlonChat pauses deliveries to it for a short time and then tries again. You can also turn the webhook off from the dashboard. Turning it off is separate from that temporary pause.


Managing Webhooks#

List Webhooks#

GET /api/agents/{agentId}/webhooks

Returns all webhooks for the agent. Secret keys are masked, and custom headers are listed by name only; their values are never returned.

json
{
  "webhooks": [
    {
      "id": "webhook-uuid",
      "name": "My CRM Integration",
      "endpoint_url": "https://your-server.com/webhooks/alonchat",
      "events": ["leads.submit"],
      "is_active": true,
      "include_file_links": false,
      "secret_key_preview": "sk_...a9b0c1",
      "custom_header_names": ["X-Custom-Header"],
      "created_at": "2026-01-15T00:00:00Z"
    }
  ]
}

Update Webhook#

PATCH /api/agents/{agentId}/webhooks/{webhookId}

Update the name, endpoint URL, events, description, active state, or include_file_links. Fields you leave out keep their saved values, so two people editing different settings do not undo each other. Change custom headers with custom_headers_update: set adds or replaces headers by name, and remove deletes them. Headers you leave out keep their saved values, except when the request changes endpoint_url: saved header values are never sent to a new URL, so only the headers you set in that same request are kept. The response lists the dropped headers in cleared_custom_header_names.

A request that sets header values must include expected_endpoint_url, the endpoint URL you last read. If the webhook's URL has changed since then, the request fails with 409 and nothing is saved, so a credential is never applied to a URL you did not see. Header values must be valid HTTP header values: no line breaks or other control characters except tab, and no characters beyond Latin-1.

json
{
  "expected_endpoint_url": "https://your-server.com/webhooks/alonchat",
  "custom_headers_update": {
    "set": { "X-Custom-Header": "new-value" },
    "remove": ["X-Old-Header"]
  }
}

Delete Webhook#

DELETE /api/agents/{agentId}/webhooks/{webhookId}

Permanently removes the webhook. In-flight deliveries may still complete.

Test Webhook#

POST /api/agents/{agentId}/webhooks/{webhookId}/test

Sends a sample event immediately so you can verify the endpoint. A test delivery id starts with test_. Some sample payloads include _test: true inside payload; do not rely on a top-level "test": true field.


Webhook Logs#

View delivery history and debug failures from the dashboard or API:

GET /api/agents/{agentId}/webhooks/{webhookId}/logs

Each log entry includes:

  • Event type and timestamp
  • HTTP status code returned by your endpoint
  • Response time
  • Whether the delivery succeeded or failed
  • Number of retry attempts

Best Practices#

  1. Respond quickly — return a 200 status as fast as possible, then process the event asynchronously.
  2. Implement idempotency — use the x-alonchat-delivery-id header to handle duplicate deliveries.
  3. Verify signatures — always validate the x-alonchat-signature header before processing.
  4. Subscribe selectively — only subscribe to events you need. This reduces traffic and processing overhead.
  5. Monitor your logs — check webhook delivery logs regularly to catch failures early.

Next Steps#

  • Event Types — Detailed payload examples for every event
  • Security — Signature verification in multiple languages
  • Examples — Real-world integration recipes