Skip to content

    Arabic or English · ↑↓ to move · Enter to open · Esc to close

    العربية
    On this page

    Webhooks

    Real-time signed events: the event catalog with full examples, signature verification, retries, redelivery, ordering and idempotency.

    Mursilat calls your HTTPS endpoint when something happens: a customer message, a delivery receipt, a button answer, an opt-out, a connection change, a campaign pause. Inbound message content reaches you through the API only this way, live — the API never returns it later (your dashboard inbox keeps it encrypted, for the retention you choose).

    Set up

    • Account webhook — one URL for every number: PUT /v2/webhook. Not available to keys restricted to some numbers.
    • Per-number webhook — PUT /v2/numbers/{numberId}/webhook, or in the dashboard (Numbers → Developer).
    • With both, each event is delivered to both with the same event id.
    • Public https:// URL on port 443 (or 80). Private addresses are refused, redirects never followed. The signing secret is returned once; rotate it any time.

    The request

    http
    POST /your/webhook HTTP/1.1
    Content-Type: application/json
    User-Agent: Wasla-Webhooks/2
    X-Wasla-Event: message.status
    X-Wasla-Delivery: dlv_3c1f0a9b8e7d6c5b4a392817
    X-Wasla-Webhook-Version: 2
    X-Wasla-Signature: t=1760353203,v1=5d2f…(64 hex)
    
    { "id": "evt_…", "type": "message.status", "apiVersion": "2026-10", "createdAt": "…", "sessionId": "…", "number": "201001234567", "data": { … } }
    FieldMeaning
    idMeaningUnique per event. Retries and redeliveries carry the same id — dedupe on it.
    typeMeaningEvent type (catalog below).
    apiVersionMeaning2026-10.
    createdAtMeaningWhen the event happened.
    sessionId / numberMeaningThe number id and, when available, its phone digits. number can be null.
    dataMeaningEvent-specific payload.

    Acknowledging an incoming POST

    Verify the signature over the raw bytes. In one transaction, insert the envelope id under a unique constraint and enqueue the work. Return 204 after commit, including for a previously committed id. Process the saved event asynchronously.

    http
    HTTP/1.1 204 No Content
    Your HTTP responseWhat Mursilat does
    2xxWhat Mursilat doesAccepted; processing of this delivery stops.
    410 GoneWhat Mursilat doesDisables the webhook. Save its URL again to resume.
    Other HTTP status / timeoutWhat Mursilat doesRetry after 10s, 1m, 5m, 15m and 30m. Each attempt has a 10s timeout.

    Event catalog

    message.received

    A customer sent a message to your number. Text, captions and signed media links reach you here, live; the webhook payload isn’t kept after the retry window.

    Store the inbound message by data.messageId. Route by type: text and caption may be null for media or location. If from.phone is null, use from.userId exactly as supplied when replying. referral identifies an ad when present.

    message.received — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "message.received",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "messageId": "3EB0C1D2E3F4A5B6C7D8",
        "from": {
          "phone": "201099887766",
          "lid": null,
          "name": "منى",
          "userId": "EG.4110857709215331"
        },
        "chat": {
          "type": "direct"
        },
        "type": "text",
        "text": "عايز أعرف السعر",
        "caption": null,
        "media": null,
        "location": null,
        "replyTo": null,
        "referral": {
          "sourceId": "120212345678901234",
          "sourceType": "ad",
          "sourceUrl": "https://fb.me/2abcDEF",
          "headline": "عرض الجمعة",
          "body": "خصم 20% على كل المنتجات",
          "mediaType": "image",
          "mediaUrl": null,
          "thumbnailUrl": null,
          "ctwaClid": "ARAkLkA8rmlFeiCktEJQ-QTwRiyYHAFDLMNDBH0CD3qpjd0HR4irJ6LEkR7JwFF4XvnO2E4Nx0-eM-GABDLOPaOdRMv-_zfUQ2a"
        },
        "timestamp": "2026-10-13T08:00:02.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    message.status

    A message you sent moved to sent, delivered, read or failed. Failures carry a stable error.code mapped from Meta’s reason — CLOUD_API_WINDOW_CLOSED, RECIPIENT_UNDELIVERABLE, META_MARKETING_LIMIT, TEMPLATE_PAUSED… (see Errors), or META_<code> for any other.

    Match messageId to the outgoing message and reference to your own record when present. Record timestamp and status. A late sent receipt must not overwrite read. On failed, inspect error.code and consult the message timeline before resending.

    message.status — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "message.status",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "messageId": "3EB0A1B2C3D4E5F60718",
        "reference": "order-1042",
        "to": "201099887766",
        "status": "delivered",
        "error": null,
        "timestamp": "2026-10-13T08:00:05.000Z"
      }
    }
    Failure example · data
    {
      "messageId": "3EB0A1B2C3D4E5F60718",
      "reference": "order-1042",
      "to": "201099887766",
      "status": "failed",
      "error": {
        "code": "RECIPIENT_UNDELIVERABLE",
        "message": "Message undeliverable"
      },
      "timestamp": "2026-10-13T08:00:05.000Z"
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    message.echo

    Coexistence numbers: you sent a message from the WhatsApp Business app on your phone. Same content fields as message.received, with the customer in to and origin: "business_app". Never a message.received; no auto-reply runs.

    Append an outgoing business_app message to the conversation with to. Keep it out of inbound auto-reply logic to avoid replying to the business itself.

    message.echo — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "message.echo",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "messageId": "wamid.HBgMMjAxMDk5ODg3NzY2FQIAERgSRUNITzEA",
        "to": {
          "phone": "201099887766",
          "lid": null,
          "name": null
        },
        "type": "text",
        "text": "تمام، هبعتلك العرض دلوقتي",
        "caption": null,
        "media": null,
        "location": null,
        "replyTo": null,
        "origin": "business_app",
        "timestamp": "2026-10-13T08:02:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    interactive.reply

    A customer answered buttons or a list — tapped, or typed the number / title of an option (fallback). Only the first valid answer per message.

    Associate interactionId with the original messageId. Use reply.id to apply the selected action once. replyMessageId identifies the customer’s answer; reply.source distinguishes a tap from a typed fallback.

    interactive.reply — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "interactive.reply",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "interactionId": "int_8f2c1d9a7b3e4f56a1b2c3d4",
        "messageId": "3EB0A1B2C3D4E5F60718",
        "reference": "order-1042",
        "from": {
          "phone": "201099887766",
          "lid": null,
          "name": "منى"
        },
        "reply": {
          "id": "confirm",
          "title": "تأكيد",
          "index": 1,
          "source": "button"
        },
        "replyMessageId": "3EB0FFEE0011223344",
        "timestamp": "2026-10-13T08:03:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    contact.opted_out

    A customer sent an opt-out keyword; they are now on your suppression list and won’t receive campaigns or cold messages.

    Suppress the contact in your own sending list. keyword records the text that triggered the change. A marketing Stop tap can suppress a contact at Meta without this event.

    contact.opted_out — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "contact.opted_out",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "phone": "201099887766",
        "lid": null,
        "keyword": "إلغاء",
        "timestamp": "2026-10-13T08:05:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    contact.opted_in

    You removed a person from the suppression list (sent to every v2 number of the account).

    Update the suppression flag for the contact. Several numbers can report the same account change; assign the new state directly. keyword can be null.

    contact.opted_in — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "contact.opted_in",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "phone": "201099887766",
        "lid": null,
        "keyword": null,
        "timestamp": "2026-10-13T09:00:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    number.status

    Connection state of a number changed, as Meta reports it: connected, disconnected (reason: "offboarded" when it was removed from the WhatsApp Business app) or banned.

    Update connectivity for numberId. On disconnection record reason, for example disconnected_by_owner, offboarded or access_revoked. Prompt the owner to review the number before sending again.

    number.status — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "number.status",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "numberId": "cm1abcd2345efgh6789ijkl",
        "status": "disconnected",
        "reason": "offboarded",
        "timestamp": "2026-10-13T08:00:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    number.quality

    Meta changed the quality rating (GREEN / YELLOW / RED) or the messaging limit tier of the number. worse: true when it dropped.

    Compare quality and messagingLimit with previousQuality and previousMessagingLimit. Use worse to alert the owner to a drop in quality or tier.

    number.quality — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "number.quality",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "numberId": "cm1abcd2345efgh6789ijkl",
        "phone": "+20 10 0123 4567",
        "quality": "YELLOW",
        "previousQuality": "GREEN",
        "messagingLimit": "TIER_1K",
        "previousMessagingLimit": "TIER_1K",
        "status": "CONNECTED",
        "worse": true,
        "timestamp": "2026-10-13T08:00:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    template.status

    Meta reviewed a template of the number’s WhatsApp Business Account: APPROVED, REJECTED (with reason), PAUSED, DISABLED… One event per number of that account.

    Track the template by templateId and language within the account. Enable sending only for APPROVED. Display reason when REJECTED and available. The same account review may arrive for multiple numbers.

    template.status — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "template.status",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "templateId": "1234567890123456",
        "name": "order_shipped",
        "language": "ar",
        "status": "APPROVED",
        "reason": null,
        "timestamp": "2026-10-13T08:00:00.000Z"
      }
    }
    Failure example · data
    {
      "templateId": "1234567890123456",
      "name": "order_shipped",
      "language": "ar",
      "status": "REJECTED",
      "reason": "INVALID_FORMAT",
      "timestamp": "2026-10-13T08:00:00.000Z"
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    campaign.status

    A campaign started, paused (with the reason), resumed, completed, failed or was cancelled.

    Update the campaign identified by campaignId. For a paused campaign show reason and pausedUntil when available. A campaign state does not confirm delivery to an individual recipient.

    campaign.status — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "campaign.status",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "campaignId": "cm2camp0001xyz",
        "name": "عرض الجمعة",
        "status": "paused",
        "reason": "AUTO_LOW_DELIVERY",
        "pausedUntil": "2026-10-13T10:00:00.000Z",
        "timestamp": "2026-10-13T09:00:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    otp.verified

    An OTP sent with POST /v2/otp was verified. The code itself is never included.

    Match otpId to the verification session and record verifiedAt. The recipient may be masked. The event contains no passcode. Platform-sender verification uses the account webhook.

    otp.verified — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "otp.verified",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "otpId": "otp_8f2c1d9a7b3e4f56a1b2c3d4",
        "to": "2010****4567",
        "verifiedAt": "2026-10-13T08:01:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    conversation.attributed

    A website widget or tracked link started a conversation.

    Associate conversationId and messageId with source. Use widgetId or linkId according to the source. Campaign tags and referrer may be absent; clickedAt is the click time.

    conversation.attributed — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "conversation.attributed",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "conversationId": "cm5conv0001",
        "contact": {
          "phone": "201099887766",
          "lid": null,
          "name": "منى"
        },
        "messageId": "3EB0C1D2E3F4A5B6C7D8",
        "source": {
          "type": "widget",
          "widgetId": "wgt_k2m7q4x9a3b5c8d2",
          "linkId": null,
          "name": "Main website",
          "agent": "sales",
          "pagePath": "/products/bag",
          "referrerDomain": "facebook.com",
          "utm": {
            "source": "facebook",
            "medium": "cpc",
            "campaign": "summer",
            "content": null,
            "term": null
          }
        },
        "clickedAt": "2026-10-13T07:58:10.000Z",
        "timestamp": "2026-10-13T08:00:02.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    webhook.test

    Sent by “Send a test event” and the test endpoints. Always delivered, even if not in your event list.

    Record the test delivery and acknowledge it. Use it to verify signing, routing and the delivery log without creating a conversation or sending WhatsApp messages.

    webhook.test — Full request body
    {
      "id": "evt_5f0c2b7d9e1a4c3b8a6f2d10",
      "type": "webhook.test",
      "apiVersion": "2026-10",
      "createdAt": "2026-10-13T08:00:03.000Z",
      "sessionId": "cm1abcd2345efgh6789ijkl",
      "number": "201001234567",
      "data": {
        "message": "This is a test event from Mursilat",
        "timestamp": "2026-10-13T08:00:00.000Z"
      }
    }

    After verification and durable storage, respond with 204 No Content. Acknowledgements and retries

    Verifying the signature

    X-Wasla-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>. Use the raw request body (before JSON parsing), compare in constant time and reject timestamps more than 5 minutes from now.

    // Node.js + Express. Use the RAW body: JSON.parse → JSON.stringify changes bytes and breaks the signature.
    import crypto from 'node:crypto';
    import express from 'express';
    
    const app = express();
    const SECRET = process.env.WASLA_WEBHOOK_SECRET;
    const seen = new Set(); // use Redis/DB in production
    
    function verifyWaslaSignature(rawBody, header, secret, toleranceSec = 300) {
      if (!header || !secret) return false;
      const parts = {};
      for (const pair of header.split(',')) {
        const i = pair.indexOf('=');
        if (i > 0) parts[pair.slice(0, i).trim()] = pair.slice(i + 1).trim();
      }
      const t = parts.t;
      const v1 = parts.v1;
      if (!/^\d+$/.test(t || '') || !/^[0-9a-f]{64}$/i.test(v1 || '')) return false;
      // Reject old (replayed) or far-future timestamps.
      if (Math.abs(Math.floor(Date.now() / 1000) - Number(t)) > toleranceSec) return false;
      const expected = crypto
        .createHmac('sha256', secret)
        .update(t + '.')
        .update(rawBody) // the RAW bytes exactly as received, not re-serialized JSON
        .digest();
      const received = Buffer.from(v1, 'hex');
      return received.length === expected.length && crypto.timingSafeEqual(received, expected);
    }
    
    app.post('/webhooks/mursilat', express.raw({ type: 'application/json' }), (req, res) => {
      if (!verifyWaslaSignature(req.body, req.get('X-Wasla-Signature'), SECRET)) {
        return res.status(401).send('invalid signature');
      }
      const event = JSON.parse(req.body.toString('utf8'));
      res.sendStatus(200); // answer fast (within 10s); do the work after
    
      if (seen.has(event.id)) return; // retries reuse the same event id
      seen.add(event.id);
      if (event.type === 'interactive.reply') {
        console.log(event.data.reference, '→', event.data.reply.id);
      }
    });
    
    app.listen(3000);

    Not sure your code is right? Paste a real request into the payload inspector — it checks the signature and the envelope in your browser.

    Retries

    • Answer 2xx within 10 seconds, then do the work asynchronously.
    • Anything else (timeout, network error, 3xx, 4xx, 5xx) is retried: at once, then after 10 s, 1 min, 5 min, 15 min and 30 min — 6 attempts over about 51 minutes. Then the delivery is FAILED.
    • 410 Gone means “stop”: the webhook is disabled at once and pending deliveries are cancelled. Save the URL again to re-enable it.
    • At most 4 concurrent requests per URL. Changing or removing the URL cancels queued retries to the old one.

    Redelivery window

    Mursilat retains an event body temporarily for the retry window: about an hour after the event, and 10 minutes after a successful delivery. Within that window POST /v2/webhooks/deliveries/{deliveryId}/redeliver sends the same event (same id) again; afterwards it answers 410 DELIVERY_PAYLOAD_EXPIRED — rebuild the state from the API (e.g. GET /v2/messages/{id}).

    Ordering and idempotency

    • Ordering is best effort: retries and parallel deliveries can arrive out of order. Use createdAt / data.timestamp — e.g. ignore delivered after you saw read.
    • Duplicates are expected (retries, redeliveries, both account and number webhooks). Store id and skip events you already handled.
    • The delivery log keeps metadata for 7 days (event, status, HTTP code, timing, error) — never the payload or your response body.