Pogton
Docs Webhooks

API reference

Webhooks

Receive signed events when posts publish, fail or are scheduled and when accounts connect or need to reconnect. Payloads, signature checks in Node and Python, retries.

Webhooks tell your server when something happens without polling: a scheduled post went out, a platform rejected a post, an account needs to reconnect. Pogton sends a signed POST with a JSON body to each endpoint you register.

Events

EventWhen
post.scheduledA post was scheduled with scheduled_at or added to the queue.
post.publishedEvery target of a post was published.
post.partially_publishedSome targets were published and at least one failed for good.
post.failedNo target could be published, after automatic retries.
post.cancelledA draft or scheduled post was cancelled.
post.deletedA published post was deleted from one or more platforms.
account.connectedA user connected an account, or a sandbox account was created.
account.disconnectedAn account was disconnected through the API, by the user, or because the user was deleted.
account.needs_reauthAn account's token stopped working. Sent once, when the status changes.
message.receivedA connected account received a direct message. See Inbox.
automation.triggeredA comment automation matched a comment and sent (or tried to send) a DM.
webhook.testSent by POST /webhooks/{id}/test.

Post events fire when a post's status changes, so a post published now sends post.published (or post.failed) once, and a post that retries sends the final outcome when it is known.

Register an endpoint

In the dashboard under Connect → Webhooks, or with the API:

curl -X POST https://pogton.com/api/v1/webhooks \
  -H "Authorization: Bearer pk_3f9a..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production",
    "url": "https://api.example.com/webhooks/pogton",
    "events": ["post.published", "post.partially_published", "post.failed", "account.needs_reauth"]
  }'
{
  "id": "q47f6g7h8j9k0m1n2p3q4r5s6t7u8v9w",
  "name": "Production",
  "description": null,
  "url": "https://api.example.com/webhooks/pogton",
  "events": ["post.published", "post.partially_published", "post.failed", "account.needs_reauth"],
  "enabled": true,
  "created_at": "2026-10-21T09:00:00.000Z",
  "updated_at": "2026-10-21T09:00:00.000Z",
  "secret": "whsec_6a1f0c3b9d2e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
  "message": "Store the secret now; it is not shown again."
}
  • events takes any of the events above, or ["*"] for all of them.
  • URLs must be public HTTPS. Endpoints registered with a test key may use http://, for local tunnels.
  • The secret is returned only in this response. Store it with your other secrets.

Payload

Every event has the same envelope:

{
  "id": "evt_3f2a1b0c9d8e7f6a5b4c3d2e",
  "event": "post.published",
  "created_at": "2026-10-21T09:00:03.000Z",
  "test": false,
  "data": {
    "post": {
      "id": "k57c2d9e1f3g5h7j9k1m3n5p7q9r2s4t",
      "status": "published",
      "user_id": "user_123",
      "content": "Our spring collection is out today.",
      "metadata": { "campaign_id": "spring-26" },
      "targets": [
        {
          "account_id": "j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed",
          "platform": "linkedin",
          "status": "published",
          "platform_post_id": "urn:li:share:7234567890",
          "url": "https://www.linkedin.com/feed/update/urn:li:share:7234567890",
          "error": null
        }
      ],
      "...": "the full post object"
    }
  }
}

test is true for events about test-mode posts and for webhook.test. Post events carry the full post object in data.post, including your metadata. post.deleted also has data.results, one per account, as in the delete response.

account.connected:

{
  "id": "evt_8a7b6c5d4e3f2a1b0c9d8e7f",
  "event": "account.connected",
  "created_at": "2026-10-21T09:00:00.000Z",
  "test": false,
  "data": {
    "platform": "instagram",
    "account_id": "j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed",
    "account_name": "Acme Studio",
    "user_id": "user_123"
  }
}

account.disconnected has platform, account_id, account_name, user_id (when known) and reason: api (DELETE /accounts/{id}), end_user (on the connect page) or user_deleted (DELETE /users/{id}).

account.needs_reauth:

