Skip to content
ShapelessAI← Back
Publishing

Webhooks

Signed POSTs to your URL when a post is published, fails, or its first comment settles: register, verify with Standard Webhooks, retries and the delivery log.

Verified
View as Markdown

Register an https URL and ShapelessAI POSTs to it when one of the account's posts settles. No polling, and every request is signed so your server knows it came from us.

Register

curl -s https://shapelessai.com/api/webhooks -H "Authorization: Bearer $SHAPELESS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hooks/shapeless","events":["post.published","post.failed"]}'
# {"webhook":{"id":"wh_1","url":"...","secret":"whsec_...","events":[...],"disabled":false,...}}

Needs write. events defaults to all four. Keep the secret: it verifies every request. At most 10 endpoints per account; the URL must be https on a public address (a private, loopback or cloud-metadata address is refused, on every redirect too).

EventWhen
post.publishedA post went live (or you marked it posted). data.post.publishedLocation is its URL.
post.failedA post will not go out without a person: out of retries, refused by the platform, or by a plan limit. data.post.error says why. A transient failure we retry sends nothing.
post.commentOne item of the post's comment chain settled (the first comment is index 0): data.comment is {index, status: sent|failed|skipped, url, error}.
post.plugOne of the post's plugs settled: data.plug is {id, action, status: fired|failed|expired, url, error}.

The request

POST /hooks/shapeless HTTP/1.1
Content-Type: application/json
webhook-id: msg_2b1f...           # the same on every retry: dedupe on it
webhook-timestamp: 1795430400     # unix seconds
webhook-signature: v1,K5oZ...     # HMAC-SHA256, base64

{"type":"post.published","timestamp":"2026-11-23T09:00:04.120Z",
 "data":{"post":{"id":"p_1","status":"published","platform":"linkedin","connectionId":"c_1",
  "scheduledAt":"2026-11-23T09:00:00.000Z","publishedAt":"2026-11-23T09:00:04.120Z",
  "publishedLocation":"https://www.linkedin.com/feed/update/...","error":null,
  "tagIds":[],"repeatEveryDays":null}}}

It follows Standard Webhooks: the signature is HMAC-SHA256 over <webhook-id>.<webhook-timestamp>.<raw body> with the base64-decoded part of the secret after whsec_. Any of their libraries verifies it in one call:

import { Webhook } from "standardwebhooks";
const event = new Webhook(process.env.SHAPELESS_WEBHOOK_SECRET!).verify(rawBody, headers);

Verify against the raw body (re-serialized JSON will not match) and reject a timestamp far from now.

Retries and the log

Events go out seconds after they happen, through a task of their own: a slow or dead URL never holds a post, a comment chain or a plug. Answer any 2xx within 5 seconds. Anything else is retried 5 minutes, 30 minutes, 2, 5, 10, 14, 20 and 24 hours later, then marked failed. GET /api/webhooks/{id} is the delivery log (newest 50: event, status, attempts, last answer, the body sent); POST /api/webhooks/{id}/deliveries/{deliveryId} sends one again now, with the same webhook-id.

POST /api/webhooks/{id}/test sends one signed webhook.test event and answers what your URL said. PATCH /api/webhooks/{id} takes url, events, description, disabled, and rotateSecret: true (a new secret; the old one stops verifying at once). DELETE removes it and drops whatever was still owed.

From an agent: webhooks_save (MCP), shapeless webhooks create <url> (CLI).