Confirm this change

Webhooks & events 2 min read

Webhooks and verification

Receive and verify inbound messages and delivery updates.

On this page

Configure an endpoint

In Dashboard → Platform → Webhooks, add a public HTTPS receiver and subscribe to the events you need. Use message.inbound, message.sent, message.delivered, message.read and message.failed for chat. Wildcards such as message.* and * are supported. Store the endpoint signing secret securely. Keep the Meta callback /api/webhook separate: it is the provider’s signed callback, not your integration webhook receiver.

Event envelope

Example
{"id":"evt_example","object":"event","api_version":"2026-06-27","type":"message.inbound","created":"2026-11-25T09:00:00.000Z","workspace_id":"workspace-id","data":{"object":{"message":{"messageId":"wamid.example","from":"919876543210","to":"123456789012345","type":"text","status":"received","content":{"text":"Hello","direction":"inbound"}}}}}

Verify before processing

Read the exact raw request bytes before any JSON middleware transforms them. x-meshdex-signature has t=<unix-seconds>,v1=<hex>. Compute HMAC-SHA256 using the signing secret over the ASCII timestamp, a dot, and the original body bytes. Compare equal-length digest buffers with a timing-safe comparison. Reject malformed signatures and timestamps outside your tolerance (for example 300 seconds). Parse JSON only after verification. Do not verify by reserializing the parsed JSON.

Node.js verification

Example
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(rawBody, signature, secret, now = Date.now()) {
  const match = /^t=(\d+),v1=([a-f0-9]{64})$/.exec(signature || '');
  if (!match || Math.abs(now / 1000 - Number(match[1])) > 300) return false;
  const expected = createHmac('sha256', secret)
    .update(match[1] + '.').update(rawBody).digest();
  const received = Buffer.from(match[2], 'hex');
  return received.length === expected.length && timingSafeEqual(received, expected);
}

Headers and rotation

x-meshdex-event-id identifies the logical event; x-meshdex-webhook-id identifies a delivery; x-meshdex-event describes its type; x-meshdex-delivery-attempt starts at 1; x-meshdex-idempotency-key identifies the delivery operation. During secret rotation x-meshdex-signature-previous may be present. Verify against the intended current/previous secret during your rotation overlap. Legacy x-webhook-signature signs only the body; prefer the timestamped signature.

Acknowledgement and retries

After verifying and durably enqueueing the event, return a 2xx promptly. The default receiver timeout is 8 seconds (configurable per endpoint). Up to 6 attempts use delays of 60 seconds, 5 minutes, 15 minutes, 1 hour and 6 hours after failures; worker scheduling and rate limits may delay delivery further. Delivery is at least once and order is not guaranteed. Deduplicate by event ID, including manual replays, and avoid regressing read/delivered states when older events arrive. Review failed attempts and manually replay eligible terminal failures in Platform → Delivery logs.

Event families

Messages: message.sent, message.delivered, message.read, message.failed, message.inbound. Contacts: contact.created, contact.updated. Consent: optin.created, optout.created, optout.restored, optout.permanent. Templates: template.created, template.updated, template.approved, template.rejected. Connection: whatsapp.connected, whatsapp.approved. Billing: billing.low_credit, billing.payment_received, billing.renewal_notice, billing.usage_settled, billing.usage_released, billing.quota_warning. conversation.created and conversation.updated are selectable catalog entries; integrations should rely on message.inbound for incoming chat activity.

Need help with this guide? Contact support