Publication et réservation automatisées pour services de toilettage animal

Avancé

Ceci est unAI Chatbot, Multimodal AIworkflow d'automatisation du domainecontenant 36 nœuds.Utilise principalement des nœuds comme If, Set, Switch, Telegram, GoogleSheets. Automatiser la publication et les réservations pour toilettage de animaux de compagnie via un robot AI, Facebook et Telegram

Prérequis
  • Token Bot Telegram
  • Informations d'identification Google Sheets API
  • Clé API OpenAI
  • Informations d'identification Facebook Graph API
  • Clé API Google Gemini
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "8f5bc3586a09bb005132364a23028fdc8e3d8c8e33cd86682840171acfa0648a",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a9bf4049-419f-4fc2-8f35-0222d0e441dd",
      "name": "Obtenir ligne(s) dans la feuille",
      "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": "Modèle de chat 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": "Structured Output Parser",
      "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": "Modèle de chat Google Gemini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        928,
        -128
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "75098650-571a-4ec3-b7f7-4f2a54534f8c",
      "name": "On Message Receive",
      "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": "Check Message",
      "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": "If",
      "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": "Définir Upload to 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": "Caption Generation",
      "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": "Typing Effect",
      "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": "Agent IA1",
      "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": "If1",
      "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": "Create an event",
      "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": "Format Fixing",
      "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": "Structured Output Parser1",
      "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": "Get availability in a calendar in Google Agenda",
      "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": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        64,
        -976
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "425c11f5-9cdc-4f92-8538-31849a13d6ec",
      "name": "Modèle de chat OpenAI2",
      "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": "Modèle de chat Google Gemini2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -192,
        -976
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b956d981-6b57-4f88-a168-8f2f35ef3232",
      "name": "Add Row1",
      "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 Post Scheduler1",
      "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": "Format Response1",
      "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": "Get FileID1",
      "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": "Modèle de chat OpenAI1",
      "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": "Send a text message in Telegram1",
      "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": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -736
      ],
      "parameters": {
        "color": 4,
        "width": 2336,
        "height": 800,
        "content": "# Social Media Manager Agent (/post) \n\n- ### Triggered on Command call & Scheduled Trigger(Optional)\n## Flow\n1. Access the google sheet and check for all rows with Uploaded=False (means it hasn't been uploaded yet)\n2. Proceeds with the Row that hasn't been posted yet and returns Image URL, Pet and Owner's name.\n3. Send the Image URL to an Image Analyzer model, to explain what the image is\n4. Auto Generate Caption with based on the Image URL, Pet and Owner's name.\n5. Access Google sheet and set the row to True since it has been processed and uploaded.\n6. Send a status update on telegram."
      },
      "typeVersion": 1
    },
    {
      "id": "8d117704-38b6-40d5-952c-1a69ef7860ea",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        64
      ],
      "parameters": {
        "color": 6,
        "width": 1216,
        "height": 528,
        "content": "# Facebook Post Scheduler\n-All messages sent on the bot with an image and a caption are all passed here.\n## Flow\n1. Get file ID of the image (File ID is needed to get the Image URL)\n2. Format Response (Add your bot_token in the Format_response node) \n3. Use an AI Agent with Access to Telegram Node to send a message and Google sheets, to push your image and details to the queue."
      },
      "typeVersion": 1
    },
    {
      "id": "b7de59e5-d97e-41da-a1a4-2b9ec9402def",
      "name": "Analyze image",
      "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": "Déclencheur planifié",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -704,
        -400
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 1
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "82e5882e-013a-4b06-b680-c0472084ec79",
      "name": "Post on 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": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -1536
      ],
      "parameters": {
        "color": 6,
        "width": 2336,
        "height": 800,
        "content": "# Booking Agent (Queue)\nFlow:\n-Format the message to proper Format accordingly\n-Send to Agent with access to Google Calendar\n-Agent Checks if the specified timeslot is empty\n-Condition: If  timeslot available, Proceed and create a calendar event then send a message. , Else, Just send a telegram message about the status\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5a1f077f-f7c5-4669-9f64-57a66acb97e7",
      "name": "No post on queue",
      "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": "Success Message",
      "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": "Error Message",
      "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": "Success Message1",
      "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": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -1120
      ],
      "parameters": {
        "width": 352,
        "height": 320,
        "content": "## Typing effect \nThe purpose of this node is to add an indicator that the workflow is working by adding a typing effect from the bot once a message is received."
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "9554b807-009f-4bbf-bb11-848fe98d1fdf": {
      "main": [
        [
          {
            "node": "Set Upload to True",
            "type": "main",
            "index": 0
          },
          {
            "node": "b7de59e5-d97e-41da-a1a4-2b9ec9402def",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "5a1f077f-f7c5-4669-9f64-57a66acb97e7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8affd593-b996-4c2e-99cd-1a7315d8a33a": {
      "main": [
        [
          {
            "node": "09c0528e-8ad9-4a2e-8d70-3f5b9ab6edcd",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "956bb4a5-95b2-4f76-915f-4037cd51e22f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d340e325-6934-4513-9c00-3efc1bca4444": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "b956d981-6b57-4f88-a168-8f2f35ef3232": {
      "ai_tool": [
        [
          {
            "node": "5715f9ce-c0a4-4e35-9c7a-331ee981fdfa",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "8affd593-b996-4c2e-99cd-1a7315d8a33a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e479fdd7-e918-486b-9317-b9f1911d0489": {
      "main": [
        [
          {
            "node": "657c4501-a982-43b3-9f9d-87ce2050966a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b7de59e5-d97e-41da-a1a4-2b9ec9402def": {
      "main": [
        [
          {
            "node": "78ca79da-ec49-4b5c-a953-ee8211c509dd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "073baf82-c455-40db-bfe0-6ccf362e804d": {
      "main": [
        [
          {
            "node": "bfc57be1-d132-4a9e-b720-a816a6c57428",
            "type": "main",
            "index": 0
          },
          {
            "node": "6e5130cd-97a3-498e-86ee-2783143fb1c3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a9bf4049-419f-4fc2-8f35-0222d0e441dd",
            "type": "main",
            "index": 0
          },
          {
            "node": "bfc57be1-d132-4a9e-b720-a816a6c57428",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "e479fdd7-e918-486b-9317-b9f1911d0489",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6e5130cd-97a3-498e-86ee-2783143fb1c3": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "09c0528e-8ad9-4a2e-8d70-3f5b9ab6edcd": {
      "main": [
        [
          {
            "node": "a33750df-00aa-49fb-9422-11fd23ddecfa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "657c4501-a982-43b3-9f9d-87ce2050966a": {
      "main": [
        [
          {
            "node": "5715f9ce-c0a4-4e35-9c7a-331ee981fdfa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "a9bf4049-419f-4fc2-8f35-0222d0e441dd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "78ca79da-ec49-4b5c-a953-ee8211c509dd",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "78ca79da-ec49-4b5c-a953-ee8211c509dd": {
      "main": [
        [
          {
            "node": "82e5882e-013a-4b06-b680-c0472084ec79",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "75098650-571a-4ec3-b7f7-4f2a54534f8c": {
      "main": [
        [
          {
            "node": "073baf82-c455-40db-bfe0-6ccf362e804d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "5715f9ce-c0a4-4e35-9c7a-331ee981fdfa",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Upload to True": {
      "main": [
        [
          {
            "node": "4cb65717-2f65-490a-b057-1dfec0321245",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a9bf4049-419f-4fc2-8f35-0222d0e441dd": {
      "main": [
        [
          {
            "node": "9554b807-009f-4bbf-bb11-848fe98d1fdf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "85dbf0aa-c85f-48ab-ae5f-734f2c1ce873": {
      "ai_outputParser": [
        [
          {
            "node": "78ca79da-ec49-4b5c-a953-ee8211c509dd",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "85dbf0aa-c85f-48ab-ae5f-734f2c1ce873",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "8e13ea40-006c-4960-bb75-18bfb3720a48": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "73429452-3aca-4b10-8e6f-271be6810edc": {
      "ai_tool": [
        [
          {
            "node": "5715f9ce-c0a4-4e35-9c7a-331ee981fdfa",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get availability in a calendar in Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Chatbot IA, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds36
Catégorie2
Types de nœuds20
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
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.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34