{
  "name": "Publish a post now",
  "nodes": [
    {
      "parameters": {},
      "id": "b1c2d3e4-0001-4a5b-9c0d-111111111111",
      "name": "When clicking 'Test workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "// Edit the values below, then run the workflow.\n// channelId: your connected channel id. Find it in the app under Settings > Channels,\n// or run the 'List channels' node from the other workflows and copy the id.\n// platform: the provider identifier used in settings.__type (x, instagram, linkedin, threads, ...).\nconst channelId = 'REPLACE_WITH_CHANNEL_ID';\nconst platform = 'x';\nconst content = 'Hello from PostSider and n8n! \ud83d\udc4b';\nconst firstComment = ''; // optional, leave '' to skip\n\nreturn [{\n  json: {\n    body: {\n      type: 'now',\n      date: '',\n      shortLink: false,\n      tags: [],\n      posts: [{\n        integration: { id: channelId },\n        value: [{ content, image: [] }],\n        ...(firstComment ? { firstComment } : {}),\n        settings: { __type: platform }\n      }]\n    }\n  }\n}];"
      },
      "id": "b1c2d3e4-0002-4a5b-9c0d-222222222222",
      "name": "1. Your post",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.postsider.com/public/v1/posts",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.body) }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Idempotency-Key",
              "value": "=post-{{ $now.toISO() }}"
            }
          ]
        }
      },
      "id": "b1c2d3e4-0003-4a5b-9c0d-333333333333",
      "name": "2. Publish to PostSider",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        0
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "1",
          "name": "PostSider API Key"
        }
      }
    },
    {
      "parameters": {
        "height": 300,
        "width": 460,
        "content": "SETUP (once):\n\n1. Create an API key in PostSider: app.postsider.com > Settings > API. It starts with ps_.\n2. In n8n create a Header Auth credential: Name = Authorization, Value = your ps_ key.\n3. Select that credential on the '2. Publish to PostSider' node.\n4. Edit the values in '1. Your post' (channel id, text, platform).\n\nSelf-hosted PostSider? Replace api.postsider.com with your domain (add /api if your install serves the API under /api).\n\nThe Idempotency-Key header makes retries safe: a repeated run within 24h returns the original result instead of a duplicate post.",
        "color": 3
      },
      "id": "b1c2d3e4-0004-4a5b-9c0d-444444444444",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -320
      ]
    },
    {
      "parameters": {
        "content": "SETUP STEP BY STEP\nFollow in order. Do this once per workflow.\n\nSTEP 1 - Create the n8n credential (Header Auth, do this once):\n  \"PostSider API Key\": Name = Authorization, Value = your ps_ key (app.postsider.com > Settings > API > Create key).\n\nSTEP 2 - \"1. Your post\" (Set node):\n  Fill in: text (your post), channelId (a real channel id from app > Settings > Channels), and if your platform needs it, the settings value.\n\nSTEP 3 - Select the \"PostSider API Key\" credential on:\n  - \"2. Publish to PostSider\"\n\nSTEP 4 - Run:\n  Click \"Test workflow\" once. The post publishes immediately.\n\nNOTE\nSelf-hosted PostSider? Replace api.postsider.com with your domain (add /api if your install serves the API under /api).",
        "height": 620,
        "width": 640,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -700
      ],
      "id": "setup-step-publish-now",
      "name": "Setup step by step"
    }
  ],
  "connections": {
    "When clicking 'Test workflow'": {
      "main": [
        [
          {
            "node": "1. Your post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1. Your post": {
      "main": [
        [
          {
            "node": "2. Publish to PostSider",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}