8
n8n 中文网amn8n.com

宠物美容发布与预约自动化

高级

这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 36 个节点。主要使用 If, Set, Switch, Telegram, GoogleSheets 等节点。 使用AI、Facebook和Telegram机器人自动化宠物美容发布与预约

前置要求
  • Telegram Bot Token
  • Google Sheets API 凭证
  • OpenAI API Key
  • Facebook Graph API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "8f5bc3586a09bb005132364a23028fdc8e3d8c8e33cd86682840171acfa0648a",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a9bf4049-419f-4fc2-8f35-0222d0e441dd",
      "name": "获取工作表中的行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -528,
        -400
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "False",
              "lookupColumn": "Uploaded"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c/edit?usp=drivesdk",
          "cachedResultName": "Posting Details"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "J0zDW7WLt4PeG2kS",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "9fccccc7-ca1e-477d-b0ae-551f26a9e6fd",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        576,
        -272
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "85dbf0aa-c85f-48ab-ae5f-734f2c1ce873",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        928,
        -288
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\n  \"caption\": \"Astig ng glow si Maki ngayong July 29, 2025, fresh cut na sobrang kintab! ✨🐾\\nGrabe siya, ang bait niya habang pinapamper namin kaya talagang pet glow up siya! 😍\\nMagpa‑appointment ka na para ma‑experience ng furbaby mo ang glow magic! 💖📅\\n---\\nFind us on #GoogleMaps:\\n📌 Floodway Pethouse\\nSamagta St Floodway, Taytay, 1920 Rizal\\n.\\n📌GOOGLE MAPS LINK:\\nhttps://maps.app.goo.gl/XJwJLR3bB1YugpmE6\",\n  \"image_url\": \"https://api.telegram.org/file/bot8283668440:AAG6wg_1Yu9IcHIfNd4osUVI77coU3uYWTE/photos/file_18.jpg\"\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "33ac6849-1ec5-4303-a79e-60c68084d35c",
      "name": "Google Gemini 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        928,
        -128
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "75098650-571a-4ec3-b7f7-4f2a54534f8c",
      "name": "接收消息时",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1600,
        -544
      ],
      "webhookId": "efd84929-c21b-4e5f-b97c-ecb4902ea107",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "chatIds": ""
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "qzw76kM1w1nZA0a6",
          "name": "Subreddit_finder_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "073baf82-c455-40db-bfe0-6ccf362e804d",
      "name": "检查消息",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1376,
        -560
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Booking",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8ed0f5e6-4919-46f2-8062-81e577a1405e",
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "/book"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Post Command",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "98fa8fd5-2a32-4bd7-80c1-afa4b64b8746",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "/post"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Queue",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2da51619-9670-42b7-b91c-bb39c5aaa337",
                    "operator": {
                      "type": "array",
                      "operation": "lengthGt",
                      "rightType": "number"
                    },
                    "leftValue": "={{ $json.message.photo }}",
                    "rightValue": 0
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "ignoreCase": false,
          "allMatchingOutputs": false
        }
      },
      "typeVersion": 3.2,
      "alwaysOutputData": false
    },
    {
      "id": "9554b807-009f-4bbf-bb11-848fe98d1fdf",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        -320,
        -400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "b603a886-6d5d-4b84-bdf0-d05d8d58d5da",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.row_number }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "fc356777-d2fb-46ee-8014-c8018fe1bd6f",
      "name": "设置上传为True",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        -688
      ],
      "parameters": {
        "columns": {
          "value": {
            "Uploaded": "True",
            "row_number": "={{ $json.row_number }}"
          },
          "schema": [
            {
              "id": "Pet_Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Pet_Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Owners_Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Owners_Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image_Url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Image_Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Uploaded",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Uploaded",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "cellFormat": "RAW"
        },
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c/edit?usp=drivesdk",
          "cachedResultName": "Posting Details"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "J0zDW7WLt4PeG2kS",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "78ca79da-ec49-4b5c-a953-ee8211c509dd",
      "name": "字幕生成",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        608,
        -496
      ],
      "parameters": {
        "text": "=We are a Grooming Business Called Floodway Pethouse,\nPet's Name:  {{ $json.Pet_Name }}\nOwner's Name: {{ $json.Owners_Name }}\nCurrent Date: {{ $now.format('DDD') }}\nImage_URL: {{ $json.Image_Url }}\n\nImage Content:{{ $json.content }}",
        "options": {
          "systemMessage": "{\n  \"caption\": \"Ang cute mo naman Goldie, nakakagigil ka 😍😍\\n🔴 Visit us today! ✨\\n.\\nBusiness hours:\\n✔️ PET SHOP:\\n📅 Wednesday–Monday\\n⏰ 9:00 AM to 6:00 PM\\n❌ GROOMING:\\n📅 CLOSED every Tuesday\",\n  \"image_url\": \"https://api.telegram.org/file/bot8283668440:AAG6wg_1Yu9IcHIfNd4osUVI77coU3uYWTE/photos/file_18.jpg\"\n}\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "bfc57be1-d132-4a9e-b720-a816a6c57428",
      "name": "打字效果",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1104,
        -976
      ],
      "webhookId": "cdead1d9-1ce0-4488-b164-e7651eb8bc70",
      "parameters": {
        "chatId": "{Your Chat ID here}",
        "operation": "sendChatAction"
      },
      "credentials": {
        "telegramApi": {
          "id": "qzw76kM1w1nZA0a6",
          "name": "Subreddit_finder_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "caa41d53-63db-4ec3-b7cb-2690e2ea8ac5",
      "name": "AI 代理1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "maxTries": 2,
      "position": [
        -192,
        -1200
      ],
      "parameters": {
        "text": "=The date today is: {{ $now }}/\nJSON Input:\n{{ $json.content.parts[0].text }}\n",
        "options": {
          "systemMessage": "\n### 🤖 **n8n AI AGENT ROLE: Appointment Availability Checker**\n\nYou are an automated agent in an n8n workflow. Your task is to validate grooming appointment availability using the **Google Calendar API**, applying strict logic and format compliance.\n\n---\n\n### 🕒 **TIME & FORMAT RULES**\n\n* All datetime values **must use RFC3339 format**\n  → Example: `2025-07-30T09:00:00+08:00`\n* Always apply the **+08:00 timezone offset** (PST / UTC+08:00)\n* When generating **error messages**, use **12-hour time format** for readability\n\n---\n\n### 🗓 **OPERATING HOURS**\n\n* **Open Days**: Monday, Wednesday–Sunday\n* **Closed**: Tuesday\n* **Business Hours**: 9:00 AM → 6:00 AM next day (21-hour operating window)\n\n---\n\n### 📋 **BOOKING VALIDATION RULES**\n\n* **2 hours per pet** → total time = pets × 2 hours\n* Reject if:\n\n  * Falls on **Tuesday**\n  * Start or end time is **outside the 21-hour window**\n  * **Overlaps** with existing confirmed events on Google Calendar\n  * Uses **wrong format** or **missing timezone offset**\n\n---\n\n### ✅ **CONFIRM AVAILABILITY ONLY IF:**\n\n* Time block is fully within allowed hours\n* No conflict exists in Google Calendar\n* Input datetime uses **valid RFC3339 format** with `+08:00` offset\n\n---\n\n### 🔍 **CALENDAR API LOGIC (FOR n8n HTTP NODE):**\n\n* Use the following window to check availability:\n\n  * `timeMin` = Appointment start\n  * `timeMax` = Appointment end\n* Example:\n\n  ```\n  timeMin: 2025-07-30T00:00:00+08:00  \n  timeMax: 2025-07-31T00:00:00+08:00\n  ```\n* Convert Google Calendar API response from `America/New_York` to **Asia/Manila** (`+08:00`) before comparison\n\n---\n\n### ⚠️ **AGENT RULES IN n8n:**\n\n* Output only: `available: true` or `available: false`\n* If `false`, provide clear reason (e.g., `\"Overlaps with existing booking\"`, `\"Outside business hours\"`)\n\n---\n"
        },
        "promptType": "define",
        "needsFallback": true,
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 2.1
    },
    {
      "id": "8affd593-b996-4c2e-99cd-1a7315d8a33a",
      "name": "条件判断1",
      "type": "n8n-nodes-base.if",
      "position": [
        624,
        -1200
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "aeea5ca0-a4d3-4597-990a-cabf04db26ce",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.available }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "09c0528e-8ad9-4a2e-8d70-3f5b9ab6edcd",
      "name": "创建事件",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        1056,
        -1296
      ],
      "parameters": {
        "end": "={{ $json.output.end }}",
        "start": "={{ $json.output.start }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "490ac9a4b7da6be934e10dff99ffe1428c844f69af1a3680f49bb64e3d28a658@group.calendar.google.com",
          "cachedResultName": "Grooming Schedule"
        },
        "additionalFields": {
          "summary": "={{ $json.output['Appointment Name'] }}"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6e5130cd-97a3-498e-86ee-2783143fb1c3",
      "name": "格式修正",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        -672,
        -1168
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.0-flash-lite",
          "cachedResultName": "models/gemini-2.0-flash-lite"
        },
        "options": {
          "systemMessage": " ---  ### 🧠 SYSTEM ROLE: Smart Format Fixer  You process grooming appointment requests using the format:  ``` /book <number_of_pets>, <preferred_datetime>, <optional_details> ```  ---  ### 📌 FORMAT RULES:  * `<number_of_pets>`: Positive integer * `<preferred_datetime>`: Must follow **RFC3339** format with `+08:00` offset   → Example: `2025-07-30T14:00:00+08:00` * `<optional_details>`: Optional notes (e.g., breed, requests).   → Must not break comma structure  ---  ### 🤖 BEHAVIOR:  * If format is **missing elements** or is **ambiguous**, try to **infer** missing parts using:    * Current **date** if no date is mentioned   * Nearest **valid time** if input is vague (e.g., `2pm`) * If input **can be fixed**, return only the corrected format:    ```   /book 1, 2025-07-30T14:00:00+08:00, later jorblok   ``` * If it **cannot** be reliably fixed, respond with:    ```   ERROR: Invalid format. Use /book <number_of_pets>, <preferred_datetime>, <optional_details>   ```  ---  ### ❌ DO NOT:  * Include explanations, markdown, breakdowns, or analysis * Output anything other than:    * The **fixed** `/book` command   * Or the single-line **ERROR message**  ---"
        },
        "messages": {
          "values": [
            {
              "content": "=Current Time:{{ $now.setZone('Asia/Manila')}}\n\ninput: {{ $json.message.text }}\n"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8e13ea40-006c-4960-bb75-18bfb3720a48",
      "name": "结构化输出解析器 1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        192,
        -976
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"available\": \"True\",\n  \"Appointment Name\": \"Goldie's Appointment\",\n  \"start\": \"2025-07-30T09:00:00+08:00\",\n  \"end\": \"2025-07-30T13:00:00+08:00\",\n  \"error\":\"There is an overlap\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "86ba4ff0-ff3d-437c-9683-acce38a98df5",
      "name": "在Google日历中获取日历可用性",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -64,
        -976
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
        "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_Time', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "490ac9a4b7da6be934e10dff99ffe1428c844f69af1a3680f49bb64e3d28a658@group.calendar.google.com",
          "cachedResultName": "Grooming Schedule"
        },
        "resource": "calendar"
      },
      "retryOnFail": false,
      "typeVersion": 1.3
    },
    {
      "id": "d340e325-6934-4513-9c00-3efc1bca4444",
      "name": "思考",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        64,
        -976
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "425c11f5-9cdc-4f92-8538-31849a13d6ec",
      "name": "OpenAI 聊天模型2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -320,
        -976
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "71b1f09d-9503-4a93-ae84-bcb98565cde6",
      "name": "Google Gemini 聊天模型2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -192,
        -976
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b956d981-6b57-4f88-a168-8f2f35ef3232",
      "name": "添加行1",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -112,
        448
      ],
      "parameters": {
        "columns": {
          "value": {
            "Pet_Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Pet_Name', ``, 'string') }}",
            "Uploaded": "False",
            "Image_Url": "={{ $json.image_url }}",
            "Owners_Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Owners_Name', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Pet_Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Pet_Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Owners_Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Owners_Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image_Url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Image_Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Uploaded",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Uploaded",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Pet_Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "cellFormat": "RAW"
        },
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LPX3j53agLsFtpuyQ_tgJ1xY1STPJMnjHux560beu3c/edit?usp=drivesdk",
          "cachedResultName": "Posting Details"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "J0zDW7WLt4PeG2kS",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "5715f9ce-c0a4-4e35-9c7a-331ee981fdfa",
      "name": "AI帖子调度器1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -176,
        256
      ],
      "parameters": {
        "text": "=User Input:\n{{ $json.caption }}\n{{ $json.image_url || \"\" }}\n\nIf the attachment does not contain Pet_name and Owners_Name update the previous Row, with the Previous URL + \",\" + Current URL\ncurrent time:\n{{ $now}}",
        "options": {
          "systemMessage": "You are a data automation agent.\nYour task is to process image album messages received from Telegram and manage their metadata.\nFollow these steps precisely:\n\n📥 1. Gather Inputs:\nExtract all image file URLs from an incoming Telegram message (Note: albums send multiple messages).\n\nOnly the first image may contain a caption with details.\n\nUse this caption to extract:\nPet_Name\nOwners_Name\n\n📂 2. Track and Group Album Images:\nIf image doesn't have Pet name or Owners Name, Set Cell name to Unavailable\n\n📊 3. Store in Google Sheets:\nAppend each image and metadata as a new row in the Google Sheet.\n\n💬 5. Telegram Feedback via sendMessage:\nAfter each upload (or failed upload), send a Telegram status update using the sendMessage node.\n\nSuccess Message:\n✅ Successfully added facebook post for queuing.\n\n🧠 Tools You Can Use:\nTelegram Node for input\n\nGoogle Sheets Node for append/update/GET ROW\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "657c4501-a982-43b3-9f9d-87ce2050966a",
      "name": "格式化响应1",
      "type": "n8n-nodes-base.set",
      "position": [
        -480,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b94ad06-0461-48e6-9075-8bb66787b623",
              "name": "image_url",
              "type": "string",
              "value": "=https://api.telegram.org/file/bot<YOUR_BOT_TOKEN>/{{ $json.result.file_path }}\n"
            },
            {
              "id": "2f2ce553-82cf-408a-b9be-3fb09f06deff",
              "name": "caption",
              "type": "string",
              "value": "={{ $('On Message Receive').item.json.message.caption }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e479fdd7-e918-486b-9317-b9f1911d0489",
      "name": "获取文件ID1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -704,
        336
      ],
      "webhookId": "38e9372f-3ed6-4176-81d4-bc66ae2265fc",
      "parameters": {
        "fileId": "={{ $json.message.photo[$json.message.photo.length - 1].file_id }}",
        "download": false,
        "resource": "file"
      },
      "credentials": {
        "telegramApi": {
          "id": "qzw76kM1w1nZA0a6",
          "name": "Subreddit_finder_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "86485653-9095-4f66-af9a-a07f231333d4",
      "name": "OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -272,
        464
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "73429452-3aca-4b10-8e6f-271be6810edc",
      "name": "在Telegram中发送文本消息1",
      "type": "n8n-nodes-base.telegramTool",
      "position": [
        64,
        448
      ],
      "webhookId": "62dd0cdc-28e6-4b31-9757-517327642623",
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}",
        "chatId": "{Your Chat ID}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "qzw76kM1w1nZA0a6",
          "name": "Subreddit_finder_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a7cb00f3-54f0-465f-8f78-73785eb74900",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -736
      ],
      "parameters": {
        "color": 4,
        "width": 2336,
        "height": 800,
        "content": "# 社交媒体管理代理 (/post)"
      },
      "typeVersion": 1
    },
    {
      "id": "8d117704-38b6-40d5-952c-1a69ef7860ea",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        64
      ],
      "parameters": {
        "color": 6,
        "width": 1216,
        "height": 528,
        "content": "# Facebook帖子调度器"
      },
      "typeVersion": 1
    },
    {
      "id": "b7de59e5-d97e-41da-a1a4-2b9ec9402def",
      "name": "分析图片",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        352,
        -496
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "resource": "image",
        "imageUrls": "={{ $json.Image_Url }}",
        "operation": "analyze"
      },
      "typeVersion": 1.8
    },
    {
      "id": "b4ae0d96-edd3-433d-9982-1426cd449e86",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -704,
        -400
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 1
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "82e5882e-013a-4b06-b680-c0472084ec79",
      "name": "在Facebook上发布",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1056,
        -496
      ],
      "parameters": {
        "edge": "photos",
        "node": "me",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "caption",
                "value": "={{ $json.output.caption }}"
              },
              {
                "name": "=url",
                "value": "={{ $('Get row(s) in sheet').item.json.Image_Url }}"
              }
            ]
          }
        },
        "graphApiVersion": "v22.0",
        "httpRequestMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "fbed1f4f-84de-49a0-9878-66d577c989e7",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -1536
      ],
      "parameters": {
        "color": 6,
        "width": 2336,
        "height": 800,
        "content": "# 预订代理(队列)"
      },
      "typeVersion": 1
    },
    {
      "id": "5a1f077f-f7c5-4669-9f64-57a66acb97e7",
      "name": "队列中无帖子",
      "type": "n8n-nodes-base.telegram",
      "position": [
        240,
        -304
      ],
      "webhookId": "b3a5a335-6201-41af-824e-b67753c09d3f",
      "parameters": {
        "text": "Sorry. There's no Post on queue.",
        "chatId": "-1002644587108",
        "forceReply": {},
        "replyMarkup": "forceReply",
        "additionalFields": {
          "appendAttribution": false,
          "reply_to_message_id": "={{ $json.message.message_id }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "qzw76kM1w1nZA0a6",
          "name": "Subreddit_finder_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4cb65717-2f65-490a-b057-1dfec0321245",
      "name": "成功消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1056,
        -688
      ],
      "webhookId": "b3a5a335-6201-41af-824e-b67753c09d3f",
      "parameters": {
        "text": "Will Start Posting now.",
        "chatId": "{Your chat id here}",
        "forceReply": {},
        "replyMarkup": "forceReply",
        "additionalFields": {
          "appendAttribution": false,
          "reply_to_message_id": "={{ $json.message.message_id }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "qzw76kM1w1nZA0a6",
          "name": "Subreddit_finder_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "956bb4a5-95b2-4f76-915f-4037cd51e22f",
      "name": "错误消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1056,
        -1104
      ],
      "webhookId": "b3a5a335-6201-41af-824e-b67753c09d3f",
      "parameters": {
        "text": "={{ $json.output.error }}",
        "chatId": "-1002644587108",
        "forceReply": {},
        "replyMarkup": "forceReply",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "qzw76kM1w1nZA0a6",
          "name": "Subreddit_finder_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a33750df-00aa-49fb-9422-11fd23ddecfa",
      "name": "成功消息1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1280,
        -1296
      ],
      "webhookId": "b3a5a335-6201-41af-824e-b67753c09d3f",
      "parameters": {
        "text": "Appointment Added!",
        "chatId": "-1002644587108",
        "forceReply": {},
        "replyMarkup": "forceReply",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "qzw76kM1w1nZA0a6",
          "name": "Subreddit_finder_bot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8f6b6427-40e5-4891-b33e-4e0fb28fde11",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -1120
      ],
      "parameters": {
        "width": 352,
        "height": 320,
        "content": "## 打字效果"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Set Upload to True",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No post on queue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Create an event",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Add Row1": {
      "ai_tool": [
        [
          {
            "node": "AI Post Scheduler1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get FileID1": {
      "main": [
        [
          {
            "node": "Format Response1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Caption Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Message": {
      "main": [
        [
          {
            "node": "Typing Effect",
            "type": "main",
            "index": 0
          },
          {
            "node": "Format Fixing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Typing Effect",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get FileID1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Fixing": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create an event": {
      "main": [
        [
          {
            "node": "Success Message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response1": {
      "main": [
        [
          {
            "node": "AI Post Scheduler1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Caption Generation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Caption Generation": {
      "main": [
        [
          {
            "node": "Post  on Facebook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Message Receive": {
      "main": [
        [
          {
            "node": "Check Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Post Scheduler1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Upload to True": {
      "main": [
        [
          {
            "node": "Success Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Caption Generation",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message in Telegram1": {
      "ai_tool": [
        [
          {
            "node": "AI Post Scheduler1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get availability in a calendar in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI 聊天机器人, 多模态 AI

需要付费吗?

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

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

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

作者
Christian Moises

Christian Moises

@hyxcreation

I value my time. so I created an Automation for 4 hours to save 20 minutes. I'll post all my works so you'd save that 20 minutes without spending 4 hours to create it. lol.

外部链接
在 n8n.io 查看

分享此工作流