Skip to main content

Webhooks

LUMA can send events to a URL on your server: incoming WhatsApp messages, delivery statuses, template and account changes, and agent events (session end, lead captured, human handoff).

Plan: LUMA Elevate or Enterprise. Credits: free.

Events​

Event name (subscribed_events)Sent whenPayload
Incoming messageA customer writes to your WhatsApp numberWhatsApp payload (see Incoming messages and statuses)
Delivery statusA message you sent becomes sent, delivered, read or failedWhatsApp payload
Template statusMeta approves, rejects, pauses or disables one of your templatesWhatsApp payload
Account statusMeta sends an alert about your WhatsApp Business AccountWhatsApp payload
Session EndAn agent chat session ends (visitor inactive or chat closed)LUMA agent payload
Lead CaptureAn agent captures a leadLUMA agent payload
Human HandoffAn agent hands a chat to a humanLUMA agent payload

WhatsApp events are tied to a WhatsApp Business Account (waba_id); agent events to an agent (chatbot_id).

Create a webhook​

In the LUMA app: Technical, then Webhook, then Add Webhook. Or by API:

curl --request POST 'https://api.itechintl.com/v1/webhook/config' \
--header 'Authorization: Bearer lm_live_YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"project_id": PROJECT_ID,
"waba_id": WABA_ID,
"webhook_name": "Orders system",
"url": "https://example.com/luma/webhook",
"secret": "A_LONG_RANDOM_SECRET",
"timeout": 10,
"is_active": true,
"subscribed_events": ["Incoming message", "Delivery status"]
}'
FieldTypeRequiredDescription
project_idintegeryesYour LUMA project
waba_idintegerfor WhatsApp eventsWhatsApp Business Account to listen to
chatbot_idstringfor agent eventsAgent ID (as returned by List agents)
webhook_namestringyesYour label
urlstringyesHTTPS URL on your server
secretstringrecommendedUsed to sign every request (see below)
timeoutintegernoSeconds LUMA waits for your answer (default 100)
is_activebooleannoDefault true
subscribed_eventsarray of stringsyesEvent names from the table above

Other calls: GET /v1/webhook/config (list), GET /v1/webhook/details/{webhookId}, PUT /v1/webhook/config/{webhookId}, DELETE /v1/webhook/config/{webhookId}.

What LUMA sends​

  • POST to your URL, Content-Type: application/json; charset=utf-8.
  • Header X-Hub-Signature-256: sha256=<hex> when the webhook has a secret.
  • Answer with any 2xx within the timeout. LUMA logs the result of agent events in the app's Activity Log. Failed deliveries are not retried, so store the event first and process it later.

Verify the signature​

The signature is HMAC-SHA256 of the raw request body with your secret, written as lowercase hex. Always compare it in constant time, and reject the request if it does not match.

Node.js (Express)​

import crypto from "node:crypto";
import express from "express";

const app = express();
app.post("/luma/webhook", express.raw({ type: "application/json" }), (req, res) => {
const expected = "sha256=" + crypto
.createHmac("sha256", process.env.LUMA_WEBHOOK_SECRET)
.update(req.body)
.digest("hex");
const received = req.get("X-Hub-Signature-256") || "";
const ok = received.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
if (!ok) return res.sendStatus(401);

const event = JSON.parse(req.body.toString("utf8"));
// store the event, then process it asynchronously
res.sendStatus(200);
});

Python (Flask)​

import hmac, hashlib, os
from flask import Flask, request, abort

app = Flask(__name__)

@app.post("/luma/webhook")
def luma_webhook():
raw = request.get_data()
expected = "sha256=" + hmac.new(os.environ["LUMA_WEBHOOK_SECRET"].encode(), raw, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, request.headers.get("X-Hub-Signature-256", "")):
abort(401)
event = request.get_json()
# store the event, then process it asynchronously
return "", 200

C# (ASP.NET Core)​

app.MapPost("/luma/webhook", async (HttpRequest req) =>
{
using var reader = new StreamReader(req.Body);
var raw = await reader.ReadToEndAsync();
var key = Encoding.UTF8.GetBytes(Environment.GetEnvironmentVariable("LUMA_WEBHOOK_SECRET")!);
var hash = HMACSHA256.HashData(key, Encoding.UTF8.GetBytes(raw));
var expected = "sha256=" + Convert.ToHexString(hash).ToLowerInvariant();
var received = req.Headers["X-Hub-Signature-256"].ToString();
if (!CryptographicOperations.FixedTimeEquals(Encoding.UTF8.GetBytes(expected), Encoding.UTF8.GetBytes(received)))
return Results.Unauthorized();
// store raw, then process it asynchronously
return Results.Ok();
});

Agent event payloads​

Lead Capture​

{
"event": "Lead Capture",
"chatbot_id": "AGENT_ID",
"session_id": "SESSION_ID",
"page_url": "https://example.com/pricing",
"ip_address": "203.0.113.10",
"lead_status": "New",
"time": "2026-11-25T10:15:00Z",
"lead_data": [
{ "field_name": "Name", "field_type": "text", "field_value": "Customer 1" },
{ "field_name": "Email", "field_type": "email", "field_value": "customer1@example.com" }
]
}

Human Handoff​

{
"event": "Human Handoff",
"chatbot_id": "AGENT_ID",
"handoff_id": "HANDOFF_ID",
"session_id": "SESSION_ID",
"customer_name": "Customer 1",
"customer_email": "customer1@example.com",
"customer_phone": "971500000001",
"contact_method": "email",
"handoff_reason": "Asked for a refund",
"session_summary": "The customer asked about order 1001 and wants a refund.",
"time": "2026-11-25T10:20:00Z"
}

Session End​

{
"event": "Session End",
"session_id": "SESSION_ID",
"chatbot_id": "AGENT_ID",
"transcript": [
{ "role": "user", "text": "Do you deliver on Fridays?" },
{ "role": "assistant", "text": "Yes, we deliver every day from 9:00 to 21:00." }
]
}