Skip to content

Webhook

For your developer: ThirdDraft sends each finished article as a signed JSON POST to an https endpoint you build, and your code publishes it.

On this page

What you need

A public https address that takes a POST: your site's own code, or a webhook trigger in Zapier, Make or n8n (in n8n, the Production URL). Copy instructions for your AI agent, on the form, copies this contract, without the secret, as one brief for a coding agent.

Connect it

  1. In ThirdDraft, open your website's Publishing page and choose Webhook (from Add a destination if the page already lists one).
  2. Enter the Endpoint URL, and a Name if you want one. Click Continue.
  3. Copy the Signing secret and set it on your server, for example as THIRDDRAFT_SECRET.
  4. Click Send test. Until a test gets through, the card reads Waiting for a test and nothing is sent.

The request

  • X-ThirdDraft-Event: article.ready, or test.
  • X-ThirdDraft-Delivery: the event's id, also id in the body. The same on every automatic retry, new when someone sends the article again. Ignore an id you've handled.
  • X-ThirdDraft-Signature: t=<unix seconds>,v1=<signature>, the hex HMAC-SHA256 of t, a full stop and the raw body, keyed with your secret exactly as shown, whsec_ included. Compare in constant time; refuse a t more than five minutes old.
import crypto from 'node:crypto';

// rawBody: the request body exactly as it arrived.
function isFromThirdDraft(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
  const expected = crypto.createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex');
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) <= 300;

  return fresh && typeof parts.v1 === 'string' && parts.v1.length === expected.length
    && crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
}

The body

FieldWhat it holds
event, id, created_at, testThe event, its id, when it was made, true for a test
site.id, site.domainYour website
article.idCreate or update your post by it
article.title, slug, languageTitle, suggested address, two-letter language code
article.meta_title, meta_description, keywordFor search results, and the phrase it targets
article.content_markdown, content_htmlThe text; the title and featured picture come separately
article.featured_image, imagesPictures: id, sha256, url, alt
article.images_expire_atWhen picture addresses stop working
article.word_count, planned_for, written_atLength, calendar day, when written

Picture addresses work for seven days: copy the pictures to your own storage before then. A test has the same shape, with "test": true and no real article. Answer it with success and keep nothing.

What to answer

  • Any 2xx is taken. Answer with JSON holding url, the post's address once live: on your website's domain, a subdomain or its blog, it marks the article published. An id is kept as your id for it.
  • 3xx, 401, 403, 404, 405 or 410 stops the webhook until a test gets through.
  • Any other 4xx turns that article away; the next ones still go.
  • 408, 425, 429, 5xx, or no answer within 30 seconds, is tried again with the same event id.

Updating earlier articles

When a new article goes live, we can add a link to it in up to three earlier articles and send each again to your endpoint. This is off until you turn it on, because your endpoint has to handle it:

  • In every 2xx answer, add modified_at: when the post was last changed, in ISO 8601 ({"url": "https://…", "modified_at": "2026-11-18T09:30:00Z"}). Nothing is sent as an update before your endpoint has answered with it.
  • An update arrives as the event article.updated, with update.if_modified_at: the modified_at you last gave for that article.
  • Answer 412 with {"refused": "gone"} where you have no post for that article.id, {"refused": "not_live"} where it isn't live, and {"refused": "edited"} where it changed since that moment. Then nothing is changed.
  • Otherwise update the post's text, title and pictures, never its status, address or date, and answer 200 with its new modified_at.

Then turn on Update earlier articles here in the webhook's Edit. Copy instructions for your AI agent includes all of this. See Links to new articles.

Changing or removing it

  • Edit changes the name and the Endpoint URL. A new address waits for a test.
  • Roll secret makes a new secret. The old one stops at once; nothing is sent until a test with the new one gets through.
  • Setup details shows the secret and the test again. Only the workspace owner and admins see the secret.
  • Remove stops sending there.