Webhooks
Get a signed JSON request on your server when a lead comes in, a question goes unanswered or a conversation needs attention.
Set it up
- In the dashboard, open the site's Settings and go to the Advanced tab.
- In the Webhook (Zapier / Make / custom) card, enter your Webhook URL. It has to be reachable from the public internet.
- Leave Signing secret empty and save: a secret is generated and shown in the field. Copy it to your server. To choose your own, type it and save.
Every event below is sent to that one address, so ignore the event names you do not handle. If you clear the secret and save, a new one is generated and the old one stops matching.
The Hand off to a human card on the same tab has its own notification URL. That is a different, older notification: it is not signed and its body is not the one described here.
What arrives
A POST with a JSON body and these headers:
HTTP
POST /slatech-webhook HTTP/1.1
Content-Type: application/json
User-Agent: SLAtech-ChatBot-Webhook/1.0
X-SLAtech-Event: new_lead
X-SLAtech-Signature: sha256=3b1f0c9e5d...e7a2
{"event":"new_lead","timestamp":"2026-12-04T09:20:11.4031234Z", ...}
X-SLAtech-Event: the event name, the same as theeventfield of the body.X-SLAtech-Signature:sha256=followed by the lowercase hex HMAC-SHA256 of the raw request body, keyed with your signing secret.
Body fields use snake_case, and times are UTC in ISO 8601.
Verify the signature
Compute the HMAC over the body bytes exactly as received, before any JSON parsing, and compare it with the header in constant time. The key is the secret text as the dashboard shows it, taken as UTF-8 bytes: do not base64-decode it, even though it looks like base64. Reject the request when the signatures differ.
Node.js
import crypto from "node:crypto";
import express from "express";
const app = express();
const SECRET = process.env.SLATECH_WEBHOOK_SECRET; // the text exactly as shown in the dashboard
// express.raw keeps the body as bytes: the signature is over the raw body,
// and re-serialising parsed JSON would not reproduce it.
app.post("/slatech-webhook", express.raw({ type: "application/json" }), (req, res) => {
const expected = "sha256=" +
crypto.createHmac("sha256", SECRET).update(req.body).digest("hex");
const received = req.get("X-SLAtech-Signature") || "";
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"));
switch (req.get("X-SLAtech-Event")) {
case "new_lead": /* event.lead.email ... */ break;
default: break; // ignore events you do not handle
}
res.sendStatus(204);
});
app.listen(3000);
Python
import hashlib
import hmac
import os
from flask import Flask, abort, request
app = Flask(__name__)
SECRET = os.environ["SLATECH_WEBHOOK_SECRET"].encode("utf-8") # the text as shown
@app.post("/slatech-webhook")
def slatech_webhook():
raw = request.get_data() # raw bytes, before any JSON parsing
expected = "sha256=" + hmac.new(SECRET, raw, hashlib.sha256).hexdigest()
received = request.headers.get("X-SLAtech-Signature", "")
if not hmac.compare_digest(received, expected):
abort(401)
event = request.get_json()
if request.headers.get("X-SLAtech-Event") == "new_lead":
print(event["lead"]["email"])
return "", 204
C#
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
var app = WebApplication.Create(args);
// The secret is used as text (its UTF-8 bytes), exactly as shown in the dashboard.
var secret = Encoding.UTF8.GetBytes(Environment.GetEnvironmentVariable("SLATECH_WEBHOOK_SECRET")!);
app.MapPost("/slatech-webhook", async (HttpRequest request) =>
{
using var buffer = new MemoryStream();
await request.Body.CopyToAsync(buffer);
var body = buffer.ToArray(); // raw bytes, before any JSON parsing
var expected = "sha256=" + Convert.ToHexString(HMACSHA256.HashData(secret, body)).ToLowerInvariant();
var received = request.Headers["X-SLAtech-Signature"].ToString();
if (!CryptographicOperations.FixedTimeEquals(
Encoding.UTF8.GetBytes(received), Encoding.UTF8.GetBytes(expected)))
return Results.Unauthorized();
using var doc = JsonDocument.Parse(body);
var eventName = doc.RootElement.GetProperty("event").GetString();
return Results.NoContent();
});
app.Run();
With the client libraries
The client libraries do the same check in one call:
verifyWebhookSignature from @slatech/bot-sdk/webhooks in Node.js, and
verify_webhook_signature from slatech in Python. Both compare in constant time
and return false for a missing, malformed or wrong signature.
TypeScript
import express from "express";
import { verifyWebhookSignature } from "@slatech/bot-sdk/webhooks";
const app = express();
const SECRET = process.env.SLATECH_WEBHOOK_SECRET!; // the text exactly as shown in the dashboard
app.post("/slatech-webhook", express.raw({ type: "application/json" }), (req, res) => {
if (!verifyWebhookSignature(req.body, req.get("X-SLAtech-Signature"), SECRET)) {
return res.sendStatus(401);
}
const event = JSON.parse(req.body.toString("utf8"));
switch (req.get("X-SLAtech-Event")) {
case "new_lead": /* event.lead.email ... */ break;
default: break; // ignore events you do not handle
}
res.sendStatus(204);
});
Python
import os
from flask import Flask, abort, request
from slatech import verify_webhook_signature
app = Flask(__name__)
SECRET = os.environ["SLATECH_WEBHOOK_SECRET"] # the text exactly as shown in the dashboard
@app.post("/slatech-webhook")
def slatech_webhook():
if not verify_webhook_signature(request.get_data(), request.headers.get("X-SLAtech-Signature"), SECRET):
abort(401)
event = request.get_json()
if request.headers.get("X-SLAtech-Event") == "new_lead":
print(event["lead"]["email"])
return "", 204
Events
| Event | When it is sent |
|---|---|
new_lead | The site's handoff fires: a visitor leaves contact details through the chat, or a question meets the site's handoff rule. Only for sites with handoff enabled. |
query_unresolved | An answered question is marked as not resolved. |
sentiment.detected | A conversation has been analysed in the background. |
conversation.tagged | The same analysis has assigned the conversation a tag. |
escalation.requested | An analysed chat came out negative while the assistant was still handling it, and a person was asked to take over. |
The background analysis looks at conversations with more than ten questions whose
sessionId is a UUID. A conversation that continues can be analysed, and reported,
again.
new_lead
Any of the contact fields can be null; language is the visitor's.
new_lead
{
"event": "new_lead",
"timestamp": "2026-12-04T09:20:11.4031234Z",
"site_id": "4f6b2c1e-8a3d-4e9f-b7c0-2d5a1e8f6c39",
"site_domain": "example.com",
"lead": {
"name": "Dana Levi",
"email": "dana@example.com",
"phone": "+972501234567",
"question": "Do you have a slot on Thursday afternoon?",
"page": "https://example.com/booking/",
"language": "he"
}
}
query_unresolved
language is currently always null.
query_unresolved
{
"event": "query_unresolved",
"timestamp": "2026-12-04T09:31:02.9917310Z",
"site_id": "4f6b2c1e-8a3d-4e9f-b7c0-2d5a1e8f6c39",
"query": {
"text": "Do you deliver to Eilat?",
"page": "https://example.com/shipping/",
"language": null
}
}
sentiment.detected
sentiment is positive, neutral, negative or
mixed, with a short summary of the conversation.
sentiment.detected
{
"event": "sentiment.detected",
"timestamp": "2026-12-04T10:04:12.5530981Z",
"site_id": "4f6b2c1e-8a3d-4e9f-b7c0-2d5a1e8f6c39",
"client_id": "c2a9e6f1-3b7d-4c80-9e15-6a4d2f8b0c73",
"session_id": "7d0f6a52-3c1e-4b8e-9f0a-2a6c5e1b9d47",
"sentiment": "negative",
"summary": "The visitor asked twice about a delayed order and did not get a delivery date.",
"detected_at_utc": "2026-12-04T10:04:12.5530990Z"
}
conversation.tagged
tag is normally one of hot_intent, browsing,
objection, stalled, problem, feedback,
question or unknown; confidence is 0 to 100. Treat an unknown
value as unknown.
conversation.tagged
{
"event": "conversation.tagged",
"timestamp": "2026-12-04T10:04:15.0187702Z",
"site_id": "4f6b2c1e-8a3d-4e9f-b7c0-2d5a1e8f6c39",
"client_id": "c2a9e6f1-3b7d-4c80-9e15-6a4d2f8b0c73",
"session_id": "7d0f6a52-3c1e-4b8e-9f0a-2a6c5e1b9d47",
"tag": "problem",
"confidence": 86,
"tagged_at_utc": "2026-12-04T10:04:15.0187710Z"
}
escalation.requested
reason is currently sentiment_negative.
escalation.requested
{
"event": "escalation.requested",
"timestamp": "2026-12-04T10:05:47.1204417Z",
"site_id": "4f6b2c1e-8a3d-4e9f-b7c0-2d5a1e8f6c39",
"client_id": "c2a9e6f1-3b7d-4c80-9e15-6a4d2f8b0c73",
"session_id": "7d0f6a52-3c1e-4b8e-9f0a-2a6c5e1b9d47",
"visitor_id": "v_8f2c41",
"reason": "sentiment_negative",
"requested_at_utc": "2026-12-04T10:05:47.1204420Z"
}
Delivery and retries
- Any
2xxresponse counts as delivered. - Any other status, a network error, or no answer within 15 seconds counts as a failed attempt.
- There are up to three attempts: the second 5 seconds after the first fails, the third 30 seconds after that. After the third failure the event is dropped; nothing is queued or sent later.
- The same event can arrive twice, for example when your server took longer than 15 seconds but still processed it. The payload has no event id, so make your handling safe to repeat.
Answer with 2xx as soon as the signature checks out, and do the slow work
afterwards.
Related
- Poll for leads and conversations instead of receiving them
- How lead capture works
- Client libraries for JavaScript/TypeScript and Python
- API reference