Webhook to LinkedIn: n8n template that queues requests for approval

This n8n workflow gives any system a webhook for LinkedIn post requests. A new request ID is queued and answered 202, a repeated ID is answered 200 as a duplicate, and a request without id and text is answered 400. A person approves rows in a data table, and each approved row posts once through PubNio.

Download workflow JSON
Checked on n8n 2.50.7LinkedIn: LiveView as Markdown

What it does.

  • Trigger. A Webhook node (POST, Header Auth) queues requests; a Schedule Trigger every 15 minutes posts approved ones.
  • Approval. Set approved to true on the request's row in the data table.
  • Request. One create request per approved item. Each create carries the item's saved key as Idempotency-Key, and every request sends PubNio-Version: 2026-12-02.
  • Result. The answer is written back to the item; the next runs read the post's status until every destination settles.

Fields: Data table pubnio_requests.

The workflow also fills pubnio_key, pubnio_post_id, pubnio_status, pubnio_outcome, pubnio_error, pubnio_sent_at; create them as text fields.

Data table pubnio_requests
FieldTypeUse
source_idstringrequest-<id> from the caller's id.
textstringThe post text from the request.
detailstringThe optional image_url from the request.
approvedbooleantrue posts the request.

Set up.

  1. Create a PubNio API key. In PubNio, create an API key with the publish scope; it includes read, which the status checks use.
  2. Import the workflow. Download the JSON and import it into n8n with Import from File. It is checked on n8n 2.50.7.
  3. Add the PubNio credential. Create a Header Auth credential named PubNio API key with name Authorization and value Bearer followed by the key. Select it on Create post in PubNio, Read post status, Import media, Read media status.
  4. Fill PubNio settings. Open the PubNio settings node and set workspaceId, linkedinAccountId. linkedinAccountId: The LinkedIn account ID from PubNio's list of connected accounts.
  5. Create the pubnio_requests data table. In n8n, create a data table named pubnio_requests with the fields above plus the pubnio_ text fields. On Post request, create a Header Auth credential for callers; give them the production webhook URL and that header.
  6. Run one approved test item. Approve one test item, run the workflow once, and read pubnio_status and pubnio_outcome. Then activate it.

Request.

The webhook body is {"id", "text", "image_url"?}; the id is the caller's own, so its retries are answered as duplicates. PubNio does not post this network's media from a URL, so the workflow first has PubNio import image_url, waits for the import to be ready, and sends the media ID it returns.

create-post.json
{
  "text": "We are hiring.",
  "accounts": [
    "33333333-3333-4333-8333-333333333333"
  ],
  "media": [
    {
      "mediaId": "aaaaaaaa-1111-4aaa-8aaa-aaaaaaaaaaaa"
    }
  ]
}

Tested behavior.

The download is imported unchanged into a clean n8n 2.50.7 container, and its node types, versions, parameters, and operations are checked against that release. Then a copy runs with n8n execute. Its PubNio requests and its Code, If, Switch, and Merge nodes run as published. Its trigger and source nodes are simulated by a fake source with the same row shapes, its media wait is cut to one second, and PubNio is a fake API that decodes every request with PubNio's own schemas and checks it with PubNio's own content rules. PubNio's test suite replays every create and validate request the run sent against the real API and requires the same answer. It proves:

  • Only approved items are sent to PubNio.
  • The key is a hash of the stable row ID, saved on the row with its send time before the request that sends it.
  • A lost response (503 after PubNio admitted the post) is resent with the same key and PubNio returns the first post.
  • A key with no post ID that was sent 23 hours and 1 minute ago, or has no send time, stops at needs_review instead of being resent.
  • A 202 is recorded as queued or scheduled, never as published, until a delivery reports it.
  • Requests are answered Answer queued 202, Answer duplicate 200, and Reject request 400 in that order, and the repeat queues nothing.
  • The approved request posts once to the configured LinkedIn account with its image, imported first and sent as media[0].mediaId; when the delivery fails, the row records failed and PubNio's next action.

Recovery.

  • When the caller gets 400: Send JSON with both id and text.
  • When the caller retries after a timeout: It gets 200 with duplicate: true; the first request is already queued.
  • When pubnio_error starts Media import failed: PubNio could not fetch image_url. Point it at a public HTTPS file, clear pubnio_status, and the next run imports it again.
  • When pubnio_status is media_processing: Nothing to do: PubNio is still importing the file, and the next run checks the same import again.

Limits.

  • The webhook answers when the request is queued, not when it posts; the caller reads the outcome from the data table or PubNio.
  • Data tables are an n8n feature; this template needs an n8n version with them.
  • PubNio has no approval step of its own; approval happens in Webhook before n8n calls PubNio.
  • The check uses a fake PubNio and fake provider answers, so this page shows no real delivery.

Import it and send one test row.

Connect accounts for free, create an API key, and run the workflow once with one approved item.