Skip to content

n8n integration

n8n has no dedicated NativPost node, but the generic HTTP Request node covers every endpoint. This guide sets up both directions.

One-time: store the API key as a credential

Section titled “One-time: store the API key as a credential”
  1. In n8n, open Credentials → New → Header Auth.
  2. Name: NativPost API.
  3. Header name: Authorization.
  4. Header value: Bearer np_live_....

Keys start with np_live_. Reference this credential from every HTTP Request node instead of pasting the key inline.

  1. Add an HTTP Request node.

  2. Configure:

    • Method: POST

    • URL: https://app.nativpost.com/api/v1/content

    • Authentication: Header Auth, NativPost API

    • Send Body: JSON, using expressions to pull fields from earlier nodes:

      {
      "caption": "={{$json.text}}",
      "content_type": "text_only",
      "target_platforms": ["twitter", "linkedin"]
      }
  3. Wire an upstream node (Airtable, Notion, Schedule Trigger, whatever) into the HTTP node.

Field names to get right: the copy goes in caption, destinations go in target_platforms, and X’s platform id is twitter. caption is the only required field; content_type defaults to single_image, so set it explicitly for text posts.

To attach media, add "media_urls": ["https://..."] — absolute URLs, in order, max 20.

Add a second HTTP Request node with method PATCH against https://app.nativpost.com/api/v1/content/{{$json.id}}:

{
"status": "scheduled",
"scheduled_for": "={{$json.when}}"
}

Or POST to https://app.nativpost.com/api/v1/content/{{$json.id}}/publish with an empty body to queue it for the next cron run. That returns 202 and publish_queued: true — it does not publish inline, so do not branch on per-platform results from this response.

  1. Add a Webhook node. Set method POST and copy the production URL.

  2. In the NativPost dashboard, go to Settings → Webhooks and add an endpoint pointed at that URL, subscribed to the events you want.

    The API cannot create webhook endpoints. GET /api/v1/webhooks is read-only — useful to confirm registration, not to perform it:

    Terminal window
    curl -sS https://app.nativpost.com/api/v1/webhooks \
    -H "Authorization: Bearer $NATIVPOST_API_KEY"
  3. There is no test-fire endpoint. To get a sample into n8n so you can map fields, create a throwaway draft over the API — content.created fires immediately.

Each delivery is attempted once with a 10-second timeout, with no retries, and the endpoint is auto-disabled after 20 consecutive failures. Keep the Webhook node’s response immediate and push slow work downstream.

Add a Code node right after the Webhook node with the Node.js verifier from Signature verification. Read the header from $json.headers["nativpost-signature"] — n8n lowercases incoming header names — and the raw body from $binary.data (enable Raw Body on the Webhook node first). Throw to abort the workflow on a bad signature.

$json.headers["nativpost-event"] carries the event name if you want to route with a Switch node before verifying, and nativpost-delivery-id uniquely identifies the attempt.

There is no upload endpoint on /api/v1, so the HTTP Request node’s multipart mode has nothing to target. Two options:

  • Upload in the NativPost dashboard under Content → Media, then read URLs back with GET /api/v1/media-library and feed them into media_urls.
  • Host the file yourself and pass your own public URL.

The API applies no rate limit and supports no idempotency key. If an n8n workflow retries a failed HTTP Request node, the retry creates a second content object. Use n8n’s error workflow rather than blind node-level retries on the create step.