Webhooks
Postia calls your HTTPS endpoint when something happens. Add endpoints in the console or with the API; the scope is webhooks:manage.
Events
| Event | Sent when |
|---|---|
post.published | A post went out to one channel. One event per channel. |
post.failed | A post could not be sent to one channel. |
channel.disconnected | A channel lost its access and has to be connected again. |
ping | You asked for a test delivery. |
An endpoint made with an API key hears about its owner's posts and channels. An endpoint made by an OAuth app hears about the users who let the app in, for the events whose scope they granted.
{
"id": "evt_0a1b2c3d4e5f60718293a4b5",
"type": "post.published",
"created_at": "2026-12-24T09:00:03Z",
"data": {
"post_id": "0191c1a4-8e2b-7c3d-9a10-5b7c2f1d3e44",
"channel_id": "0191c1a4-1111-7c3d-9a10-5b7c2f1d3e44",
"status": "published",
"url": "https://t.me/example/42"
}
}
Delivery
- Postia sends a
POSTwith the JSON event as the body and the headersPostia-Event-IdandPostia-Signature. - Answer with any 2xx within 10 seconds. The body of your answer is ignored.
- Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 24 hours, then the delivery is marked failed.
- An endpoint with no success for 3 days is switched off. Fix it and set
active: true. - The URL must be https on port 443 and resolve to a public address. Redirects are not followed.
- Events can arrive more than once and out of order. Use
idto ignore repeats. - Delivery history is kept for 30 days. You can redeliver an event from the console or the API.
Verify the signature
Postia-Signature is t=<unix seconds>,v1=<hex>. The value v1 is the HMAC-SHA256 of <t>.<raw body>, keyed with the endpoint's whsec_... secret. Use the raw bytes, compare in constant time, and refuse a timestamp more than 5 minutes from your clock. The secret is shown once, when the endpoint is created or its secret rotated.
import { createHmac, timingSafeEqual } from "node:crypto";
// rawBody is the Buffer you received, before any JSON parsing.
export function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = createHmac("sha256", secret)
.update(`${parts.t}.`).update(rawBody).digest("hex");
const a = Buffer.from(expected), b = Buffer.from(parts.v1 || "");
return a.length === b.length && timingSafeEqual(a, b);
}
import hashlib, hmac, time
def verify(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > 300:
return False
signed = parts["t"].encode() + b"." + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))