Developers

Webhooks: real-time events

Updated 13 November 2026

Webhooks let Baat notify your systems the instant something happens — a contact is created, a conversation opens or closes, or a customer submits a WhatsApp Flow form. Instead of polling the API, you register a URL and Baat POSTs the event to it in real time. Manage them under Settings → Developers → Webhooks.

Webhooks are part of the Business plan, and you can try them during the free trial.

Creating a webhook

Click Add webhook and provide:

  • Name — e.g. CRM contact sync.

  • Endpoint URL — the URL Baat will POST to, such as https://yourapp.com/webhooks/baat. Use HTTPS: Baat does not check this for you, and the events carry customer details.

  • Event — which event this endpoint subscribes to (one event per webhook).

  • Custom auth header (optional) — a header name/value pair Baat adds to each delivery, so your endpoint can authenticate the caller (e.g. Authorization: Bearer …).

On creation Baat generates a signing secret and shows it once. Copy it into your secret store immediately — you’ll use it to verify that incoming requests genuinely came from Baat.

Available events

EventFires when…
contact.createdA new contact is added to your organization.
contact.updatedA contact is saved again, for example when its tags or details change. It can also fire when nothing visible changed, such as when the API sends a contact that already exists.
conversation.openedA conversation is opened or re-opened.
conversation.closedA conversation is closed.
flow_response.submittedA customer submits a WhatsApp Flow form.

Payload format

Baat sends a JSON POST with Content-Type: application/json. The body looks like:

{
  "event": "contact.created",
  "occurred_at": "2026-05-31T09:15:42Z",
  "organization_id": 4567,
  "data": {
    "...": "the full entity that triggered the event"
  }
}
FieldDescription
eventThe event key, e.g. contact.created.
occurred_atISO-8601 UTC timestamp of when the event happened.
organization_idYour Baat organization ID.
dataThe entity snapshot (the contact, conversation or flow response).

Inside data, field names differ by event. Contact and conversation events use camelCase, such as phone and createdAt. flow_response.submitted uses snake_case: flow_id, flow_name, contact_id, conversation_id, flow_token, submitted_at and response.

Verifying the signature

Every delivery carries an X-Baat-Signature header so you can confirm the request is authentic and untampered. The value is an HMAC-SHA256 of the raw request body, keyed with your signing secret, hex-encoded and prefixed with sha256=:

X-Baat-Signature: sha256=4f1e2d…

To verify, compute the same HMAC over the raw body and compare. Node.js example:

const crypto = require("crypto");

// Use the raw, unparsed request body (e.g. express.raw())
function verifyBaatSignature(rawBody, headerValue, signingSecret) {
  const expected =
    "sha256=" +
    crypto.createHmac("sha256", signingSecret)
          .update(rawBody, "utf8")
          .digest("hex");
  // constant-time compare
  const a = Buffer.from(headerValue || "");
  const b = Buffer.from(expected);
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

app.post("/webhooks/baat", express.raw({ type: "application/json" }), (req, res) => {
  const sig = req.header("X-Baat-Signature");
  if (!verifyBaatSignature(req.body, sig, process.env.BAAT_WEBHOOK_SECRET)) {
    return res.status(401).send("bad signature");
  }
  const event = JSON.parse(req.body.toString("utf8"));
  // …handle event…
  res.sendStatus(200);
});

Compute the HMAC over the exact bytes Baat sent. If your framework re-serializes the JSON before you hash it, whitespace or key-order differences will break the comparison — always hash the raw body.

Responding and retries

Return a 2xx status within a few seconds to acknowledge the event, and do any slow work afterwards. If your endpoint returns an error or cannot be reached, Baat tries again. It makes up to 8 attempts, waiting longer each time:

AttemptWait before this attemptRoughly this long after the event
1—within a minute
210 minutes10 minutes
31 hour1 hour 10 minutes
46 hours7 hours
512 hours19 hours
624 hours2 days
74 days6 days
87 days13 days

After the eighth failed attempt the delivery is marked Failed, and Baat shows a “Webhook delivery failing” alert in your account.

An event can reach you more than once, and deliveries carry no unique event ID, so make your handler safe to run twice: for example, ignore an event whose entity ID and occurred_at you have already handled.

Inspecting deliveries — Logs & usage

The Logs & usage tab records every delivery attempt so you can debug integrations without adding logging on your side.

ColumnMeaning
EventWhich event fired.
EndpointThe URL Baat called.
StatusSuccess, Failed, or Pending (awaiting a retry).
AttemptsHow many delivery attempts have been made.
ErrorThe last error returned by your endpoint, if any.
Fired atWhen the event happened and was queued for delivery.

Enabling, disabling & deleting

Use the ⋮ menu on a webhook row to Disable it, which stops new events but keeps its settings and secret, or to Delete it for good. Re-enable a disabled webhook from the same menu.

Disabling stops new events only. Deliveries already queued, including their retries, still go to the saved URL. If an endpoint has been compromised, change it on your side too.

Related reading

Where this fits in the wider picture.

Need a hand?

Our team answers on WhatsApp, usually within a business day.

Contact support Book a demo