Postia API
EN
Console

Webhooks

Postia calls your HTTPS endpoint when something happens. Add endpoints in the console or with the API; the scope is webhooks:manage.

Events

EventSent when
post.publishedA post went out to one channel. One event per channel.
post.failedA post could not be sent to one channel.
channel.disconnectedA channel lost its access and has to be connected again.
pingYou 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

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", ""))