Webhooks

When something happens in your account, livechat.ae sends an HTTPS POST with a JSON body to your server, signed with a secret only you and we know.

Set up

  1. Open Administration → API & webhooks and add your URL. It must be https and reachable from the internet.
  2. Choose the events you want.
  3. Copy the secret (whsec_…): it is shown only once. You can create a new one at any time; the old one stops working immediately.
  4. Press Test: we send a ping event and show the response of your server.

Essential includes 3 webhooks, Growth 10, Enterprise unlimited. Webhooks don't count towards your API quota.

Events

EventWhendata
chat.startedA visitor starts a chatchat
chat.visitor_messageThe visitor writes (including the first message)chat, message.text
chat.agent_messageAn agent, an AI agent or an automation writes to the visitor. Use it to send a push notification to the mobile app when visitor.online is falsechat, message (id, text, author, createdAt, attachment), visitor.online, push (platform, token: only when the chat runs in an app with the iOS SDK and the app registered the device)
chat.closedThe chat is closed by an agent, the visitor or for inactivitychat
ticket.createdA ticket is created: from a chat, from an offline message, in the panel or with the APIticket
ticket.updatedStatus, priority or assignee changeticket
pingYou press Test in the panelmessage

chat and ticket are the same objects returned by the REST API (without messages): fetch /chats/{id} or /tickets/{id} when you need the whole conversation.

Payload

POST /your/webhook HTTP/1.1
Content-Type: application/json
User-Agent: livechat.ae-webhooks/1.0
X-Livechat-Event: chat.closed
X-Livechat-Delivery: evt_5b1f0e9c2a7d4e0f9a3b6c8d1e2f3a4b
X-Livechat-Signature: t=1795096599,v1=6f1c…e93a

{
  "id": "evt_5b1f0e9c2a7d4e0f9a3b6c8d1e2f3a4b",
  "event": "chat.closed",
  "createdAt": "2026-11-19T10:10:30Z",
  "accountId": "7ff865a3-af91-…",
  "data": {
    "chat": {
      "id": "c1f0b6a2-…", "status": "closed",
      "visitor": { "name": "Sara", "email": "sara@example.com", "country": "AE", "language": "en" },
      "agent": { "username": "anna@acme.com", "name": "Anna" },
      "rating": "good", "tags": ["order"], "closedAt": "2026-11-19T10:10:30Z"
    }
  }
}

Headers

HeaderMeaning
X-Livechat-EventEvent type, same as event in the body
X-Livechat-DeliveryUnique id of the event, same as id; it doesn't change between retries
X-Livechat-Signaturet= Unix time of the attempt, v1= hex HMAC-SHA256 signature

Verify the signature

Compute HMAC-SHA256 of t + "." + raw body with your secret and compare it with v1 in constant time. Use the raw body exactly as received, before any JSON parsing. Reject requests whose t is more than 5 minutes old, to block replays.

const crypto = require('crypto');
const express = require('express');
const app = express();

app.post('/livechat-webhook', express.raw({ type: 'application/json' }), (req, res) => {
  const header = req.get('X-Livechat-Signature') || '';
  const parts = Object.fromEntries(header.split(',').map(p => p.split('=')));
  const expected = crypto.createHmac('sha256', process.env.LIVECHAT_WEBHOOK_SECRET)
    .update(parts.t + '.' + req.body)
    .digest('hex');
  const ok = parts.v1 && parts.v1.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
  if (!ok || Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return res.sendStatus(400);

  const event = JSON.parse(req.body);
  res.sendStatus(200);              // answer first…
  handle(event);                    // …then do the work
});

Retries

Any 2xx response within 10 seconds counts as delivered. Anything else – another status, a timeout, a connection error – is retried with the same id:

AttemptAfter
1immediately
21 minute
35 minutes
430 minutes
52 hours
66 hours, then the delivery is marked as failed

After 50 failed deliveries in a row the webhook is turned off automatically, and the panel tells you why; turn it back on once your server is fixed. The panel shows the last 20 deliveries of each webhook with their status. Deliveries are kept for 30 days.

Redirects are not followed and the URL must resolve to a public address: private networks, localhost and cloud metadata addresses are refused.

Good practices

  • Answer fast. Reply 2xx as soon as the signature checks out, then do the slow work in the background.
  • Expect duplicates. A retry can arrive after you already processed the event: use id to skip events you've seen.
  • Don't rely on order. Events can arrive out of order, especially after retries: compare timestamps such as updatedAt or closedAt.
  • Fetch for details. Use the REST API with the ids in the event when you need the full chat or ticket.