{
  "name": "Post other social copy - sample",
  "nodes": [
    {
      "parameters": {
        "path": "PLACEHOLDER_WEBHOOK_PATH_VERIFY",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "5f3d7eee-b7b9-4463-bf45-c484fd119ba7",
      "name": "Webhook Verify (GET)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -1840,
        -48
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "leftValue": "={{ $json.query['hub.verify_token'] }}",
              "rightValue": "PLACEHOLDER_FB_VERIFY_TOKEN",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "id": "bf56c89d-c4cf-4fc6-9780-f7f6399e4fe9"
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "e6f504d9-52a6-4325-9bd4-d39586678900",
      "name": "Check Verify Token",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        -1616,
        -48
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "={{ $json.query['hub.challenge'] }}",
        "options": {}
      },
      "id": "c7dcb75d-e381-4da4-b5a0-9f88cfbae0eb",
      "name": "Respond Challenge",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        -1392,
        -128
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "Forbidden",
        "options": {
          "responseCode": 403
        }
      },
      "id": "1484b95f-b534-4fa5-8aa9-af62cc13fd8f",
      "name": "Respond Forbidden",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        -1392,
        64
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "PLACEHOLDER_WEBHOOK_PATH_EVENT",
        "options": {}
      },
      "id": "64626f2b-4fa3-4a59-92c1-0f466d838c7a",
      "name": "Webhook Event (POST)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -1920,
        240
      ]
    },
    {
      "parameters": {
        "fieldToSplitOut": "body.entry",
        "options": {}
      },
      "id": "c3d84763-80f7-4699-b899-95bc283a299d",
      "name": "Split Entries",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        -1712,
        240
      ]
    },
    {
      "parameters": {
        "fieldToSplitOut": "changes",
        "options": {}
      },
      "id": "fa8ddff0-7a54-4ecc-8687-90d67e876ff4",
      "name": "Split Changes",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        -1488,
        240
      ]
    },
    {
      "parameters": {
        "url": "={{ $json.attachments.data[0].media.source }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "id": "7d84b5f2-38e8-4e75-bda0-30b7b595d757",
      "name": "Download Video from FB",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1440,
        688
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://zernio.com/api/v1/posts",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer PLACEHOLDER_ZERNIO_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"content\": $json.caption, \"mediaItems\": [{ \"type\": \"video\", \"url\": $json.video_url }], \"platforms\": [{ \"platform\": \"tiktok\", \"accountId\": \"PLACEHOLDER_TIKTOK_ACCOUNT_ID\" }], \"publishNow\": true } }}",
        "options": {}
      },
      "id": "d5dbe745-f4a7-4f42-898f-babc4f0110dd",
      "name": "Post to TikTok (Zernio)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -512,
        224
      ],
      "continueOnFail": true
    },
    {
      "parameters": {
        "url": "={{ $json.video_url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "id": "bfc5ca07-6e8e-4553-9ac2-7d8fc16cd046",
      "name": "Download Video for YouTube",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -528,
        832
      ],
      "continueOnFail": true
    },
    {
      "parameters": {
        "resource": "video",
        "operation": "upload",
        "title": "={{ $('Build Public Video URL').item.json.caption.slice(0, 95) }}",
        "regionCode": "VN",
        "categoryId": "=22",
        "options": {
          "description": "={{ $('Build Public Video URL').item.json.caption }}",
          "privacyStatus": "public"
        }
      },
      "id": "961a0605-ce70-438e-a9fb-1e29ec1cffd4",
      "name": "Post to YouTube Shorts (Native)",
      "type": "n8n-nodes-base.youTube",
      "typeVersion": 1,
      "position": [
        -336,
        832
      ],
      "continueOnFail": true
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://zernio.com/api/v1/posts",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer PLACEHOLDER_ZERNIO_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"content\": $json.caption, \"mediaItems\": [{ \"type\": \"video\", \"url\": $json.video_url }], \"platforms\": [{ \"platform\": \"linkedin\", \"accountId\": \"PLACEHOLDER_LINKEDIN_ACCOUNT_ID\" }], \"publishNow\": true } }}",
        "options": {}
      },
      "id": "6950165a-86c1-46b3-90c6-804986033b90",
      "name": "Post to LinkedIn (Zernio)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -544,
        640
      ],
      "continueOnFail": true
    },
    {
      "parameters": {
        "numberInputs": 4
      },
      "id": "e56bd140-3f16-49bf-b1a5-4b00c650e728",
      "name": "Gộp 5 nền tảng",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.1,
      "position": [
        -160,
        656
      ]
    },
    {
      "parameters": {
        "chatId": "PLACEHOLDER_TELEGRAM_CHAT_ID",
        "text": "={{ $json.text }}",
        "additionalFields": {}
      },
      "id": "e7e5d369-d93b-46f3-8557-e265c39c3eb9",
      "name": "Báo Telegram - Tổng hợp",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        288,
        656
      ]
    },
    {
      "parameters": {
        "name": "={{ 'fb-video-' + Date.now() + '.mp4' }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        },
        "options": {}
      },
      "id": "63994962-c1e4-47c7-a0a2-ad738680ce00",
      "name": "Upload to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -1200,
        832
      ]
    },
    {
      "parameters": {
        "operation": "share",
        "fileId": "={{ $json.id }}",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        },
        "options": {}
      },
      "id": "4e41b225-29fc-451f-be11-22edf39fe80e",
      "name": "Share công khai",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -1056,
        576
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "name": "publicUrl",
              "type": "string",
              "value": "={{ 'https://drive.usercontent.google.com/download?id=' + $('Upload to Google Drive').item.json.id + '&export=download' }}"
            }
          ]
        },
        "options": {}
      },
      "id": "d5dda815-1a1e-40f1-9941-5ea5f5efc1e7",
      "name": "Tạo link Drive",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -944,
        832
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://zernio.com/api/v1/posts",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer PLACEHOLDER_ZERNIO_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"content\": $json.caption, \"mediaItems\": [{ \"type\": \"video\", \"url\": $json.video_url }], \"platforms\": [{ \"platform\": \"instagram\", \"accountId\": \"PLACEHOLDER_INSTAGRAM_ACCOUNT_ID\" }], \"publishNow\": true } }}",
        "options": {}
      },
      "id": "dbfc49a2-8879-476a-bf40-689b5d10bd63",
      "name": "Post to Instagram (Zernio)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -528,
        400
      ],
      "continueOnFail": true
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.value ? $json.value.item : $json.body.entry[0].changes[0].value.item }}",
                    "rightValue": "video",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "a2e00102-2667-479a-9fe8-3d3867af426b"
                  },
                  {
                    "leftValue": "={{ $json.value ? $json.value.verb : $json.body.entry[0].changes[0].value.verb }}",
                    "rightValue": "add",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "04e506bd-71d7-4097-9ee2-a9458db6d0bb"
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "none"
        }
      },
      "id": "88a1aaa1-cfaa-4f33-9d59-66e54d77250f",
      "name": "Phân loại sự kiện Feed",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -1248,
        272
      ]
    },
    {
      "parameters": {
        "url": "=https://graph.facebook.com/v19.0/{{ $json.value.post_id }}",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "fields",
              "value": "message,full_picture,permalink_url,attachments{media_type,media,url}"
            },
            {
              "name": "access_token",
              "value": "=PLACEHOLDER_PAGE_ACCESS_TOKEN"
            }
          ]
        },
        "options": {}
      },
      "id": "58542d11-297b-4d05-a96f-edc12e1351e8",
      "name": "Get Post Details (Graph API)1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1696,
        880
      ]
    },
    {
      "parameters": {
        "jsCode": "const items = $input.all();\nconst displayNames = { tiktok: 'TikTok', instagram: 'Instagram', linkedin: 'LinkedIn', threads: 'Threads' };\nlet lines = ['📊 Báo cáo đăng bài:'];\nitems.forEach((item) => {\n  const j = item.json;\n  if (j.kind && j.kind.includes('youtube')) {\n    lines.push(`YouTube Shorts: ✅ https://youtube.com/watch?v=${j.id}`);\n    return;\n  }\n  const platformResult = j.post ? j.post.platforms?.[0] : (j.platforms ? j.platforms[0] : null);\n  if (platformResult && !j.error) {\n    const name = displayNames[platformResult.platform] || platformResult.platform;\n    lines.push(`${name}: ✅ ${platformResult.platformPostUrl}`);\n    return;\n  }\n  if (j.error) {\n    lines.push(`Không rõ nền tảng: ❌ ${j.error.message || JSON.stringify(j.error)}`);\n    return;\n  }\n  lines.push('Không rõ nền tảng: ⚠️ Không xác định được kết quả');\n});\nreturn [{ json: { text: lines.join('\\n') } }];"
      },
      "id": "09591181-25f8-4f9b-9145-dfaabc4c8373",
      "name": "Gộp nội dung báo cáo1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        48,
        656
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "name": "video_url",
              "type": "string",
              "value": "={{ $json.publicUrl }}"
            },
            {
              "name": "caption",
              "type": "string",
              "value": "={{ $('Get Post Details (Graph API)1').item.json.message }}"
            }
          ]
        },
        "options": {}
      },
      "id": "fcb6c159-ee12-4c8e-96bc-ca6462b3ede6",
      "name": "Build Public Video URL1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -768,
        704
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook Verify (GET)": {
      "main": [
        [
          {
            "node": "Check Verify Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Verify Token": {
      "main": [
        [
          {
            "node": "Respond Challenge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond Forbidden",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Event (POST)": {
      "main": [
        [
          {
            "node": "Split Entries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Entries": {
      "main": [
        [
          {
            "node": "Split Changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Changes": {
      "main": [
        [
          {
            "node": "Phân loại sự kiện Feed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video from FB": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to TikTok (Zernio)": {
      "main": [
        [
          {
            "node": "Gộp 5 nền tảng",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Download Video for YouTube": {
      "main": [
        [
          {
            "node": "Post to YouTube Shorts (Native)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to YouTube Shorts (Native)": {
      "main": [
        [
          {
            "node": "Gộp 5 nền tảng",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Post to LinkedIn (Zernio)": {
      "main": [
        [
          {
            "node": "Gộp 5 nền tảng",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Gộp 5 nền tảng": {
      "main": [
        [
          {
            "node": "Gộp nội dung báo cáo1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Google Drive": {
      "main": [
        [
          {
            "node": "Share công khai",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Share công khai": {
      "main": [
        [
          {
            "node": "Tạo link Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tạo link Drive": {
      "main": [
        [
          {
            "node": "Build Public Video URL1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Instagram (Zernio)": {
      "main": [
        [
          {
            "node": "Gộp 5 nền tảng",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Phân loại sự kiện Feed": {
      "main": [
        [
          {
            "node": "Get Post Details (Graph API)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Post Details (Graph API)1": {
      "main": [
        [
          {
            "node": "Download Video from FB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gộp nội dung báo cáo1": {
      "main": [
        [
          {
            "node": "Báo Telegram - Tổng hợp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Public Video URL1": {
      "main": [
        [
          {
            "node": "Post to Instagram (Zernio)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to LinkedIn (Zernio)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Download Video for YouTube",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to TikTok (Zernio)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "c542dec6-305f-437f-ace8-d84de57e37f5",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodeGroups": [],
  "tags": []
}