What your endpoint receives
A POST of compact JSON for each message that lands in the inbox, signed in the Standard Webhooks format (standardwebhooks.com). There is one event type, message.delivered. The body is ASCII: any other character arrives as a \uXXXX escape. The headers are content-type: application/json, user-agent: homing-webhooks/1, and webhook-id, webhook-timestamp and webhook-signature. webhook-id is the message's id, the same on every try; Send a test uses an id that starts with sample-. webhook-timestamp is the Unix time in seconds of this try, fresh on each one. A webhook added in the app starts on the Ticket mapping, so its body is what the mapping makes; choose Full message for the fields below. data.format is "markdown" when the sender declared the body Markdown, else null; data.body is the source text either way, never rendered, so a receiver that shows it as Markdown should escape or sanitise it as it would any untrusted text.
type "message.delivered" timestamp string, UTC; equal to data.delivered_at, not the time of this try data message_id string (UUID); also the webhook-id header thread_id string or null; the first message's id on a reply, null on the first message in_reply_to string or null; the message this one answers subject string or null body string; the text as sent, whatever its format format "markdown" | null; "markdown" when the sender declared the body Markdown priority "low" | "normal" | "high" | "urgent" | null (null: none was set) form object or null; the form the sender used, as it was when sent fields object or null; the form's values, keyed by field key attachments array of { attachment_id, name, mime, size_bytes } attachment_count number sender { username, display_name } recipient { entity_id, handle, display_name, kind } url string; opens the message in Homing delivered_at string, UTC; when the message landed in the inbox
Versions
The body carries no version number. For now, new fields may be added to data at any time, so ignore the ones you do not know. A change that removes or renames a field would ship as a new event type, never as a change to message.delivered.
Verify every request
Work from the body exactly as you received it, not a parsed and re-encoded copy. The signature is v1, a comma and the base64 HMAC-SHA256 of webhook-id, webhook-timestamp and the body joined with dots, keyed with the bytes you get by base64-decoding the secret after whsec_. Compare in constant time. Reject a request whose webhook-timestamp is more than 5 minutes from your clock, which stops a captured request being replayed. A Standard Webhooks library for Node, Python, Go, Ruby and others does all of this in one call, with the same window. Without one, these do it.
import base64, hashlib, hmac, time def verify(secret: str, headers: dict, raw_body: bytes) -> bool: """raw_body is the request body exactly as received, as bytes.""" msg_id, ts = headers["webhook-id"], headers["webhook-timestamp"] if not (ts.isascii() and ts.isdigit()) or abs(time.time() - int(ts)) > 300: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{msg_id}.{ts}.".encode() + raw_body expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() for part in headers["webhook-signature"].split(): version, _, sig = part.partition(",") if version == "v1" and hmac.compare_digest(sig, expected): return True return False
import { createHmac, timingSafeEqual } from "node:crypto"; // rawBody is a Buffer: the body exactly as received, before any JSON parsing. export function verify(secret, headers, rawBody) { const id = headers["webhook-id"]; const ts = headers["webhook-timestamp"]; if (!/^\d+$/.test(ts) || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false; const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64"); const expected = createHmac("sha256", key).update(`${id}.${ts}.`).update(rawBody).digest(); return headers["webhook-signature"].split(" ").some((part) => { const [version, sig] = part.split(","); if (version !== "v1") return false; const got = Buffer.from(sig ?? "", "base64"); return got.length === expected.length && timingSafeEqual(got, expected); }); }
Changing the secret
An integration can have two signing secrets at once, and you manage them by hand. Add a new secret in the app: it becomes the current one and the old one keeps signing, so webhook-signature holds both values separated by a space, v1,<new> v1,<old>. The code above accepts either. Put the new secret in your receiver, then remove the old one in the app; it stops signing at once. Nothing expires on a timer. If a secret leaked, add a new one and remove the old one at once. With two secrets active you cannot add a third; remove the old one first.
Answer fast, then do the work
Answer 2xx within 10 seconds. A slower receiver is recorded as no response and gets the message again, so acknowledge first and do the work after. Anything but 2xx is tried again after 30 seconds, 5 minutes, 1 hour and 5 hours: five tries over about 6 hours, each wait stretched or shortened by up to 20%. A Retry-After header on a 429 or 503 sets a longer minimum, up to an hour. A redirect or a client error (3xx, or a 4xx other than 408, 425 and 429) gets three tries, and redirects are not followed. A 410 pauses the integration at once; three messages in a row that fail every try pause it too, and the app says why.
Duplicates and order
Delivery is at least once, so the same message can arrive twice. Keep the webhook-id values you have handled and drop repeats. Order is not guaranteed: deliveries to one endpoint can run side by side, and a retry of an older message can arrive after newer ones. webhook-timestamp is the time of this try, so it moves on each retry; to order messages use data.delivered_at, and group a conversation by data.thread_id, with data.message_id for the first message, which has none. With a mapping, map delivered_at and thread_id to have them.
What Homing does not do
- 1 Homing posts from no fixed IP addresses, so there is no list to allow. Verify the signature instead.
- 2 Only the symmetric v1 signature is sent; there is no ed25519 (v1a) one.
- 3 An endpoint must be a public address. Homing refuses localhost and private networks, checks the address again before every send and connects to the address it checked. Only ports 443 and 8443 are allowed.
- 4 A redirect is never followed, so give the final URL.
Do this with your agent
Run it in the project that hosts your endpoint. It writes code and sends nothing.
Write a receiver for Homing webhooks in this project, in the language and framework it already uses. Read https://tryhoming.com/guides/webhook-receiver.md first and follow it exactly. In particular: - Verify the signature on the raw request body, as received, before parsing it or acting on it. Compare in constant time. Reject a request whose timestamp is outside the tolerance the page gives. - Read the signing secret from an environment variable. Never put it in the code, a log line or this chat, and do not ask me to paste it. - Answer 2xx first, then do the work. - Delivery is at least once: keep the webhook-id values you have handled and drop repeats. - Ignore fields you do not know. Order by data.delivered_at (Full message) or the field the mapping puts it in, not by arrival. Then show me how to test it with a signed request, and run that test.