{
  "id": "evt_1c2d3e4f5a6b7c8d9e0f1a2b",
  "event": "account.needs_reauth",
  "created_at": "2026-10-21T09:00:00.000Z",
  "test": false,
  "data": {
    "account_id": "j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed",
    "platform": "linkedin",
    "account_name": "Acme Inc.",
    "reason": "Token expired and could not be refreshed: LinkedIn tokens can't be refreshed"
  }
}

When you get it, send the user a reconnect link.

The full schema of every payload is in the webhooks section of the OpenAPI spec.

Headers

HeaderValue
X-Pogton-EventThe event, e.g. post.published.
X-Pogton-Event-IdThe event ID (evt_…). The same on every delivery of the event.
X-Pogton-DeliveryThe delivery ID.
X-Pogton-Attempt1 for the first attempt, up to 6.
X-Pogton-Signature-V2t=<unix seconds>,v1=<signature>. Verify this one.
X-Pogton-Signaturesha256=<signature of the body>. The first version, kept for existing integrations.
X-Pogton-TimestampThe same timestamp as t.
User-AgentPogton-Webhooks/1.0

Verify the signature

v1 is the hex HMAC-SHA256 of <t>.<raw body>, keyed with the endpoint secret. Because the timestamp is signed, you can reject old requests: anyone who captured a request can't replay it later.

  1. Read the raw body before any JSON parsing; a re-serialised body won't match.
  2. Split X-Pogton-Signature-V2 into t and v1.
  3. Reject the request if t is more than 5 minutes from your clock.
  4. Compute the HMAC of t + "." + body and compare it to v1 in constant time.

Node.js

import crypto from 'node:crypto'
import express from 'express'

const SECRET = process.env.POGTON_WEBHOOK_SECRET
const TOLERANCE_SECONDS = 300

function verifyPogtonSignature(rawBody, header, secret) {
  if (!header) return false
  const parts = Object.fromEntries(header.split(',').map((part) => {
    const i = part.indexOf('=')
    return [part.slice(0, i), part.slice(i + 1)]
  }))
  const timestamp = Number(parts.t)
  if (!timestamp || !parts.v1) return false
  if (Math.abs(Date.now() / 1000 - timestamp) > TOLERANCE_SECONDS) return false

  const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest()
  const received = Buffer.from(parts.v1, 'hex')
  return received.length === expected.length && crypto.timingSafeEqual(received, expected)
}

const app = express()

// express.raw keeps the body as bytes, exactly as signed
app.post('/webhooks/pogton', express.raw({ type: 'application/json' }), (req, res) => {
  const rawBody = req.body.toString('utf8')
  if (!verifyPogtonSignature(rawBody, req.get('X-Pogton-Signature-V2'), SECRET)) {
    return res.status(400).send('Invalid signature')
  }
  const event = JSON.parse(rawBody)
  res.sendStatus(200) // answer first, then do the work
  handleEvent(event).catch(console.error)
})

Python

import hashlib
import hmac
import json
import os
import time

from flask import Flask, abort, request

SECRET = os.environ["POGTON_WEBHOOK_SECRET"].encode()
TOLERANCE_SECONDS = 300

def verify_pogton_signature(raw_body: bytes, header: str | None) -> bool:
    if not header:
        return False
    try:
        parts = dict(part.split("=", 1) for part in header.split(","))
        timestamp = int(parts["t"])
        received = parts["v1"]
    except (KeyError, ValueError):
        return False
    if abs(time.time() - timestamp) > TOLERANCE_SECONDS:
        return False
    signed = f"{timestamp}.".encode() + raw_body
    expected = hmac.new(SECRET, signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, received)

app = Flask(__name__)

@app.post("/webhooks/pogton")
def pogton_webhook():
    raw_body = request.get_data()  # bytes, before any parsing
    if not verify_pogton_signature(raw_body, request.headers.get("X-Pogton-Signature-V2")):
        abort(400)
    event = json.loads(raw_body)
    queue_for_processing(event)
    return "", 200

