---
title: Webhooks
description: Outbound events to your URL, signed with HMAC-SHA256 and a timestamp and retried 6 times. Planned for Phase 2.
status: Planned
---

**Status: planned (Phase 2).** Webhooks are how enquiries reach a CRM, a helpdesk, Slack or Zapier, Make and n8n. ContactUsIQ is not a CRM or a helpdesk; it forwards.

## Registering

Managed through `/v1/webhooks` (list, create, delete, `POST /{id}/test`) or the dashboard. A webhook has a customer URL, an HMAC secret, an event filter and a dead-letter counter. Plan limits: none on Free, 3 on Pro, unlimited on Business.

## Events

The event catalogue is published with the Phase 2 release. The domain events in the spec are the candidates, and the Zapier, Make and n8n triggers named in the spec are "new enquiry", "new theme" and "recommendation accepted":

| Domain event | Raised when |
| --- | --- |
| `SubmissionReceived`, `SubmissionAccepted`, `SubmissionRejected` | a submission is received, accepted or rejected |
| `NotificationScheduled`, `NotificationDelivered`, `NotificationBounced`, `NotificationComplained` | delivery progresses |
| `VisitorAckDelivered`, `VisitorAckBounced`, `SubmissionMarkedUnreachable` | the visitor acknowledgement resolves |
| `DomainVerified`, `DomainVerificationFailed` | a verification check completes |
| `SendingDomainHealthChanged` | a DKIM, SPF or DMARC check changes result |
| `QuotaWarning`, `QuotaExceeded` | usage reaches 80% or 100% of the plan |

Which of these are exposed to webhooks, and the payload shapes, are `TODO(spec)`.

## Signature

Every delivery is signed with HMAC-SHA256 over a timestamp and the raw request body, using the webhook's secret, and the timestamp is sent alongside the signature so a captured request cannot be replayed later. To verify:

1. Read the timestamp and signature from the request headers.
2. Reject the request if the timestamp is older than your tolerance (five minutes is usual).
3. Compute `HMAC_SHA256(secret, timestamp + "." + rawBody)` and compare it to the signature with a constant-time comparison.
4. Only then parse the body.

The header names and the exact signed string are `TODO(spec)` and will be fixed in openapi.yaml when the feature ships; the pattern above (timestamp plus raw body, constant-time comparison, replay window) is the design. Node.js sketch:

```js
import { createHmac, timingSafeEqual } from 'node:crypto';

export function verify(secret, timestamp, rawBody, signature) {
  const ageSeconds = Math.abs(Date.now() / 1000 - Number(timestamp));
  if (!Number.isFinite(ageSeconds) || ageSeconds > 300) return false;
  const expected = createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
  const a = Buffer.from(expected, 'hex');
  const b = Buffer.from(String(signature), 'hex');
  return a.length === b.length && timingSafeEqual(a, b);
}
```

Always verify against the raw body bytes, before any JSON parsing or re-serialisation.

## Retries

A delivery that does not get a `2xx` is retried 6 times. A webhook that keeps failing increments its dead-letter counter, and the dashboard shows it. Make your handler idempotent on the event id: retries can deliver the same event more than once.

## Respond fast

Return `2xx` as soon as the event is stored and do the work afterwards. Slow handlers hit the delivery timeout and are retried, which duplicates work.
