8
n8n 中文网amn8n.com

使用Gemini 2.0和AI图像生成生成病毒式Facebook帖子

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 22 个节点。主要使用 If, Code, Gmail, Merge, Function 等节点。 使用Gemini 2.0和AI图像生成生成病毒式Facebook帖子

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Facebook Graph API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "bead0a5b25199559eb2b2715841bf43c72bdce5faf95fc5e5ce3a983ef98cb4a"
  },
  "nodes": [
    {
      "id": "c79bacb7-1910-4467-a904-af2bc4439df4",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        -1056,
        1264
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "809ee214-220b-4344-a75c-c5b9d9f8021d",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ !!$json.prompt_image }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6d8b7fa3-2660-49ec-a26b-a82537506004",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        400,
        1488
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d5c84381-db43-4375-ba9f-79404a34f520",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.post_supports_client_mutation_id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6a4e8e34-9b02-407b-ad14-f997fc1d86b8",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -32,
        1488
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.1,
      "alwaysOutputData": true
    },
    {
      "id": "e5863143-f99e-42e5-8dea-de3b52ec438d",
      "name": "Facebook Graph API",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        176,
        1488
      ],
      "parameters": {
        "edge": "feed",
        "node": "113732581629527",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "message",
                "value": "={{ $('Format Content').item.json.content }}"
              },
              {
                "name": "attached_media",
                "value": "={{ $json.id ? `[{\"media_fbid\":\"${$json.id}\"}]` : \"\" }}"
              }
            ]
          }
        },
        "graphApiVersion": "v22.0",
        "httpRequestMethod": "POST"
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "lp88zzdLN27PRInF",
          "name": "Facebook Graph account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0072f8aa-e0c7-423c-98b1-6739e523d600",
      "name": "Facebook Upload Img",
      "type": "n8n-nodes-base.facebookGraphApi",
      "onError": "continueRegularOutput",
      "position": [
        -272,
        1248
      ],
      "parameters": {
        "edge": "photos",
        "node": "113732581629527",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "published",
                "value": "false"
              }
            ]
          }
        },
        "sendBinaryData": true,
        "graphApiVersion": "v22.0",
        "httpRequestMethod": "POST",
        "binaryPropertyName": "data"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "54431a5d-e2cd-4fec-9ae6-f0d32398fa0e",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -1968,
        1520
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cfb85fb7-2dbd-4122-83bd-9083fb029d25",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json[\"Content\"] ? $json[\"Content\"].length > 0 : (\n    $json[\"message\"]?.text?.length >= 50\n) }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "63a571c9-790c-42a8-ad8d-b726f49ac025",
      "name": "Format Content",
      "type": "n8n-nodes-base.function",
      "position": [
        -400,
        1504
      ],
      "parameters": {
        "functionCode": "const raw =\n  $json[\"Nội dung đầy đủ\"] ||\n  $json.message?.content ||\n  \"\";\n\nconst cleaned = raw.replace(/[#*]+/g, \"\").trim();\n\nreturn [\n  {\n    json: {\n      content: cleaned,\n      platform: \"facebook\",\n    },\n  },\n];"
      },
      "typeVersion": 1
    },
    {
      "id": "3c56769c-2757-4e7c-9aa1-5b340040bb98",
      "name": "save content",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "position": [
        -624,
        1504
      ],
      "parameters": {
        "columns": {
          "value": {
            "Ngày": "={{ new Date().toLocaleDateString(\"vi-VN\") }}",
            "Nội dung ngắn": "={{ $('code2').item.json.content }}",
            "Nội dung đầy đủ": "={{ $json.text?.trim() ? $json.text : $json.message?.content }}"
          },
          "schema": [
            {
              "id": "Ngày",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Ngày",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Nội dung ngắn",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nội dung ngắn",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Nội dung đầy đủ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nội dung đầy đủ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TBcyVVQ6JVNkvw8qFFbuct_3WxtggOBnI1kwUXMyTY8/edit#gid=0",
          "cachedResultName": "Tự động"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TBcyVVQ6JVNkvw8qFFbuct_3WxtggOBnI1kwUXMyTY8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TBcyVVQ6JVNkvw8qFFbuct_3WxtggOBnI1kwUXMyTY8/edit?usp=drivesdk",
          "cachedResultName": "ai5phut_AutoPost_Demo"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "v4GKb4dRdpOLmxHa",
          "name": "Google Sheets account"
        }
      },
      "retryOnFail": false,
      "typeVersion": 4.5,
      "alwaysOutputData": true
    },
    {
      "id": "d3978e2b-0dee-405f-ae89-814e75289d7b",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueRegularOutput",
      "position": [
        -1728,
        1504
      ],
      "parameters": {
        "text": "=You are a marketing content writer. Here is the input content. Do 3 things:\n\n1. Quickly analyze the content.\n\n2. Bullet out the main points to write the article (content marketing or social media post).\n\n3. Return the correct format requested, **no further explanation**, **no additional paragraphs other than the following JSON**.\n\nReturn the result in the following format:\n{\n\"prompt_image\": \"...\",\n\"content\": \"...\"\n}\n\n---\n\"prompt_image\": [write a prompt to create an AI image that matches the content, note: absolutely do not put text in the image, only describe the image and appropriate design style]\n\n\"content\": [write complete, clear, concise, and focused content that can be posted on Facebook, website, or blog]\n\nContent to be processed:\n\"\"\n{{\n$json.message?.text?.trim()\n? $json.message.text\n: $json.content?.trim()\n? $json.content\n: $json['Content']?.trim()\n? $json['Content']\n: \"\"\n}}\n\"\"\"",
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.6,
      "alwaysOutputData": true
    },
    {
      "id": "9521d4e2-c7d9-4b91-a5a9-eb01f1b76f58",
      "name": "Basic LLM Chain1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1024,
        1504
      ],
      "parameters": {
        "text": "=You are a social media content writer. Here is a summary of the content that has been analyzed by AI. Let's turn it into **a complete article**, with the following requirements:\n\n1. **Keep the spirit and main message of the content intact.**\n2. Rewrite it into a coherent article, with a clear introduction - body - conclusion.\n3. Use a **friendly, approachable tone**, easy to understand, suitable for posting on Facebook\n4. Use emojis sparingly to increase attraction (if appropriate).\n5. Keep the length moderate (from 200–350 words).\n6. **Do not insert titles or #hashtags**, just focus on the main content.\n\nHere is the summary:\n\"\"\n{{ $json.content }}\n\"\"\"",
        "promptType": "define"
      },
      "typeVersion": 1.6,
      "alwaysOutputData": true
    },
    {
      "id": "ca94be67-d90b-4709-b9dc-0a37d6178a22",
      "name": "Convert to File code",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        -496,
        1248
      ],
      "parameters": {
        "jsCode": "const base64Data = $json.data[0].b64_json;\n\nif (!base64Data) {\n  throw new Error(\"Không tìm thấy dữ liệu ảnh base64.\");\n}\n\nreturn [\n  {\n    json: {},\n    binary: {\n      data: {\n        data: base64Data,\n        mimeType: \"image/png\",\n        fileName: \"image.png\"\n      }\n    }\n  }\n];\n"
      },
      "retryOnFail": true,
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "6357acfa-99b4-45c8-80e9-65c3fb267071",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1728,
        1712
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-001"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "WXBzegbf5JJGseFg",
          "name": "Google Gemini(PaLM) Api account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "860674d1-d0f1-4e7a-aeeb-ee78d2a3ae1c",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1024,
        1696
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-001"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "WXBzegbf5JJGseFg",
          "name": "Google Gemini(PaLM) Api account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f4ebfcd4-5aeb-4292-b0d9-a3dc52eb75b3",
      "name": "code2",
      "type": "n8n-nodes-base.code",
      "position": [
        -1344,
        1504
      ],
      "parameters": {
        "jsCode": "let rawText = $json.text || '';\n\n// Bước 1: Tách phần JSON bên trong ```json ... ```\nconst matched = rawText.match(/```json\\s*([\\s\\S]*?)\\s*```/);\n\nif (!matched || !matched[1]) {\n  return [{ json: { prompt_image: '', content: '', error: 'Can not find JSON in ```json```' } }];\n}\n\nlet jsonString = matched[1]\n  .replace(/\\n/g, '')      // Xoá xuống dòng\n  .replace(/\\r/g, '')      // Xoá carriage return\n  .replace(/\\t/g, '')      // Xoá tab (nếu có)\n  .trim();\n\ntry {\n  const parsed = JSON.parse(jsonString);\n  return [{\n    json: {\n      prompt_image: parsed.prompt_image || '',\n      content: parsed.content || ''\n    }\n  }];\n} catch (err) {\n  return [{\n    json: {\n      prompt_image: '',\n      content: '',\n      error: 'error parse JSON: ' + err.message\n    }\n  }];\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "b3e26901-72f3-4304-b6d9-6c97b9e9d02a",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -800,
        1248
      ],
      "parameters": {
        "url": "https://router.huggingface.co/together/v1/images/generations",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"response_format\": \"b64_json\",\n  \"prompt\": \"{{ $json.prompt_image }}\",\n  \"model\": \"black-forest-labs/FLUX.1-schnell\"\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer <key>"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4006af3a-f2e9-45f7-85c5-966c1c82d2e6",
      "name": "On form submission1",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -2576,
        1520
      ],
      "webhookId": "6e9f8a5b-2f3b-4ea5-927d-76a9a34febc9",
      "parameters": {
        "options": {
          "buttonLabel": "Gửi thông tin",
          "appendAttribution": false,
          "respondWithOptions": {
            "values": {
              "formSubmittedText": "Information sent"
            }
          }
        },
        "formTitle": "Input the post idea",
        "formFields": {
          "values": [
            {
              "fieldType": "textarea",
              "fieldLabel": "Input Information here",
              "placeholder": "At least 50 words",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Input the idea that you want upload to Facebook,"
      },
      "typeVersion": 2.2
    },
    {
      "id": "ca09e6e7-3536-432d-9f68-d2455194061b",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -2272,
        1520
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $now.toFormat(\"dd/MM/yyyy\") }}",
            "Time": "={{ $now.toFormat(\"HH\") }}",
            "Content": "={{ $json[\"Input Information here\"] }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Content",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Content",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1icCYSzDhpAc4itXrfwxhjQgisKye-mtdR8UwyZfS1m8/edit#gid=0",
          "cachedResultName": "Post via form"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1icCYSzDhpAc4itXrfwxhjQgisKye-mtdR8UwyZfS1m8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1icCYSzDhpAc4itXrfwxhjQgisKye-mtdR8UwyZfS1m8/edit?usp=drivesdk",
          "cachedResultName": "Content"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "v4GKb4dRdpOLmxHa",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5,
      "alwaysOutputData": true
    },
    {
      "id": "0ce21a3e-5ab5-477d-89a9-606ee4e84dfa",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        624,
        1472
      ],
      "webhookId": "7f9e790e-fb8d-485a-9c8c-8d592c4cd138",
      "parameters": {
        "sendTo": "truong11062002@gmail.com",
        "message": "=✅ The post will be published after 2 minutes!\n📄 Review in: https://facebook.com/{{ $json.id.split('_')[0] }}/posts/{{ $json.id.split('_')[1] }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "✅ The draft version is uploaded"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "GkwYsewcP2AJJXFH",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b38bbebe-cf2a-4d94-b6ce-f8ecd3c26d23",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3392,
        464
      ],
      "parameters": {
        "width": 672,
        "height": 1264,
        "content": "# Complete Setup Guide: AI Facebook Post Generator\n\n## Prerequisites Checklist\n\nBefore starting, ensure you have:\n- [ ] n8n instance (cloud or self-hosted)\n- [ ] Facebook Business Page (not personal profile)\n- [ ] Google account with access to Sheets and Gmail\n- [ ] Basic understanding of API credentials\n\n**Estimated Setup Time**: 30-45 minutes\n\n---\n\n## Step 1: Facebook Integration Setup\n\n### 1.1 Create Facebook App\n1. Go to [Facebook Developers](https://developers.facebook.com/)\n2. Click **\"My Apps\"** → **\"Create App\"**\n3. Choose **\"Business\"** as app type\n4. Enter app name: `n8n-facebook-poster` (or your preferred name)\n5. Click **\"Create App\"**\n\n### 1.2 Configure Facebook App\n1. In your app dashboard, go to **\"Add a Product\"**\n2. Find **\"Facebook Login\"** and click **\"Set Up\"**\n3. Go to **Settings** → **Basic**\n4. Add your domain to **\"App Domains\"** (for n8n cloud: `app.n8n.cloud`)\n5. Save changes\n\n### 1.3 Get Page Access Token\n1. Go to **Tools** → **Graph API Explorer**\n2. Select your app from the dropdown\n3. Click **\"Generate Access Token\"**\n4. Grant permissions: `pages_manage_posts`, `pages_read_engagement`, `pages_show_list`\n5. Select your Facebook page\n6. Copy the **Page Access Token** (starts with `EAAG...`)\n7. **Important**: Extend token to long-lived:\n   - Use Graph API Explorer\n   - Make GET request to: `/oauth/access_token?grant_type=fb_exchange_token&client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&fb_exchange_token=YOUR_SHORT_TOKEN`\n\n### 1.4 Get Your Page ID\n1. Go to your Facebook page\n2. Click **\"About\"** tab\n3. Scroll down to find **\"Page ID\"** or\n4. Use Graph API Explorer: GET request to `/me/accounts` with your token\n\n---"
      },
      "typeVersion": 1
    },
    {
      "id": "2f98cd9a-6ffc-4898-9faa-dd82c220ce65",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2416,
        368
      ],
      "parameters": {
        "color": 3,
        "width": 656,
        "height": 1040,
        "content": "\n## Step 2: Google Services Setup\n\n### 2.1 Enable Google APIs\n1. Go to [Google Cloud Console](https://console.cloud.google.com/)\n2. Create new project or select existing one\n3. Go to **\"APIs & Services\"** → **\"Library\"**\n4. Enable these APIs:\n   - Google Sheets API\n   - Gmail API\n   - Google Drive API (optional)\n\n### 2.2 Create Service Account\n1. Go to **\"APIs & Services\"** → **\"Credentials\"**\n2. Click **\"Create Credentials\"** → **\"Service Account\"**\n3. Name: `n8n-facebook-automation`\n4. Click **\"Create and Continue\"**\n5. Skip role assignment (click **\"Continue\"**)\n6. Click **\"Done\"**\n\n### 2.3 Generate Service Account Key\n1. Click on your service account email\n2. Go to **\"Keys\"** tab\n3. Click **\"Add Key\"** → **\"Create New Key\"**\n4. Choose **\"JSON\"** format\n5. Download the JSON file (save securely)\n\n### 2.4 Prepare Google Sheets\n1. Create two Google Sheets:\n   - **Content Log Sheet**: For tracking generated content\n   - **Input Tracking Sheet**: For logging form submissions\n\n2. **Content Log Sheet Structure**:\n   - Column A: (Date)\n   - Column B: (Short Content)\n   - Column C: (Full Content)\n\n3. **Input Tracking Sheet Structure**:\n   - Column A: \"Date\"\n   - Column B: \"Time\"\n   - Column C: \"Content\"\n\n4. Share both sheets with your service account email (found in the JSON file)\n\n---\n"
      },
      "typeVersion": 1
    },
    {
      "id": "dca9ca80-5913-4236-aa21-e0c87bbe0859",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        -48
      ],
      "parameters": {
        "color": 4,
        "width": 928,
        "height": 1440,
        "content": "\n## Step 3: AI Services Setup\n\n### Get Gemini API Key\n1. Go to [Google AI Studio](https://makersuite.google.com/app/apikey)\n2. Sign in with your Google account\n3. Click **\"Create API Key\"**\n4. Copy the API key (starts with `AIza...`)\n---\n\n## Step 4: n8n Configuration\n\n### 4.1 Import the Workflow\n1. Copy the workflow JSON from the template\n2. In n8n, click **\"Import from JSON\"**\n3. Paste the workflow JSON\n4. Click **\"Import\"**\n\n### 4.2 Configure Credentials\n\n#### Facebook Graph API Credentials\n1. Go to **Settings** → **Credentials**\n2. Click **\"Add Credential\"**\n3. Search for **\"Facebook Graph API\"**\n4. Enter:\n   - **Access Token**: Your Page Access Token from Step 1.3\n5. Test the connection\n6. Save as: `Facebook Page Access`\n\n#### Google Credentials  \n1. Add **\"Google Service Account\"** credential\n2. Upload the JSON file from Step 2.3\n3. Test connection\n4. Save as: `Google Services`\n\n#### Gemini API Credentials\n1. Add **\"Google PaLM API\"** credential\n2. Enter your Gemini API key from Step 3.1\n3. Save as: `Gemini AI`\n\n### 4.3 Update Node Configurations\n\n#### Update Facebook Page ID\n1. Open **\"Facebook Graph API\"** node\n2. Replace `\"113732581629527\"` with your actual Page ID from Step 1.4\n3. Do the same for **\"Facebook Upload Img\"** node\n\n#### Update Google Sheets IDs\n1. Open **\"save content\"** node\n2. Replace the Document ID with your Content Log Sheet ID\n3. Open **\"Append row in sheet\"** node  \n4. Replace the Document ID with your Input Tracking Sheet ID\n\n**To find Sheet ID**: Look at the URL - it's the long string after `/spreadsheets/d/`\n\n#### Update Email Address\n1. Open **\"Send a message\"** node\n2. Replace `xxx@gmail.com` with your email\n3. Configure Gmail credentials if not already done\n\n---\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9ec09d40-9548-42e2-8e41-bbd8e9490fb2",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        1728
      ],
      "parameters": {
        "color": 6,
        "width": 464,
        "height": 736,
        "content": "\n## Step 5: Testing & Validation\n\n### 5.1 Test Individual Components\n\n#### Test Google Sheets Connection\n1. Right-click **\"Append row in sheet\"** node\n2. Click **\"Execute Node\"**\n3. Check if a test row appears in your sheet\n\n#### Test Gemini AI\n1. Right-click **\"Basic LLM Chain\"** node\n2. Add test data in **\"Edit Input Data\"**\n3. Execute and verify AI response\n\n#### Test Image Generation\n1. Right-click **\"HTTP Request\"** node\n2. Ensure it has a valid prompt from previous step\n3. Execute and check for base64 image data\n\n#### Test Facebook Upload\n1. Run the full workflow with test content\n2. Check your Facebook page for the post\n3. Verify image uploaded correctly\n\n### 5.2 End-to-End Test\n1. Click **\"Execute Workflow\"** on the trigger node\n2. Submit test content through the form\n3. Monitor each node's execution\n4. Verify final Facebook post"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Facebook Graph API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "code2": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          },
          {
            "node": "Basic LLM Chain1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Convert to File code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "save content": {
      "main": [
        [
          {
            "node": "Format Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Content": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "code2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain1": {
      "main": [
        [
          {
            "node": "save content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Facebook Graph API": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Facebook Upload Img": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission1": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File code": {
      "main": [
        [
          {
            "node": "Facebook Upload Img",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量22
分类2
节点类型12
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者

I'm a Freelance AI Automation Engineer, helping Sales & Marketing teams streamline their workflows with custom n8n automations. With 5+ years of experience, I’ve helped hundreds of businesses adopt AI-powered solutions using n8n ✅ Free consultation available — book now and start saving time: 👉 https://www.aivra.work/en

外部链接
在 n8n.io 查看

分享此工作流