Automations

Webhooks: receive leads and answers in real time

Receive chatbot leads, form answers, and collected data on your server with webhooks. Events, payload, HMAC signature verification, and retries.

A webhook sends an HTTPS POST to your URL when something happens in a conversation. Add one under the agent's Build › Actions › Webhooks: give it a name, your https:// URL, and choose the events. You can turn it on once it has a URL and at least one event. Each agent can have up to 5 webhooks.

Events

EventeventTypeSent when
New leadleads.submitA visitor leaves an email or phone number. Sent once per chat.
New form answercustom_form.submitA visitor submits one of your forms.
New collected datacollect_data.submitThe agent finishes collecting data for a Collect data action.
TesttestYou click Send test in the dashboard.

Note

Chats from the dashboard Playground don't trigger webhooks.

Payload

POST body
{
  "eventType": "leads.submit",
  "agentId": "YOUR_AGENT_ID",
  "createdAt": "2026-11-06T09:30:12.000Z",
  "payload": {
    "id": "…",
    "event": "new_lead",
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "phone": "+14155550100",
    "answers": { "company": "Analytical Engines" },
    "answers_text": "Company: Analytical Engines",
    "source": "…",
    "agent_id": "YOUR_AGENT_ID",
    "agent_name": "Support Agent",
    "conversation_id": "…",
    "chat_url": "https://app.assistrio.com/…",
    "page_url": "https://example.com/pricing",
    "country": "United Kingdom",
    "created_at": "2026-11-06T09:30:12.000Z"
  }
}

payload.event is new_lead, new_form_answer, new_collected_data, or test (a sample lead from Send test). Form answers also include form_id and form_name; collected data includes data_id and data_name. answers uses snake_case keys, and answers_text has the same answers as one block of text.

Headers

HeaderValue
Content-Typeapplication/json
User-AgentAssistrio-Webhooks/1
X-Assistrio-EventThe event type.
X-Assistrio-DeliveryA unique ID (UUID) for this delivery — use it to ignore duplicates.
X-Assistrio-SignatureHex HMAC-SHA256 of the raw request body, keyed with your webhook secret.

Verify the signature

Each webhook has a secret that starts with whsec_ (you can rotate it). Compute the HMAC over the raw body — before parsing JSON — and compare.

Node.js (Express)
import crypto from "node:crypto";
import express from "express";

const app = express();

app.post("/assistrio/webhook", express.raw({ type: "application/json" }), (req, res) => {
  const expected = crypto
    .createHmac("sha256", process.env.ASSISTRIO_WEBHOOK_SECRET)
    .update(req.body) // raw Buffer
    .digest("hex");
  const received = req.get("x-assistrio-signature") ?? "";

  const valid =
    received.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
  if (!valid) return res.status(401).send("Bad signature");

  const event = JSON.parse(req.body.toString("utf8"));
  // … save event.payload, send it to your CRM, etc.
  res.sendStatus(200);
});
Python (Flask)
import hashlib, hmac, os
from flask import Flask, request, abort

app = Flask(__name__)

@app.post("/assistrio/webhook")
def assistrio_webhook():
    secret = os.environ["ASSISTRIO_WEBHOOK_SECRET"].encode()
    expected = hmac.new(secret, request.get_data(), hashlib.sha256).hexdigest()
    if not hmac.compare_digest(expected, request.headers.get("X-Assistrio-Signature", "")):
        abort(401)
    event = request.get_json()
    # … handle event["payload"]
    return "", 200

Delivery and retries

  • Respond with any 2xx within 10 seconds. Redirects aren't followed.
  • On a network error, 429, or 5xx, Assistrio retries up to 2 more times (after 2 and 10 seconds). Other 4xx responses aren't retried.
  • Because of retries, the same delivery can arrive twice — de-duplicate on X-Assistrio-Delivery (it stays the same across retries).
  • Send test is sent once, without retries, so you see the result right away.
  • The URL must be public https://. Delivery history is shown on the webhook in the dashboard.

Was this page helpful?

Need help? Contact support — we reply within one to two business days.