Browse the docs

API

Webhook

The webhook sends new messages from your contacts, and delivery updates on messages your business sent, to an address on your server as they happen. It saves you asking the api over and over.

Set the address

Only admins can set the webhook.

  1. Open Settings, and in the Api panel click Keys and webhook.
  2. Under Webhook, fill in Address: a full address starting with https://, on a server anyone can reach.
  3. Tick Send events to it.
  4. Click Save.

Once an address is saved, the panel shows the Signing secret (with Copy) and Last delivery, which says whether the last event arrived. Untick Send events to it and save to pause the webhook without losing the address.

The events

Each event is a POST with a JSON body:

eventSent when
message.receivedA contact sends your business a message
message.statusA message your business sent changes status (sent, delivered, read or failed)
testYou click Send a test event
{
  "event": "message.received",
  "sentAt": "2026-11-27T10:15:02.000Z",
  "message": {
    "id": "6f1c2a4e-8b1d-4c55-9a0e-2d7f1b3c9e10",
    "direction": "inbound",
    "channel": "whatsapp",
    "contact": {
      "id": "b2e4d6f8-1a3c-4e5f-8a9b-0c1d2e3f4a5b",
      "phone": "+919800000001",
      "name": "Asha"
    },
    "type": "text",
    "text": "Is my order on its way?",
    "template": null,
    "status": "received",
    "error": null,
    "createdAt": "2026-11-27T10:15:01.000Z"
  }
}

message is the same object the api returns for a message (see The message object). For test it is null. Delivery updates cover messages sent from anywhere in the app, not only through the api.

Answer with any 2xx status within 10 seconds. The body of your answer is ignored.

Check the signature

Every POST carries three headers:

HeaderHolds
X-LMS-EventThe event name
X-LMS-TimestampWhen it was sent, in Unix seconds
X-LMS-Signaturesha256= followed by the HMAC-SHA256, in hex, of the timestamp, a dot and the raw body, made with your signing secret

Check the signature against the exact bytes you received, before parsing them, and refuse events whose timestamp is more than a few minutes old. In Node with Express:

const crypto = require("node:crypto");
const express = require("express");

const secret = process.env.WEBHOOK_SECRET; // whsec_...
const app = express();

app.post(
  "/hooks/whatsapp",
  express.raw({ type: "application/json" }),
  (req, res) => {
    const timestamp = req.get("X-LMS-Timestamp") ?? "";
    const signature = req.get("X-LMS-Signature") ?? "";
    const expected =
      "sha256=" +
      crypto
        .createHmac("sha256", secret)
        .update(`${timestamp}.${req.body}`)
        .digest("hex");
    const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
    const valid =
      signature.length === expected.length &&
      crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
    if (!fresh || !valid) return res.sendStatus(401);

    const event = JSON.parse(req.body);
    // handle event.event and event.message here
    res.sendStatus(200);
  },
);

To change the secret, click New secret. The old one stops signing at once, so update your server straight away.

Send a test event

Click Send a test event under Webhook. It posts {"event": "test", "sentAt": "...", "message": null} with the usual headers, even while Send events to it is unticked. A message then says whether it was delivered, and Last delivery shows the result (such as the error your server answered with).

When an event fails

Each event is sent once. If your server is down, too slow, or answers with an error, that event is not sent again. Last delivery shows the failure.

If your system must not miss a message, also ask for messages since the last one you saw, for example every few minutes:

curl "https://gdwaapi.grapedawn.tech/api/v1/messages?since=2026-11-27T10:00:00Z&limit=200" \
  -H "Authorization: Bearer lms_your_key"

See Poll for new messages.