Webhooks

Pigeon POSTs to your endpoint when somebody replies and when a message you sent changes state. Every delivery is signed, retried with backoff, and replayable from the console if your server was down.

Events

EventWhen
message.receivedSomebody sent you a message.
message.sentA message left for the provider.
message.deliveredIt reached the handset.
message.readThey opened it, if read receipts are on.
message.failedIt will not be delivered. data.failure_reason says why.

An endpoint with no events listed receives all of them, which is what most people want on their first endpoint.

The payload

POST to your endpoint
{
  "event": "message.received",
  "event_id": "01a211ac-f191-7a27-a0fa-7817681a2175",
  "project_id": "proj_01h9",
  "data": {
    "id": "01a211ac-f174-74fb-9e00-e692b03f612f",
    "channel_id": "ch_01h9",
    "direction": "inbound",
    "from": "+256700000321",
    "to": "+256771111111",
    "type": "text",
    "body": "Yes, that works",
    "status": "delivered",
    "environment": "live",
    "created_at": "2026-11-25T10:47:56Z"
  }
}

The body never names a provider. There is no session id, no gateway reference and no wamid: the same message looks identical whether it went through a self-hosted gateway or Meta's Cloud API, so swapping providers does not change a line of your code.

Verifying a delivery

Every request carries these headers:

HeaderWhat it is
Pigeon-SignatureHMAC-SHA256, hex, prefixed sha256=
Pigeon-TimestampUnix seconds, and it is signed too
Pigeon-EventThe event name
Pigeon-Delivery-IdThis attempt. Different every time.
Go
http.Handle("/webhooks/pigeon", pigeon.WebhookHandler(secret,
    func(w http.ResponseWriter, e *pigeon.WebhookEvent) {
        switch e.Event {
        case pigeon.EventMessageReceived:
            log.Printf("%s said %q", e.Data.From, e.Data.Body)
        case pigeon.EventMessageDelivered:
            log.Printf("%s reached the handset", e.Data.ID)
        }
        w.WriteHeader(http.StatusOK)
    }))

If you are verifying by hand, the signature is:

The construction
// signed = HMAC-SHA256(secret, "<timestamp>.<raw body>")
mac := hmac.New(sha256.New, []byte(secret))
fmt.Fprintf(mac, "%d.", timestamp)
mac.Write(rawBody)
expected := "sha256=" + hex.EncodeToString(mac.Sum(nil))

hmac.Equal([]byte(expected), []byte(receivedSignature))
Node
import crypto from "node:crypto";

function verify(secret, headers, rawBody) {
  const ts = headers["pigeon-timestamp"];
  const mac = crypto.createHmac("sha256", secret);
  mac.update(`${ts}.`);
  mac.update(rawBody);               // the exact bytes received
  const expected = "sha256=" + mac.digest("hex");

  return crypto.timingSafeEqual(
    Buffer.from(expected),
    Buffer.from(headers["pigeon-signature"]),
  );
}

The timestamp is signed along with the body and checked against a five-minute tolerance. Signing the body alone would let anyone who ever captured one valid delivery replay it forever.

Deduplicating

Delivery is at-least-once, so the same event can arrive twice. Deduplicate on event_id, which identifies what happened and is stable across retries and replays. Pigeon-Delivery-Id identifies the attempt and is different every time, including for a replay, which makes it useful in logs and wrong for this.

Retries, and replay

Anything that is not a 2xx is retried with exponential backoff. A 4xx is parked immediately rather than retried twelve times: your server understood and refused, and repeating it only fills your logs.

Every attempt is recorded. If your endpoint was down, the failures are in the console with the reason, and Replay re-sends one — to that endpoint only, not to every endpoint on the project. The original attempt stays as evidence, so three replays read as three attempts.