The first-version header, X-Pogton-Signature: sha256=<hex>, is the HMAC of the body alone, without a timestamp. It is still sent, but new integrations should check V2.

Responding and retries

Answer with any 2xx status within 10 seconds. Do the work afterwards, for example in a job queue. Anything else counts as a failure: another status, a timeout, a connection error, or a redirect (redirects aren't followed).

Failed deliveries are retried with the same event ID and body, and a fresh signature:

AttemptAfter the previous one
1Right away
21 minute
35 minutes
430 minutes
52 hours
612 hours

That is six attempts over about 15 hours. After the sixth the delivery is failed; you can still redeliver it by hand. Disabling or deleting an endpoint stops its retries.

Two things to build for:

  • Duplicates. A delivery can arrive twice, for example when your server took the request but timed out answering. Use id (or X-Pogton-Event-Id) to skip events you have already handled.
  • Order. Events can arrive out of order. When order matters, compare created_at, or fetch the post with GET /posts/{id} for its current status.

Deliveries

Every attempt is logged, in the dashboard and through the API:

curl "https://pogton.com/api/v1/webhooks/q47f6g7h8j9k0m1n2p3q4r5s6t7u8v9w/deliveries?limit=20" \
  -H "Authorization: Bearer pk_3f9a..."
{
  "data": [
    {
      "id": "r57g7h8j9k0m1n2p3q4r5s6t7u8v9w0x",
      "event_id": "evt_3f2a1b0c9d8e7f6a5b4c3d2e",
      "event": "post.published",
      "status": "retrying",
      "attempt": 2,
      "status_code": 503,
      "error": "HTTP 503",
      "next_attempt_at": "2026-10-21T09:06:03.000Z",
      "created_at": "2026-10-21T09:00:03.000Z",
      "finished_at": "2026-10-21T09:01:04.000Z"
    }
  ],
  "next_cursor": null,
  "has_more": false
}

status is pending, delivered, retrying or failed. GET /webhooks/{id}/deliveries/{delivery_id} adds request_body (what was sent) and response_body (the first 2,000 characters of your answer).

Redeliver

curl -X POST https://pogton.com/api/v1/webhooks/q47f6g7h8j9k0m1n2p3q4r5s6t7u8v9w/deliveries/r57g7h8j9k0m1n2p3q4r5s6t7u8v9w0x/redeliver \
  -H "Authorization: Bearer pk_3f9a..."

Sends the same event again as a new delivery, with the same event ID and a new signature and timestamp. Returns the new delivery with your endpoint's response. Use it after fixing a bug in your handler.

Send a test event

curl -X POST https://pogton.com/api/v1/webhooks/q47f6g7h8j9k0m1n2p3q4r5s6t7u8v9w/test \
  -H "Authorization: Bearer pk_3f9a..."

Sends a signed webhook.test event right away and returns the delivery, including the status code and body your endpoint returned. Test events are not retried.

Manage endpoints

RequestWhat it does
GET /api/v1/webhooksList endpoints, plus available_events. Secrets are never returned.
GET /api/v1/webhooks/{id}One endpoint.
PATCH /api/v1/webhooks/{id}Change name, description, url, events or enabled.
DELETE /api/v1/webhooks/{id}Delete the endpoint. Pending retries stop.
POST /api/v1/webhooks/{id}/rotate-secretReplace the secret.

To pause deliveries, PATCH with "enabled": false.

Rotate the secret

curl -X POST https://pogton.com/api/v1/webhooks/q47f6g7h8j9k0m1n2p3q4r5s6t7u8v9w/rotate-secret \
  -H "Authorization: Bearer pk_3f9a..."
{ "id": "q47f6g7h8j9k0m1n2p3q4r5s6t7u8v9w", "secret": "whsec_9b8a7c6d...", "message": "Store the secret now; it is not shown again." }

The old secret stops working immediately; retries after this are signed with the new one. To rotate without dropping events, have your handler accept either secret for a few minutes: deploy with both, rotate, then remove the old one.