Skip to main content

Webhooks

Webhooks enable real-time notifications when events occur in MeetLoyd. Instead of polling the API, receive HTTP callbacks when agents complete tasks, conversations end, or workflows finish.

Why Webhooks?​

  • Real-time updates -- know immediately when events happen
  • Efficient -- no polling required
  • Reliable -- automatic retries on failure
  • Secure -- signature verification on every delivery

Available Events​

Webhooks use the same event catalog your agents react to. The tables below are a selection. Browse the full list in Automation → Event Catalog, or fetch it from GET /api/v1/events/catalog. It also covers projects, coding, governance, FinOps, skills, files and more. Subscribing to an event that is not in the catalog is refused.

CRM​

EventDescription
crm.lead.createdA new lead/contact was captured
crm.lead.qualifiedA lead crossed the qualification bar (MQL/SQL)
crm.deal.createdA new opportunity entered the pipeline
crm.deal.wonA deal was marked closed-won
crm.deal.lostA deal was marked closed-lost

Meetings​

EventDescription
meeting.bookedA meeting was booked/confirmed
meeting.rescheduledA booked meeting moved to a new time
meeting.cancelledA booked meeting was cancelled
meeting.completedA meeting took place

Billing​

EventDescription
billing.subscription.createdA subscription started
billing.subscription.cancelledA subscription was cancelled (churn)
billing.invoice.paidAn invoice was paid
billing.payment.failedA payment failed (dunning/at-risk)

Repositories​

EventDescription
repo.createdA new repository was created
repo.pr.openedA pull/merge request was opened
repo.pr.mergedA pull/merge request was merged
repo.deploy.failedA deploy failed

Support​

EventDescription
support.ticket.createdA support ticket was created
support.ticket.escalatedA ticket was escalated
support.csat.receivedA customer satisfaction response arrived

Platform & lifecycle​

EventDescription
agent.run.startedAn agent started a run
agent.run.completedAn agent finished a run
agent.run.failedAn agent run errored
agent.created / agent.updated / agent.deletedAgent CRUD
task.completedA task completed
conversation.created / conversation.startedA new conversation began
conversation.messageA message was added to a conversation
tool.executedAn agent executed a tool

Filtering Events​

Narrow a subscription to only the deliveries you care about with an optional payload filter — a set of key = value conditions matched against the event payload (every condition must match, or the delivery is skipped). For example, a webhook on crm.deal.won with the filter stage = enterprise fires only for enterprise deals. Filters are configured per-webhook in the Add/Edit Webhook dialog and shown as a chip on the webhook card.

Retry Policy​

Failed deliveries are retried automatically with exponential backoff — the delay before retry N is N² seconds (1s, 4s, 9s, …):

RetryDelay before it
1st retry (2nd attempt)1 second
2nd retry (3rd attempt)4 seconds
3rd retry (4th attempt)9 seconds

The number of attempts is the webhook's retry count (default 3, configurable 0–10). After the final attempt fails, the delivery is marked failed. A delivery fails on an HTTP status ≥ 400, a request timeout (default 30s, configurable up to 60s), or a network error.

Delivery Headers​

Every delivery includes these headers:

HeaderValue
X-Webhook-Signaturesha256=<hex> — HMAC-SHA256 of the raw request body using your webhook secret
X-Webhook-TimestampISO 8601 send time
X-Webhook-EventThe event id (e.g. crm.deal.won)
X-Webhook-IdUnique delivery id — use it for idempotency
Always Verify

Never process a webhook without verifying the X-Webhook-Signature first. This prevents spoofed requests from being processed.

Creating Webhooks​

From the Dashboard​

  1. Go to Automation → Webhooks
  2. Click Add Webhook
  3. Enter your endpoint URL
  4. Search and select events to subscribe to (grouped by capability)
  5. (Optional) Add payload filter conditions to narrow which deliveries fire
  6. Click Create Webhook
  7. Copy the webhook secret for signature verification

Webhook Payload​

Every delivery's JSON body has this shape:

FieldDescription
eventEvent id (e.g., crm.deal.won)
timestampISO 8601 timestamp
dataEvent-specific payload (fields vary by event)

The unique delivery id for idempotency is the X-Webhook-Id header — not a body field.

Verifying the Signature​

Verify every delivery before processing it:

  1. Read the X-Webhook-Signature header — its value is sha256=<hex>.
  2. Compute HMAC-SHA256(rawRequestBody, webhookSecret) and hex-encode it.
  3. Compare your digest to the hex after sha256= using a constant-time comparison; reject on mismatch.
  4. Optionally reject deliveries whose X-Webhook-Timestamp is older than a few minutes to limit replay.

Sign over the raw body bytes exactly as received — re-serializing the parsed JSON can change key order or whitespace and break the comparison. (The signature covers the body alone, not the timestamp.)

Managing Webhooks​

From the dashboard, you can view all webhooks, change their event subscriptions, turn them on and off, and view their delivery history. To change a webhook's secret, create a new webhook and delete the old one.

Delivery History​

Each webhook shows its recent delivery history including timestamp, event type, response status, response body, and duration. Use this to debug failed deliveries.

Testing Webhooks​

Send a Test Event​

Send a sample event to your endpoint with POST /api/v1/webhooks/:id/test, then check the delivery in the webhook's history.

Local Development​

Use a tunneling service like ngrok for local development:

  1. Start your local server
  2. Run ngrok http 3000 to get a public URL
  3. Use the ngrok URL as your webhook endpoint
  4. Test with real or sample events

Best Practices​

  1. Verify signatures -- always verify to prevent spoofing
  2. Respond quickly -- return 200 immediately, process asynchronously
  3. Handle duplicates -- use the X-Webhook-Id header for idempotency; webhooks may be delivered more than once
  4. Monitor health -- set up alerts for high failure rates or elevated latency
  5. Use specific events -- subscribe only to events you need; avoid subscribing to everything

Next: Explore the Tasks API for background work.