Webhooks¶
A webhook calls your URL as soon as something happens in your projects: a task is created, resolved, assigned to someone, commented. Your system does not need to ask the API every few minutes: Touch2build tells it.
Typical uses:
- open a ticket in your maintenance tool when a task is created on a building;
- warn a team channel when a high-priority task is resolved;
- copy every status change into a spreadsheet or a BI tool;
- start an n8n, Zapier or Make scenario.
Pro licence
Webhooks need a Pro licence, or the trial. They are managed through the API, with an API key.
Events¶
| Event | Sent when | data holds |
|---|---|---|
task.created |
a task is created | task |
task.updated |
a task is changed: name, description, priority, due date, tags, position on the drawing… | task |
task.status_changed |
a task is resolved, closed or opened again | task, previousStatus, status |
task.assigned |
a task gets another assignee | task, previousAssignee, assignee |
task.commented |
a comment is added | task, comment |
task.deleted |
a task is deleted | taskId |
ping |
you ask for a test call | subscriptionId, message |
Every change is caught, wherever it comes from: the web app, the mobile app, the API, the subcontractor pages or the MCP server.
Events are sent a few seconds after the change. task.updated groups the changes made to one task within 30 seconds into a single call, sent at the end of that window: someone editing a task field by field triggers one call, not ten.
Create a webhook¶
Send the URL to call and the events you want:
curl https://api.touch2build.com/v1/webhooks \
-H "Authorization: Bearer $T2B_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/touch2build/hook",
"events": ["task.created", "task.status_changed"],
"description": "Maintenance tickets"
}'
{
"id": "6f1d0c2e-...",
"url": "https://example.com/touch2build/hook",
"events": ["task.created", "task.status_changed"],
"projectIds": [],
"description": "Maintenance tickets",
"status": "active",
"consecutiveFailures": 0,
"createdAt": "2026-11-11T09:30:12Z",
"secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
}
Keep the secret: it is shown only in this answer, and you need it to check the signature.
| Field | |
|---|---|
url |
required. An https URL on a public host (no private or local address), up to 2,000 characters. |
events |
required. One or more events of the table above, except ping. |
projectIds |
optional. Only these projects (up to 200). Absent or empty: every project you own or have full control of, including the ones you create later. |
description |
optional. Free text to recognise the webhook, up to 200 characters. |
A webhook only reports projects you own or where you have full control: an ordinary member cannot follow a whole project this way. Demo projects send events too, except for their sample content: handy to try a webhook. You can create up to 20 webhooks.
What your URL receives¶
Each event is a POST with a JSON body:
{
"id": "evt_6af42c1b7e6bdfefd76b3086",
"type": "task.status_changed",
"occurredAt": "2026-11-11T08:49:31.467Z",
"project": { "id": "4b1e...", "name": "Résidence Les Tilleuls" },
"actor": { "id": "9c0a...", "name": "Marie Lambert" },
"data": {
"task": {
"id": "8f4c1e2a-...",
"projectId": "4b1e...",
"number": 42,
"name": "Missing fire seal around the duct",
"description": null,
"locationDescription": "Level 2, technical room",
"status": "resolved",
"priority": "high",
"type": null,
"progress": null,
"dueDate": "2026-11-15",
"assignee": { "id": "...", "name": "Dupont Plomberie" },
"createdBy": { "id": "...", "name": "Marie Lambert" },
"position": { "containerType": "plan", "containerId": "...", "x": 0.3, "y": 0.6 },
"tags": ["Plomberie"],
"photoCount": 2,
"commentCount": 1,
"createdAt": "2026-11-03T14:02:11Z",
"updatedAt": "2026-11-11T08:49:31.462Z"
},
"previousStatus": "open",
"status": "resolved"
}
}
ididentifies the event. It is the same on every attempt: use it to ignore a call you already handled.actoris the user who made the change.taskhas the same fields as in the API. It shows the task as it was a few seconds after the change: if you need its exact state later, read it again withGET /v1/tasks/{taskId}.
Answer with any 2xx status, within 10 seconds. Do the long work after answering: store the event, answer 200, then process it.
Check the signature¶
Every call is signed following Standard Webhooks, so you can be sure it comes from Touch2build and was not changed. Three headers come with it:
| Header | |
|---|---|
webhook-id |
the event id |
webhook-timestamp |
when the call was sent, in seconds since 1970 |
webhook-signature |
v1, followed by the signature |
The signature is the HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}, encoded in Base64. The key is your secret without its whsec_ prefix, decoded from Base64. Compute it on the raw body, before any JSON parsing, and refuse calls whose timestamp is more than 5 minutes away from your clock.
import base64, hashlib, hmac, time
def verify(secret: str, headers: dict, body: bytes) -> bool:
key = base64.b64decode(secret.removeprefix("whsec_"))
msg_id = headers["webhook-id"]
timestamp = headers["webhook-timestamp"]
if abs(time.time() - int(timestamp)) > 300:
return False
signed = f"{msg_id}.{timestamp}.".encode() + body
expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
return any(
hmac.compare_digest(expected, s.split(",", 1)[1])
for s in headers["webhook-signature"].split()
if s.startswith("v1,")
)
import crypto from "node:crypto";
export function verify(secret, headers, rawBody) {
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const id = headers["webhook-id"];
const timestamp = headers["webhook-timestamp"];
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const expected = crypto
.createHmac("sha256", key)
.update(`${id}.${timestamp}.${rawBody}`)
.digest("base64");
return headers["webhook-signature"]
.split(" ")
.filter((s) => s.startsWith("v1,"))
.some((s) => {
const given = Buffer.from(s.slice(3));
return given.length === expected.length
&& crypto.timingSafeEqual(given, Buffer.from(expected));
});
}
The Standard Webhooks libraries do the same in many languages.
Retries¶
When your URL does not answer 2xx within 10 seconds, the call is tried again 1 minute later, then after 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours.
- If every call of a webhook fails for 3 days, Touch2build stops it: its
statusbecomesdisabled, withdisabledReason: "failing". - If your URL answers 410 Gone, the webhook is stopped at once (
disabledReason: "gone"). Integration tools answer 410 when you delete the scenario that listened. - Redirects are not followed: give the final URL.
A call may arrive twice, for example when your answer was lost on the way back. Check the event id before acting.
Manage your webhooks¶
GET /v1/webhooks |
list your webhooks |
GET /v1/webhooks/{webhookId} |
read one, with its status, consecutiveFailures and lastSuccessAt |
GET /v1/webhooks/{webhookId}/deliveries |
its last 50 calls, newest first, with the answer of your URL |
POST /v1/webhooks/{webhookId}/test |
send a ping call now |
POST /v1/webhooks/{webhookId}/rotate-secret |
replace the secret: the old one stops working at once, the new one is in the answer |
POST /v1/webhooks/{webhookId}/enable |
start a stopped webhook again; events that happened while it was stopped are not sent |
DELETE /v1/webhooks/{webhookId} |
delete it; calls not sent yet are dropped |
To change the URL, the events or the projects, delete the webhook and create a new one.
Test a webhook¶
curl -X POST https://api.touch2build.com/v1/webhooks/$WEBHOOK_ID/test \
-H "Authorization: Bearer $T2B_API_KEY"
Your URL receives a ping event within seconds, signed like the others:
{
"id": "evt_ping_1b2c...",
"type": "ping",
"occurredAt": "2026-11-11T09:31:02Z",
"project": null,
"actor": null,
"data": { "subscriptionId": "6f1d0c2e-...", "message": "Test call from Touch2build" }
}
Then look at the result in the deliveries of the webhook:
curl https://api.touch2build.com/v1/webhooks/$WEBHOOK_ID/deliveries \
-H "Authorization: Bearer $T2B_API_KEY"
Each delivery has a status: pending (waiting for its first or next attempt), sending, sent, failed (every attempt failed) or discarded (the webhook was deleted or stopped). lastStatusCode and lastResponse show what your URL answered. Deliveries are kept 30 days.
Every endpoint in detail¶
The API reference describes each endpoint, its fields and its errors.