WAWaxiomatic

Webhooks

Subscribe to events from your Waxiomatic org and have us POST them to your endpoint. HMAC-signed, exponential-backoff retries on 5xx, full delivery log + manual replay in the dashboard.

Configure

Manage subscriptions at /dashboard/settings/webhooks. You pick the URL, the event list, and a secret (used for HMAC verification). Each delivery attempt is logged with status, payload, response, and timing.

Available events

EventWhen it fires
message.receivedIncoming message from a customer.
message.inboundAlias of message.received — subscribe to one or the other.
message.statusEvery outbound status transition (sent / delivered / read / failed).
message.outbound.deliveredNarrow alias — fires only on Meta-confirmed delivery / read.
message.outbound.failedNarrow alias — fires only on terminal outbound failure.
conversation.createdA new conversation thread starts.
conversation.assignedAgent (or null) assigned to a conversation.
conversation.statusConversation moves between open / closed / archived.
contact.createdA new contact lands in your CRM.
contact.updatedContact tags / attributes / consent change.
broadcast.completedA broadcast finishes (success + failure recipients all settled).
template.statusMeta approves / rejects / pauses / disables a template.
template.approvedNarrow alias — fires only on Meta approval.
template.rejectedNarrow alias — fires only on Meta rejection (payload includes reason).
subscription.invoice_issuedA new Waxiomatic invoice is issued for your subscription.

Payload format

{
  "id": "evt_01HZAB…",
  "event": "message.received",
  "createdAt": "2026-05-18T10:24:31.000Z",
  "organizationId": "org_…",
  "data": {
    "messageId": "wamid.…",
    "conversationId": "conv_…",
    "contactId": "contact_…",
    "from": "+919876543210",
    "to": "+919898989898",
    "type": "text",
    "text": "Hi, is the red shirt still in stock?"
  }
}

Verify the signature

Every webhook carries an X-Waxiomatic-Signature header in Stripe-style format: t=<unix-ts>,v1=<hex-hmac>. Recompute HMAC-SHA256(secret, `$${t}.$${rawBody}`)and constant-time-compare with the v1 value. Reject any request whose timestamp is more than 5 minutes off the current time (replay protection).

The same timestamp is also exposed as the standalone X-Waxiomatic-Timestamp header and the dedup key is in X-Waxiomatic-Idempotency-Key (always equal to the event id; safe to use as a Postgres unique-constraint anchor).

Node.js (Express)

import crypto from 'node:crypto';
import express from 'express';

const app = express();
const SECRET = process.env.WAXIOMATIC_WEBHOOK_SECRET!;

// IMPORTANT: bodyParser raw, NOT JSON — the signature is over the bytes
// exactly as we sent them, so any whitespace re-formatting breaks it.
app.post(
  '/waxiomatic/webhook',
  express.raw({ type: 'application/json' }),
  (req, res) => {
    const header = req.header('X-Waxiomatic-Signature') ?? '';
    const parts = Object.fromEntries(
      header.split(',').map((p) => p.split('=')),
    ) as { t?: string; v1?: string };
    if (!parts.t || !parts.v1) return res.sendStatus(400);

    const ts = Number(parts.t);
    if (!Number.isFinite(ts) || Math.abs(Date.now() / 1000 - ts) > 300) {
      return res.sendStatus(401); // skew too large — likely a replay
    }

    const signed = `${ts}.${req.body.toString('utf8')}`;
    const expected = crypto.createHmac('sha256', SECRET).update(signed).digest('hex');
    const ok =
      parts.v1.length === expected.length &&
      crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
    if (!ok) return res.sendStatus(401);

    // Dedup: insert the event_id into a unique index; ON CONFLICT DO NOTHING.
    const event = JSON.parse(req.body.toString('utf8'));
    void persistAndAck(event);
    res.sendStatus(200); // reply within 10s or we retry
  },
);

Python (FastAPI)

import hmac
import hashlib
import time
from fastapi import FastAPI, Header, HTTPException, Request

app = FastAPI()
SECRET = b"<your-webhook-secret>"

@app.post("/waxiomatic/webhook")
async def webhook(
    request: Request,
    x_waxiomatic_signature: str = Header(...),
    x_waxiomatic_idempotency_key: str = Header(...),
):
    # IMPORTANT: raw bytes — the signature is over the exact bytes we POSTed.
    raw = await request.body()

    parts = dict(p.split("=", 1) for p in x_waxiomatic_signature.split(","))
    try:
        ts = int(parts["t"])
        v1 = parts["v1"]
    except (KeyError, ValueError):
        raise HTTPException(status_code=400, detail="malformed signature")

    if abs(time.time() - ts) > 300:
        raise HTTPException(status_code=401, detail="timestamp skew")

    signed = f"{ts}.{raw.decode()}".encode()
    expected = hmac.new(SECRET, signed, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(v1, expected):
        raise HTTPException(status_code=401, detail="bad signature")

    # Dedup by x_waxiomatic_idempotency_key in your DB before processing.
    return {"ok": True}

Retries

We treat 2xx as success. 4xx as permanent failure (no retry — your endpoint deliberately rejected it). 5xx, 408, 429, and network timeouts trigger exponential backoff: 1m, 5m, 30m, 2h, 8h, 24h (6 attempts, ~35h total). After the last attempt the delivery is marked abandoned, the org owner gets an in-app notification, and the row stays replayable from the dashboard for 30 days.

Each retry sends a fresh X-Waxiomatic-Signature with a new timestamp — verify on every attempt, don't cache. The X-Waxiomatic-Idempotency-Key header stays stable across retries + manual replays so you can dedup safely.

Replay from the dashboard. Every delivery attempt is in the log. Click any failed delivery to resend it manually — useful when your endpoint had downtime and you want to backfill.