{
  "id": "V3L2JB-lIHLWt8N5J3bjY",
  "name": "Post scheduled social content to Facebook, Instagram and TikTok with Meta and Buffer",
  "tags": [],
  "nodes": [
    {
      "id": "7fcbbd04-0e1c-4429-9780-8a55293ff6ea",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        400
      ],
      "parameters": {
        "width": 800,
        "height": 1280,
        "content": "## Post scheduled social content to Facebook, Instagram and TikTok\n\nPolls your app every 2 minutes for due posts and publishes each one to the right platforms (image or video/Reel) via the Meta Graph API and Buffer, then reports success or failure back to your app.\n\n### Who's it for\nDevelopers and SaaS builders who run their own post scheduler (database + API) and want n8n to handle the actual publishing.\n\n### How it works\n1. Every 2 minutes, the workflow calls your app's `/posts/due` endpoint to fetch scheduled posts.\n2. It fans out to 3 branches (Facebook, Instagram, TikTok) based on each post's `platforms` list.\n3. Each branch publishes a photo or a video/Reel (Instagram Reels are polled until processing finishes).\n4. A `POSTED` or `FAILED` result (with the external post ID or the error) is sent back to `/posts/{id}/result`.\n\n### How to set up\n1. Open the **Workflow configuration** node and fill in the 5 values: your app URL, client ID, Facebook Page ID, Instagram Business account ID and Buffer channel ID.\n2. Create the 3 credentials: **Your App API Key** (header auth), **Meta Graph API** (query auth, `access_token`), **Buffer API** (header auth).\n\n### Data contract\n`/posts/due` returns: `id`, `platforms` (FACEBOOK / INSTAGRAM / TIKTOK), `mediaType` (IMAGE / VIDEO), `mediaUrl`, `caption`.\n`/posts/{id}/result` accepts: `platform`, `status`, `externalId` or `error`.\n\nTemplate by [WivoAgency](https://www.wivoagency.com)"
      },
      "typeVersion": 1
    },
    {
      "id": "fe631e3f-2f1b-4cf4-b47c-5fca06a4a2c1",
      "name": "Sticky Note - Fetch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        656
      ],
      "parameters": {
        "color": 7,
        "width": 656,
        "height": 520,
        "content": "## 1) Configure & fetch due posts\nThe **Schedule Trigger** runs every 2 minutes. **Workflow configuration** (Set node) groups the 5 values you need to edit: app URL, client ID, Facebook Page ID, Instagram account ID and Buffer channel ID. **Get due posts** then calls your app's `/posts/due` endpoint (HTTP Header Auth) with the `clientId` query param. The response fans out to the three platform branches below, each gated by an IF that checks whether the post's `platforms` array includes that network."
      },
      "typeVersion": 1
    },
    {
      "id": "27c4e907-fb32-4aa6-a7ce-494ec10773f3",
      "name": "Sticky Note - Facebook",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        280
      ],
      "parameters": {
        "color": 7,
        "width": 1000,
        "height": 620,
        "content": "## 2) Facebook branch\nIf the post targets Facebook, **FB: image?** routes by `mediaType`: a photo goes to the Page's `/photos` endpoint, a video to `/videos` (Meta Graph API). On success it POSTs `POSTED` with the new post ID; on error (`onError: continueErrorOutput`) it POSTs `FAILED` with the error message. Set `YOUR_FB_PAGE_ID`."
      },
      "typeVersion": 1
    },
    {
      "id": "8d9c9cc7-e7f1-47b8-8548-be31d78a08fc",
      "name": "Sticky Note - Instagram",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        960
      ],
      "parameters": {
        "color": 7,
        "width": 1320,
        "height": 900,
        "content": "## 3) Instagram branch\nInstagram publishing is two-step. **IG: image?** routes by `mediaType`: an image creates a media container directly; a video creates a **Reels** container. For Reels, the workflow waits 20s and polls **Check reel status** until `status_code` is `FINISHED` (or `ERROR`), bounded by a 20-retry limit. Once ready, **IG publish** calls `/media_publish` with the `creation_id`, then reports POSTED / FAILED. Set `YOUR_IG_ACCOUNT_ID`."
      },
      "typeVersion": 1
    },
    {
      "id": "879eb579-7e15-4ba3-9f64-b3a3dbed5277",
      "name": "Sticky Note - TikTok",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        1920
      ],
      "parameters": {
        "color": 7,
        "width": 1160,
        "height": 580,
        "content": "## 4) TikTok branch (via Buffer)\nTikTok has no direct publish API here, so it routes through Buffer. **TikTok: video?** ensures the post is a video, then **Buffer shareNow** sends a GraphQL `createPost` mutation (mode `shareNow`) to Buffer for your TikTok channel. **Buffer accepted?** checks the returned post ID, then reports POSTED / FAILED back to your app. Set `YOUR_BUFFER_CHANNEL_ID`."
      },
      "typeVersion": 1
    },
    {
      "id": "d7f66b31-4af9-4e60-a86a-a750c893b3bc",
      "name": "Every 2 minutes",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -240,
        976
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 2
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9a57d029-cd7c-4d92-a268-4c882dfa50d0",
      "name": "Get due posts",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        176,
        976
      ],
      "parameters": {
        "url": "={{ $('Workflow configuration').first().json.app_base_url }}/api/n8n/posts/due",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "clientId",
              "value": "={{ $('Workflow configuration').first().json.client_id }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "43a3673f-6762-438f-9938-b38f76d7a17a",
      "name": "Has Facebook?",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        656
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "638ffe22-3f6a-45d5-bc34-db770574ab41",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "=  {{ $json.platforms.includes('FACEBOOK') }}",
              "rightValue": "FACEBOOK"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "c5f7f249-556e-446b-89eb-d534af56e8c6",
      "name": "FB: image?",
      "type": "n8n-nodes-base.if",
      "position": [
        672,
        576
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.mediaType }}",
              "rightValue": "IMAGE"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4a44d217-1b04-48e4-950a-0005e5e2784b",
      "name": "FB publish photo",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        896,
        496
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v21.0/{{ $('Workflow configuration').first().json.fb_page_id }}/photos",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $('Get due posts').item.json.mediaUrl }}"
            },
            {
              "name": "caption",
              "value": "={{ $('Get due posts').item.json.caption }}"
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ec9e2394-a9ba-461f-9916-b3288bfe489b",
      "name": "FB publish video",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        896,
        656
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v21.0/{{ $('Workflow configuration').first().json.fb_page_id }}/videos",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "file_url",
              "value": "={{ $('Get due posts').item.json.mediaUrl }}"
            },
            {
              "name": "description",
              "value": "={{ $('Get due posts').item.json.caption }}"
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "662b3d3d-c3e4-4fb1-89f8-573dce588597",
      "name": "FB result OK",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1136,
        544
      ],
      "parameters": {
        "url": "={{ $('Workflow configuration').first().json.app_base_url }}/api/n8n/posts/{{ $('Get due posts').item.json.id }}/result",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "platform",
              "value": "FACEBOOK"
            },
            {
              "name": "status",
              "value": "POSTED"
            },
            {
              "name": "externalId",
              "value": "={{ $json.post_id || $json.id }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f80ed4a5-a9dd-4620-883e-93f3fca542f8",
      "name": "FB result FAILED",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1136,
        736
      ],
      "parameters": {
        "url": "={{ $('Workflow configuration').first().json.app_base_url }}/api/n8n/posts/{{ $('Get due posts').item.json.id }}/result",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "platform",
              "value": "FACEBOOK"
            },
            {
              "name": "status",
              "value": "FAILED"
            },
            {
              "name": "error",
              "value": "={{ JSON.stringify($json.error || $json).slice(0, 500) }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ecfd2293-bcac-4ef6-b950-d534c4a42f71",
      "name": "Has Instagram?",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        1320
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "66f7c3f3-90ea-47c9-8444-04da66ae5370",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "= {{ $json.platforms.includes('INSTAGRAM') }}",
              "rightValue": "INSTAGRAM"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "bfc16e4b-06d4-4ff2-b145-e98712e95932",
      "name": "IG: image?",
      "type": "n8n-nodes-base.if",
      "position": [
        672,
        1320
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.mediaType }}",
              "rightValue": "IMAGE"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "68593b90-e542-467e-8c1b-723bb64195ae",
      "name": "IG image container",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        896,
        1224
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v21.0/{{ $('Workflow configuration').first().json.ig_account_id }}/media",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "image_url",
              "value": "={{ $('Get due posts').item.json.mediaUrl }}"
            },
            {
              "name": "caption",
              "value": "={{ $('Get due posts').item.json.caption }}"
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b164945b-6ae4-427b-878c-98c3a75e6f0b",
      "name": "IG reels container",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        896,
        1464
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v21.0/{{ $('Workflow configuration').first().json.ig_account_id }}/media",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "media_type",
              "value": "REELS"
            },
            {
              "name": "video_url",
              "value": "={{ $('Get due posts').item.json.mediaUrl }}"
            },
            {
              "name": "caption",
              "value": "={{ $('Get due posts').item.json.caption }}"
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e5519b19-7512-4e0e-9e43-db0bf3395a4f",
      "name": "Wait 20s",
      "type": "n8n-nodes-base.wait",
      "position": [
        1120,
        1464
      ],
      "parameters": {
        "amount": 20
      },
      "typeVersion": 1.1
    },
    {
      "id": "0b73180d-e188-4704-8a1b-f3348015fad9",
      "name": "Check reel status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1328,
        1464
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v21.0/{{ $('IG reels container').item.json.id }}",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "fields",
              "value": "status_code"
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bfb3f9a3-6772-46cf-b1b6-fbec79156544",
      "name": "Reel ready?",
      "type": "n8n-nodes-base.switch",
      "position": [
        1536,
        1464
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "finished",
              "conditions": {
                "options": {
                  "version": 2,
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status_code }}",
                    "rightValue": "FINISHED"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "error",
              "conditions": {
                "options": {
                  "version": 2,
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status_code }}",
                    "rightValue": "ERROR"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "processing"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "2deac2aa-9281-462b-a30b-8d9bed5ffb59",
      "name": "Under retry limit?",
      "type": "n8n-nodes-base.if",
      "position": [
        1536,
        1688
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $runIndex }}",
              "rightValue": 20
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "020c34da-4d78-4ca5-aedc-420a7dbbcb42",
      "name": "IG publish",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        1136,
        1224
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v21.0/{{ $('Workflow configuration').first().json.ig_account_id }}/media_publish",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "creation_id",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "69bbae65-5263-4554-87f7-dd5e948f843e",
      "name": "IG result OK",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1376,
        1160
      ],
      "parameters": {
        "url": "={{ $('Workflow configuration').first().json.app_base_url }}/api/n8n/posts/{{ $('Get due posts').item.json.id }}/result",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "platform",
              "value": "INSTAGRAM"
            },
            {
              "name": "status",
              "value": "POSTED"
            },
            {
              "name": "externalId",
              "value": "={{ $json.id }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d114e384-404a-4fa0-860e-543daa38f73e",
      "name": "IG result FAILED",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1376,
        1320
      ],
      "parameters": {
        "url": "={{ $('Workflow configuration').first().json.app_base_url }}/api/n8n/posts/{{ $('Get due posts').item.json.id }}/result",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "platform",
              "value": "INSTAGRAM"
            },
            {
              "name": "status",
              "value": "FAILED"
            },
            {
              "name": "error",
              "value": "={{ JSON.stringify($json.error || $json).slice(0, 500) }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "39052526-c7ce-4bfa-8afc-4f3ac11adce1",
      "name": "Has TikTok?",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        2096
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "af54e1b2-0644-4d5d-a311-5b3253d5a5fe",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.platforms.includes('TIKTOK') }}",
              "rightValue": "TIKTOK"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "ea9b5937-8661-41e4-9d63-8121bb510183",
      "name": "TikTok: video?",
      "type": "n8n-nodes-base.if",
      "position": [
        672,
        2096
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.mediaType }}",
              "rightValue": "VIDEO"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "62cf04c9-df14-4997-b493-d81647ccd159",
      "name": "Buffer shareNow",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        896,
        2080
      ],
      "parameters": {
        "url": "https://api.buffer.com",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ JSON.stringify({ query: 'mutation($input: CreatePostInput!) { createPost(input: $input) { ... on PostActionSuccess { post { id status } } ... on MutationError { message } } }', variables: { input: { channelId: $('Workflow configuration').first().json.buffer_channel_id, text: $('Get due posts').item.json.caption, schedulingType: 'automatic', mode: 'shareNow', assets: [{ video: { url: $('Get due posts').item.json.mediaUrl } }] } } }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3f8dd21b-fbbe-425d-8741-f9b6ceac339c",
      "name": "Buffer accepted?",
      "type": "n8n-nodes-base.if",
      "position": [
        1120,
        2080
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data && $json.data.createPost && $json.data.createPost.post ? $json.data.createPost.post.id : '' }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "09183a1f-17e5-487a-9741-8604c1fe1f0a",
      "name": "TikTok result OK",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1360,
        2160
      ],
      "parameters": {
        "url": "={{ $('Workflow configuration').first().json.app_base_url }}/api/n8n/posts/{{ $('Get due posts').item.json.id }}/result",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "platform",
              "value": "TIKTOK"
            },
            {
              "name": "status",
              "value": "POSTED"
            },
            {
              "name": "externalId",
              "value": "={{ $json.data.createPost.post.id }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6d63622a-0e3c-44f5-930c-0b9da18fad36",
      "name": "TikTok result FAILED",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1360,
        2320
      ],
      "parameters": {
        "url": "={{ $('Workflow configuration').first().json.app_base_url }}/api/n8n/posts/{{ $('Get due posts').item.json.id }}/result",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "platform",
              "value": "TIKTOK"
            },
            {
              "name": "status",
              "value": "FAILED"
            },
            {
              "name": "error",
              "value": "={{ ($json.data && $json.data.createPost && $json.data.createPost.message) || JSON.stringify($json.error || $json).slice(0, 400) }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cfg-node-0001-0001-0001-000000000001",
      "name": "Workflow configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -32,
        976
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "app_base_url",
              "type": "string",
              "value": "https://your-app.com"
            },
            {
              "id": "a2",
              "name": "client_id",
              "type": "string",
              "value": "YOUR_CLIENT_ID"
            },
            {
              "id": "a3",
              "name": "fb_page_id",
              "type": "string",
              "value": "YOUR_FB_PAGE_ID"
            },
            {
              "id": "a4",
              "name": "ig_account_id",
              "type": "string",
              "value": "YOUR_IG_ACCOUNT_ID"
            },
            {
              "id": "a5",
              "name": "buffer_channel_id",
              "type": "string",
              "value": "YOUR_BUFFER_CHANNEL_ID"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "79c38cd6-f2b9-45b0-946e-fb766d501976",
  "connections": {
    "Wait 20s": {
      "main": [
        [
          {
            "node": "Check reel status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FB: image?": {
      "main": [
        [
          {
            "node": "FB publish photo",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "FB publish video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IG publish": {
      "main": [
        [
          {
            "node": "IG result OK",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IG result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IG: image?": {
      "main": [
        [
          {
            "node": "IG image container",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IG reels container",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has TikTok?": {
      "main": [
        [
          {
            "node": "TikTok: video?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reel ready?": {
      "main": [
        [
          {
            "node": "IG publish",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IG result FAILED",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Under retry limit?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get due posts": {
      "main": [
        [
          {
            "node": "Has Facebook?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Has Instagram?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Has TikTok?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Facebook?": {
      "main": [
        [
          {
            "node": "FB: image?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Instagram?": {
      "main": [
        [
          {
            "node": "IG: image?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "TikTok: video?": {
      "main": [
        [
          {
            "node": "Buffer shareNow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "TikTok result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buffer shareNow": {
      "main": [
        [
          {
            "node": "Buffer accepted?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "TikTok result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every 2 minutes": {
      "main": [
        [
          {
            "node": "Workflow configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buffer accepted?": {
      "main": [
        [
          {
            "node": "TikTok result OK",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "TikTok result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FB publish photo": {
      "main": [
        [
          {
            "node": "FB result OK",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "FB result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FB publish video": {
      "main": [
        [
          {
            "node": "FB result OK",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "FB result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check reel status": {
      "main": [
        [
          {
            "node": "Reel ready?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IG image container": {
      "main": [
        [
          {
            "node": "IG publish",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IG result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IG reels container": {
      "main": [
        [
          {
            "node": "Wait 20s",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IG result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Under retry limit?": {
      "main": [
        [
          {
            "node": "Wait 20s",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IG result FAILED",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow configuration": {
      "main": [
        [
          {
            "node": "Get due posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}