Webhooks
Receive signed events as posts and accounts change.
On this page
Subscribe and send a test
On Team or Agency, workspace admins and owners can add an endpoint in Settings → Webhooks or send POST /api/v1/webhooks with a Publishing admin key. Use a public HTTPS URL on port 443 without credentials or a fragment.
{
"url": "https://receiver.example.com/posthoop",
"events": ["post.target.published", "post.target.failed"]
}New endpoints are active by default. Save the response's signingSecret when it appears. To test an active endpoint, call POST /api/v1/webhooks/{id}/test. The 202 response returns a deliveryId and an eventId.
Events and payloads
Posthoop sends a JSON POST with id, type, createdAt, workspaceId, and data. Posthoop-Event-Id and Posthoop-Event-Type repeat the event ID and type.
| Event | When it fires | Fields in data |
|---|---|---|
| post.scheduled | A post gets an explicit or queue time, or its time changes. | postId, scheduledAt |
| post.target.published | A destination confirms publication. | postId, targetId, accountId, externalId, externalUrl, error |
| post.target.failed | A target fails without another retry scheduled. | postId, targetId, accountId, externalId, externalUrl, error |
| post.target.unknown | Posthoop cannot confirm a target's outcome. | postId, targetId, accountId, externalId, externalUrl, error |
| account.needs_reauth | An active social account is marked as needing reconnection. | accountId, platform |
| account.connected | An account connects or reconnects. Link fields can be null. | accountId, platform, connectLinkId, externalRef |
| sync.post.created | A sync flow or backfill creates a post. | originAccountId, originPostId, flowId, postId |
| sync.post.skipped | A sync flow or backfill skips a destination. | originAccountId, originPostId, flowId, destinationAccountId, reason |
| post.approval_requested | A submission is held for review. | postId, revision |
| post.approved or post.rejected | A reviewer decides on a submission. | postId, revision, comment, reviewerId |
| inbox.comment.created | Posthoop imports a new comment. | commentId, accountId, targetId, platform, externalId |
| webhook.test | An admin sends a test to this endpoint. | Empty object |
externalId, externalUrl, and error can be null. Use webhook.test to verify delivery and signing. It is sent through the test action outside the subscription list.
{
"id": "6ec855cc-3d45-4c10-b440-1fd1c103c539",
"type": "post.scheduled",
"createdAt": "2027-01-14T19:20:00.000Z",
"workspaceId": "f926ccb6-1219-4db8-9b2c-2999e5f48a75",
"data": {
"postId": "98086614-51a0-4bf0-b0fa-7f798fe423ab",
"scheduledAt": "2027-01-15T14:00:00.000Z"
}
}Verify the signature
Read Posthoop-Signature in the form t=<unix seconds>,v1=<hex digest>. The signed bytes are the timestamp, a period, and the original request body. Verify with HMAC-SHA256 and the endpoint's signing secret before parsing JSON. Reject timestamps more than five minutes away and compare the digest in constant time.
import { createHmac, timingSafeEqual } from "node:crypto";
// rawBody is a Buffer read from the HTTP request.
export function verifyPosthoop(rawBody, signature, secret) {
const match = /^t=([1-9]\d*),v1=([0-9a-f]{64})$/.exec(signature ?? "");
if (!match) return false;
const timestamp = Number(match[1]);
const now = Math.floor(Date.now() / 1000);
if (!Number.isSafeInteger(timestamp) || Math.abs(now - timestamp) > 300) {
return false;
}
const expected = createHmac("sha256", secret)
.update(match[1] + ".")
.update(rawBody)
.digest();
return timingSafeEqual(expected, Buffer.from(match[2], "hex"));
}import hashlib
import hmac
import re
import time
def verify_posthoop(raw_body: bytes, signature: str | None, secret: str) -> bool:
match = re.fullmatch(r"t=([1-9][0-9]{0,15}),v1=([0-9a-f]{64})", signature or "")
if match is None:
return False
timestamp, supplied = match.groups()
if abs(int(time.time()) - int(timestamp)) > 300:
return False
signed = timestamp.encode("ascii") + b"." + raw_body
expected = hmac.new(secret.encode("utf-8"), signed, hashlib.sha256).digest()
return hmac.compare_digest(expected, bytes.fromhex(supplied))Acknowledge and inspect deliveries
Verify the request, persist or enqueue the event, and respond with a 2xx within 10 seconds. Deduplicate using the event id. Each retry uses the same event ID and a fresh signature timestamp.
Posthoop treats redirects and other non-2xx responses as failures. Retry delays are 1 minute, 5 minutes, 30 minutes, 2 hours, 8 hours, and 24 hours. Changing the endpoint URL or turning it off cancels outstanding deliveries when they run.
Inspect results in Settings → Webhooks → Delivery log or GET /api/v1/webhooks/{id}/deliveries. The API returns each payload, status, attempts, HTTP status codes, and the next retry time if one is scheduled. Use limit and offset to page through the log.