Delivery and events

Webhooks

Get every message's status on every channel posted to your server, signed and retried.

Ghala posts events to your HTTPS endpoints: a message changing status on any channel, a message a person sent you, a top-up landing.

Add an endpoint

In the dashboard, open Developers, then Webhooks, and add your endpoint's URL with the events it should receive. Its signing secret, starting whsec_, is shown once: keep it on your server.

  • Owners and admins manage endpoints. No API key can, so a leaked key cannot redirect your events.
  • A workspace has up to 10 endpoints.
  • In production an endpoint must be HTTPS on a public address.

Events

EventWhen
message.queuedGhala has the message; not yet with the network
message.sentthe network accepted it
message.deliveredthe network confirmed delivery
message.readthe person opened it, on channels that report it (WhatsApp, Instagram). A read that skipped delivered sends message.delivered first
message.failedcertainly not delivered
message.expiredit ran out of time before delivery
message.unknownthe network may have taken it without saying so
message.receiveda person sent your workspace a message
wallet.topped_upa top-up landed in your wallet

A delivery

POST /your/endpoint
Content-Type: application/json
User-Agent: Ghala-Webhooks/1.0
X-Ghala-Event: message.delivered
X-Ghala-Delivery: 4b65e28e-7b5b-41ab-bd1c-618fbb7adc58
X-Ghala-Timestamp: 1764352602
X-Ghala-Signature: sha256=5d0c...
{
  "event": "message.delivered",
  "occurred_at": "2026-11-28T17:54:53.338Z",
  "data": {
    "id": "beed6233-06e0-4805-aba8-c506fe88ab88",
    "status": "delivered",
    "channel": "sms",
    "to": "255700000001",
    "campaign_id": null,
    "conversation_id": null,
    "error": null,
    "failure_reason": null,
    "read_at": null,
    "test": true
  }
}

data.id is the message's id, the one the send answered with. test is true for a message sent with a test key.

message.received carries who wrote (from), your number or handle (to) and the text (body).

Check the signature

X-Ghala-Signature is sha256= followed by the hex HMAC-SHA256 of {timestamp}.{raw body}, keyed with the endpoint's secret. Check it over the exact bytes you received, before parsing them, in constant time, and refuse a timestamp more than 300 seconds old.

import { createHmac, timingSafeEqual } from "node:crypto"

export function isFromGhala(rawBody, headers, secret) {
  const timestamp = headers["x-ghala-timestamp"]
  const signature = headers["x-ghala-signature"] ?? ""
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false
  const expected = "sha256=" + createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest("hex")
  return signature.length === expected.length && timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
}

Answer, retries and duplicates

  • Answer any 2xx within 10 seconds. Do the work after answering.
  • Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 7 hours, then given up. Redirects are not followed.
  • 20 failed attempts in a row switch the endpoint off. Switching it back on resumes the deliveries still pending.
  • Delivery is at least once and in no fixed order. Drop duplicates by X-Ghala-Delivery, which stays the same on every retry, and go by each message's status, not by the order events arrive.

In the dashboard each endpoint shows its deliveries, and you can send a test event or resend a delivery.

On this page