Webhooks
A webhook is us calling you. Give a workspace an address of yours, pick the events you care about, and we send an HTTPS POST with a JSON body the moment one happens: a ticket was opened, a customer replied, a ticket was closed. There is nothing to poll.
Use them to post new tickets into a chat channel, keep a CRM in step, start your own automation when a ticket closes, or feed a data warehouse.
Setting one up
- A workspace administrator opens Settings → Webhooks and adds an endpoint: your address and the events to send.
- The next page shows the endpoint's signing secret (it starts with
whsec_). It is shown once. Store it where your endpoint can read it. - Press Send test event on the endpoint's Deliveries page. A
pingevent arrives, and the page shows what your server answered.
The address has to be https, on the standard port, and reachable from the public internet. Addresses on private networks are refused. A workspace can have several endpoints, each with its own events and its own secret.
What we send
Every event is one POST with these headers:
| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | Lagotto-Webhooks/1 |
X-Lagotto-Event | The event's type, such as ticket.closed. |
X-Lagotto-Delivery | The event's id. The same as id in the body, and the same on every retry. |
X-Lagotto-Timestamp | When this attempt was sent, in seconds since 1970 (UTC). |
X-Lagotto-Signature | v1= followed by the signature. See Checking the signature. |
These requests come from 34.42.72.117. If your firewall only lets in addresses it knows, add it.
The body always has the same envelope:
| Field | Type | What it is |
|---|---|---|
id | string | A UUID for this event. Use it to ignore one you have already handled. |
type | string | The event, from the list below. |
created_at | string | When it happened, ISO 8601 in UTC. |
workspace | string | The workspace's subdomain. |
data | object | What the event is about. Ticket events carry ticket; some add message, actor (the person who did it, absent when nobody did), draft, pull_request or csat. |
data.ticket is the same in every event: number (what the REST API and the app address a ticket by), subject, status (open, closed or spam), url (the ticket in the app), customer, assignee and group (each null when there is none), created_at and updated_at.
We may add fields over time. Ignore the ones you don't know.
Events
| Event | Sent when |
|---|---|
ticket.created | A customer opened a new ticket. |
ticket.customer_replied | A customer wrote again on a ticket. |
ticket.replied | An agent's reply was sent to the customer. |
ticket.note_added | Somebody left an internal note. |
ticket.assigned | A ticket was given to a person. |
ticket.unassigned | A ticket was taken off the person who held it. |
ticket.routed | A ticket was moved to a group. |
ticket.closed | A ticket was closed. |
ticket.reopened | A closed ticket was opened again. |
ticket.spam_marked | A ticket was marked as spam. |
ticket.draft_ready | AI finished drafting a reply for an agent to review. |
ticket.pull_request_opened | A pull request was opened for an approved fix. |
ticket.pull_request_merged | A fix's pull request was merged. |
csat.received | A customer rated how their ticket was handled. |
ping | Somebody pressed Send test event. Sent whatever the endpoint subscribes to. |
ticket.created
A customer opened a new ticket. Carries the customer's first message.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.created",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": null,
"group": null,
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"message": {
"id": 9001,
"type": "customer",
"body": "Hi, my export stops at row 50,000. Can you help?",
"author": {
"name": "Carol Customer",
"email": "carol@example.com"
},
"created_at": "2026-03-09T14:30:00Z"
}
}
}
ticket.customer_replied
A customer wrote again on a ticket. Carries the new message. A reply on a closed ticket also sends ticket.reopened.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.customer_replied",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"message": {
"id": 9001,
"type": "customer",
"body": "Still happening this morning.",
"author": {
"name": "Carol Customer",
"email": "carol@example.com"
},
"created_at": "2026-03-09T14:30:00Z"
}
}
}
ticket.replied
An agent's reply was sent to the customer. Carries the reply as it was sent to the customer.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.replied",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"message": {
"id": 9001,
"type": "reply",
"body": "Thanks Carol. Exports over 50,000 rows are emailed to you as a link instead.",
"author": {
"name": "Alice Agent",
"email": "alice@acme.example"
},
"created_at": "2026-03-09T14:30:00Z"
},
"actor": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
}
}
}
ticket.note_added
Somebody left an internal note. The only event that carries the text of an internal note. Leave it unticked if notes should not leave the workspace.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.note_added",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"message": {
"id": 9001,
"type": "note",
"body": "Same as #1031. Checking with the data team.",
"author": {
"name": "Alice Agent",
"email": "alice@acme.example"
},
"created_at": "2026-03-09T14:30:00Z"
},
"actor": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
}
}
}
ticket.assigned
A ticket was given to a person. data.ticket.assignee is the person who now holds it; actor is whoever gave it to them.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.assigned",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"actor": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
}
}
}
ticket.unassigned
A ticket was taken off the person who held it.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.unassigned",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": null,
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"actor": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
}
}
}
ticket.routed
A ticket was moved to a group. data.ticket.group is where it went. Sent for a trigger's routing as well as a person's.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.routed",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"actor": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
}
}
}
ticket.closed
A ticket was closed. A ticket marked as spam is closed too, but sends ticket.spam_marked instead.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.closed",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "closed",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"actor": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
}
}
}
ticket.reopened
A closed ticket was opened again.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.reopened",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"actor": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
}
}
}
ticket.spam_marked
A ticket was marked as spam.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.spam_marked",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "spam",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"actor": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
}
}
}
ticket.draft_ready
AI finished drafting a reply for an agent to review. The draft is a suggestion waiting in the reply box. Nothing has been sent to the customer.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.draft_ready",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"draft": {
"body": "Hi Carol, exports over 50,000 rows are emailed to you as a link.",
"note": "Answered from the Exports help article."
}
}
}
ticket.pull_request_opened
A pull request was opened for an approved fix. kind is code_fix or data_fix.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.pull_request_opened",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"pull_request": {
"repository": "acme/web",
"number": 482,
"url": "https://github.com/acme/web/pull/482",
"kind": "code_fix"
}
}
}
ticket.pull_request_merged
A fix's pull request was merged.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ticket.pull_request_merged",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "open",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"pull_request": {
"number": 482,
"url": "https://github.com/acme/web/pull/482"
}
}
}
csat.received
A customer rated how their ticket was handled. rating is good or bad. A customer can change their answer for a week, which sends the event again.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "csat.received",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {
"ticket": {
"number": 1042,
"subject": "Export stops halfway through",
"status": "closed",
"url": "https://acme.lagottolabs.ai/tickets/1042",
"customer": {
"id": 311,
"email": "carol@example.com",
"name": "Carol Customer"
},
"assignee": {
"id": 12,
"name": "Alice Agent",
"email": "alice@acme.example"
},
"group": {
"id": 3,
"name": "Technical"
},
"created_at": "2026-03-09T12:30:00Z",
"updated_at": "2026-03-09T14:30:00Z"
},
"csat": {
"rating": "good",
"comment": "Fast and clear, thank you."
}
}
}
ping
A test event, with nothing in data. It is signed like any other, so it is a good first check of your verification code.
{
"id": "5b0c8a52-6f0e-4f6b-9a3e-2d1c7e8f9a10",
"type": "ping",
"created_at": "2026-03-09T14:30:00Z",
"workspace": "acme",
"data": {}
}
Checking the signature
Your endpoint is a public address, so anyone can post to it. The signature is how you know a request came from us and was not changed on the way. Check it before you trust anything in the body.
- Take the
X-Lagotto-Timestampheader, a full stop, and the raw request body, exactly as received:timestamp + "." + body. - Compute the HMAC-SHA256 of that string with the endpoint's signing secret as the key, written in lowercase hex.
- Compare
v1=plus that hex with theX-Lagotto-Signatureheader, using a constant-time comparison. - Refuse a timestamp more than five minutes from your own clock. That stops a captured request from being played back later.
Sign the bytes you received. A body that has been parsed and written out again is not the same string and will not match.
Ruby
require "openssl"
require "rack/utils"
# request is a Rack::Request (in Rails: `request`).
def genuine_webhook?(request, secret)
timestamp = request.get_header("HTTP_X_LAGOTTO_TIMESTAMP").to_s
signature = request.get_header("HTTP_X_LAGOTTO_SIGNATURE").to_s
body = request.body.read # the raw bytes, before any JSON parsing
# Older than five minutes: a replay, or a clock that is badly off.
return false if (Time.now.to_i - timestamp.to_i).abs > 300
expected = "v1=" + OpenSSL::HMAC.hexdigest("SHA256", secret, "#{timestamp}.#{body}")
Rack::Utils.secure_compare(expected, signature)
end
Node.js
const crypto = require("node:crypto")
const express = require("express")
const app = express()
// express.raw keeps the body as the bytes we signed.
app.post("/webhooks/support", express.raw({ type: "application/json" }), (req, res) => {
const timestamp = req.get("X-Lagotto-Timestamp") || ""
const signature = req.get("X-Lagotto-Signature") || ""
// Older than five minutes: a replay, or a clock that is badly off.
if (!(Math.abs(Date.now() / 1000 - Number(timestamp)) <= 300)) return res.sendStatus(400)
const expected = "v1=" + crypto.createHmac("sha256", process.env.WEBHOOK_SECRET)
.update(`${timestamp}.`).update(req.body).digest("hex")
const ours = Buffer.from(expected)
const theirs = Buffer.from(signature)
if (ours.length !== theirs.length || !crypto.timingSafeEqual(ours, theirs)) return res.sendStatus(401)
const event = JSON.parse(req.body)
enqueue(event) // answer first, do the work afterwards
res.sendStatus(204)
})
Python
import hashlib, hmac, os, time
from flask import Flask, abort, request
app = Flask(__name__)
SECRET = os.environ["WEBHOOK_SECRET"].encode()
@app.post("/webhooks/support")
def webhook():
timestamp = request.headers.get("X-Lagotto-Timestamp", "")
signature = request.headers.get("X-Lagotto-Signature", "")
body = request.get_data() # the raw bytes, before any JSON parsing
# Older than five minutes: a replay, or a clock that is badly off.
if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300:
abort(400)
expected = "v1=" + hmac.new(SECRET, timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected.encode(), signature.encode()):
abort(401)
enqueue(request.get_json()) # answer first, do the work afterwards
return "", 204
If a secret is lost or may have leaked, an administrator can press Rotate secret on the endpoint. The old secret stops working at once, so update your endpoint straight after.
Answering
Answer with any 2xx status within 10 seconds. We don't read the body of your answer.
Answer first and do the work afterwards: put the event on a queue of your own and return 204. An endpoint that does its work before answering will time out on a busy day, and a timeout counts as a failure.
Redirects are not followed. A 3xx is a failure, so give us the final address.
Retries
Anything other than a 2xx (an error status, a timeout, a connection we could not make) is tried again, up to 8 attempts over about a day. The waits between them are
1 minute, 5 minutes, 30 minutes, about 2 hours, about 5 hours, about 8 hours, and about 8 hours. After the last attempt the delivery is marked failed and is not sent again.
- A retry carries the same
idandX-Lagotto-Delivery, with a fresh timestamp and signature. If you answered slowly the first time you may get an event twice: remember the ids you have handled. - Events can arrive out of order, most often when one of them was retried. Go by
created_at, or fetch the ticket from the REST API when order matters. - Every attempt is listed on the endpoint's Deliveries page for 30 days, with the payload and what your server answered.
When an endpoint keeps failing
After 20 deliveries in a row have failed for good, we switch the endpoint off and email the workspace's administrators. One successful delivery resets the count.
Switch it back on in Settings → Webhooks once your address is answering again. Events that happened while it was off are not sent afterwards; the REST API can fill the gap.