AutomationFlowsSlack & Telegram › Inspect Product Quality From Telegram Photos with Google Sheets and Gemini

Inspect Product Quality From Telegram Photos with Google Sheets and Gemini

ByRahul Joshi @rahul08 on n8n.io

This workflow accepts product inspection photos from Telegram, looks up product-specific quality standards in Google Sheets, and uses Google Gemini to return a structured pass/fail defect verdict that is logged to Sheets and routed to operators and supervisors via Telegram,…

Event trigger★★★★☆ complexityAI-powered21 nodesTelegram TriggerGoogle SheetsGoogle GeminiTelegramGmailError TriggerSlack
Slack & Telegram Trigger: Event Nodes: 21 Complexity: ★★★★☆ AI nodes: yes Added:
Inspect Product Quality From Telegram Photos with Google Sheets and Gemini — n8n workflow card showing Telegram Trigger, Google Sheets, Google Gemini integration

This workflow corresponds to n8n.io template #17972 — we link there as the canonical source.

This workflow follows the Error Trigger → Gmail recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "vKvcLNAoAH1LnSBR",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI Visual Quality Inspection & Defect Detection System",
  "tags": [],
  "nodes": [
    {
      "id": "bba85d7e-3c98-481d-b847-52f38d66dc40",
      "name": "\ud83d\udccc Overview \u2013 How This Workflow Works",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2464,
        1360
      ],
      "parameters": {
        "color": 2,
        "width": 904,
        "height": 700,
        "content": "## \ud83d\udd2c AI Visual Quality Inspection & Defect Detection\n\n### How it works\nA factory operator or QC technician photographs a product and sends the image to a Telegram bot. The workflow checks that a photo was attached, then reads the product's reference standard from Google Sheets \u2014 the accepted defect thresholds, material spec, and inspection criteria. The image and standard are packaged into a prompt for Google Gemini 2.5 Flash, which returns a structured verdict: Pass or Fail, defect type, severity, affected area, and confidence score. Every inspection is logged to the `Inspection_Log` sheet. Failures are written to the `Rejected_Items` sheet, a Telegram alert is sent to the operator, and a Gmail report goes to the supervisor. Pass results send a quick Telegram confirmation. A dedicated Slack alert catches any Gemini AI failure so no image goes unreviewed.\n\n### Setup steps\n1. Connect **Telegram Bot API** to the trigger and all Telegram message nodes.\n2. Connect **Google Sheets OAuth2** and create a sheet with three tabs: `Reference_Standards`, `Inspection_Log`, `Rejected_Items`. Replace `YOUR_GOOGLE_SHEET_ID` in every Sheets node.\n3. Connect **Google Gemini API** to the Analyze Image node. Ensure your project has Gemini 2.5 Flash enabled.\n4. Connect **Gmail OAuth2** and update `supervisor@yourcompany.com` in the Gmail supervisor alert node.\n5. Connect **Slack OAuth2** and replace `YOUR_SLACK_CHANNEL_ID` in both Slack error nodes.\n6. Replace `YOUR_OPERATOR_TELEGRAM_CHAT_ID` if you want alerts sent to a specific operator chat.\n7. Activate the Telegram trigger."
      },
      "typeVersion": 1
    },
    {
      "id": "4f740e68-c84c-46e5-a1ab-a4cad34f4e33",
      "name": "Section \u2013 Image Intake & Photo Validation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        2064
      ],
      "parameters": {
        "color": 7,
        "width": 848,
        "height": 600,
        "content": "## \ud83d\udcf8 Image Intake & Photo Validation\nReceives the Telegram message, checks that it contains a photo (not just text), and blocks the flow early if no image was attached \u2014 preventing downstream errors from running against an empty input."
      },
      "typeVersion": 1
    },
    {
      "id": "851ea8b8-17f9-46a5-bb31-9b42c29cac90",
      "name": "Section \u2013 Reference Lookup & AI Analysis",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        2064
      ],
      "parameters": {
        "color": 7,
        "width": 1276,
        "height": 584,
        "content": "## \ud83d\udccb Reference Standard Lookup & AI Analysis\nFetches the product's accepted quality thresholds from Google Sheets, packages the image and spec into a structured Gemini prompt, and calls Gemini 2.5 Flash. The raw response is parsed into a clean JSON verdict: Pass/Fail, defect type, severity, and confidence."
      },
      "typeVersion": 1
    },
    {
      "id": "70619ce6-585e-48e4-a723-3265ce6b30ce",
      "name": "Section \u2013 Defect Routing & Notifications",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        1648
      ],
      "parameters": {
        "color": 7,
        "width": 940,
        "height": 1384,
        "content": "## \ud83d\udea8 Defect Routing & Multi-Channel Notifications\nFail results log the rejected item, send a Telegram failure alert to the operator, and email a full inspection report to the supervisor via Gmail. Pass results send a brief Telegram confirmation. Every inspection \u2014 pass or fail \u2014 is appended to the Inspection_Log sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "88e5cd5f-ca6a-4d28-8ac3-84db87d151ab",
      "name": "Code - Extract Metadata (Telegram)",
      "type": "n8n-nodes-base.code",
      "position": [
        -752,
        2368
      ],
      "parameters": {
        "jsCode": "const msg = $json.message;\n\nreturn {\n  json: {\n    productCode: (msg.caption || 'UNKNOWN').trim().toUpperCase(),\n    source: 'telegram',\n    chatId: msg.chat.id,\n    telegramFileId: msg.photo[msg.photo.length - 1].file_id,\n    mimeType: 'image/jpeg',\n    base64Image: $binary.data.data\n  },\n  binary: {\n    data: $binary.data\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "7b38a67a-d042-4334-9257-69a5f21dc633",
      "name": "Telegram Trigger - New Inspection Image",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1264,
        2368
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "download": true
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ae4b1585-b62f-4bc8-a96e-53f432896e34",
      "name": "IF - Has Photo?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1008,
        2368
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cond-has-photo",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ !!$json.message.photo }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7cfcce91-eb17-491f-98be-6a1a19499d75",
      "name": "Google Sheets - Get Reference Standard",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -496,
        2384
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.productCode }}",
              "lookupColumn": "productCode"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 2073897661,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=2073897661",
          "cachedResultName": "Reference_Standards"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "QC Inspection Sheet"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "45021934-1327-4f28-bba9-326a9f4156cd",
      "name": "Code - Prepare Gemini Request",
      "type": "n8n-nodes-base.code",
      "position": [
        -224,
        2384
      ],
      "parameters": {
        "jsCode": "const referenceDescription = $json.referenceDescription || 'No reference standard on file. Apply general manufacturing quality standards: check for scratches, dents, discoloration, misalignment, missing parts, or contamination.';\nconst toleranceNotes = $json.toleranceNotes || 'Standard industry tolerance.';\n\nconst meta = $('Code - Extract Metadata (Telegram)').item.json;\nconst binaryData = $('Code - Extract Metadata (Telegram)').item.binary.data;\n\nconst prompt = `You are an AI Quality Control inspector analyzing a product image for manufacturing defects.\n\nProduct Code: ${meta.productCode}\nReference Standard: ${referenceDescription}\nAcceptable Tolerances: ${toleranceNotes}\n\nCarefully compare the provided image against the reference standard above. Check for: surface defects (scratches, dents, discoloration, cracks), dimensional irregularities, missing or misaligned components, contamination, or packaging defects.\n\nRespond ONLY with valid JSON in this exact structure, with no markdown formatting and no extra text:\n{\n  \"result\": \"PASS or FAIL\",\n  \"confidence\": 0-100,\n  \"defect_type\": \"defect category or None\",\n  \"defect_location\": \"description of where on the product or N/A\",\n  \"severity\": \"Low, Medium, High, or N/A\",\n  \"description\": \"brief explanation of the finding\",\n  \"recommended_action\": \"Accept, Rework, or Reject\"\n}`;\n\nreturn {\n  json: {\n    productCode: meta.productCode,\n    source: meta.source,\n    chatId: meta.chatId || null,\n    telegramFileId: meta.telegramFileId || null,\n    prompt,\n    mimeType: meta.mimeType || 'image/jpeg',\n    base64Image: meta.base64Image\n  },\n  binary: {\n    data: binaryData\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "1841485c-2852-4819-9161-a3205ad59706",
      "name": "Analyze Image with Gemini",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "onError": "continueErrorOutput",
      "position": [
        64,
        2384
      ],
      "parameters": {
        "text": "={{ $json.prompt }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "resource": "image",
        "inputType": "binary",
        "operation": "analyze"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f656d5e9-10a0-4bc7-9550-3a346d49f76e",
      "name": "Code - Parse Gemini Response",
      "type": "n8n-nodes-base.code",
      "position": [
        368,
        2368
      ],
      "parameters": {
        "jsCode": "const response = $json;\nlet resultText = '{}';\n\ntry {\n  if (response.candidates && response.candidates[0]?.content?.parts?.[0]?.text) {\n    // raw Gemini API shape\n    resultText = response.candidates[0].content.parts[0].text;\n  } else if (response.content && response.content.parts && response.content.parts[0] && response.content.parts[0].text) {\n    // LangChain Gemini node's native shape (this is your case)\n    resultText = response.content.parts[0].text;\n  } else if (typeof response.content === 'string') {\n    resultText = response.content;\n  } else if (typeof response.text === 'string') {\n    resultText = response.text;\n  } else {\n    throw new Error('Unrecognized Gemini response shape: ' + JSON.stringify(response).slice(0, 200));\n  }\n} catch (e) {\n  resultText = JSON.stringify({\n    result: 'FAIL',\n    confidence: 0,\n    defect_type: 'API Error',\n    defect_location: 'N/A',\n    severity: 'N/A',\n    description: 'Gemini API did not return a valid response: ' + e.message,\n    recommended_action: 'Manual Review'\n  });\n}\n\nlet parsed;\ntry {\n  parsed = JSON.parse(resultText);\n} catch (e) {\n  const match = resultText.match(/\\{[\\s\\S]*\\}/);\n  parsed = match ? JSON.parse(match[0]) : {\n    result: 'FAIL', confidence: 0, defect_type: 'Parse Error', defect_location: 'N/A',\n    severity: 'N/A', description: 'Could not parse AI response.', recommended_action: 'Manual Review'\n  };\n}\n\nconst req = $('Code - Prepare Gemini Request').item.json;\n\nreturn {\n  json: {\n    timestamp: new Date().toISOString(),\n    productCode: req.productCode,\n    source: req.source,\n    chatId: req.chatId,\n    telegramFileId: req.telegramFileId,\n    result: (parsed.result || 'FAIL').toString().toUpperCase().includes('PASS') ? 'PASS' : 'FAIL',\n    confidence: parsed.confidence ?? 0,\n    defectType: parsed.defect_type || 'Unknown',\n    defectLocation: parsed.defect_location || 'N/A',\n    severity: parsed.severity || 'N/A',\n    description: parsed.description || '',\n    recommendedAction: parsed.recommended_action || 'Manual Review'\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "09ea4b2e-a0a5-4bbc-b530-e2d73295ba35",
      "name": "Google Sheets - Log Inspection Result",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        624,
        2368
      ],
      "parameters": {
        "columns": {
          "value": {
            "result": "={{ $json.result }}",
            "source": "={{ $json.source }}",
            "severity": "={{ $json.severity }}",
            "timestamp": "={{ $json.timestamp }}",
            "confidence": "={{ $json.confidence }}",
            "defectType": "={{ $json.defectType }}",
            "description": "={{ $json.description }}",
            "productCode": "={{ $json.productCode }}",
            "defectLocation": "={{ $json.defectLocation }}",
            "recommendedAction": "={{ $json.recommendedAction }}"
          },
          "schema": [
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productCode",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "productCode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "result",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "result",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "confidence",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "confidence",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "defectType",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "defectType",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "defectLocation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "defectLocation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "severity",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "severity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendedAction",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "recommendedAction",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 881315503,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=881315503",
          "cachedResultName": "Inspection_Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "QC Inspection Sheet"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "40a28ed8-ced3-47f2-83c1-c1fea1a9a06e",
      "name": "IF - Defect Detected?",
      "type": "n8n-nodes-base.if",
      "position": [
        896,
        2368
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cond-fail",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.result }}",
              "rightValue": "FAIL"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "699ec179-4f24-4e99-bfb5-d202e5685df6",
      "name": "Telegram - Send Failure Alert",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1280,
        1872
      ],
      "parameters": {
        "text": "=\ud83d\udea8 QC FAIL \u2014 {{ $json.productCode }} Severity: {{ $json.severity }} Defect: {{ $json.defectType }} ({{ $json.defectLocation }}) Confidence: {{ $json.confidence }}% Action: {{ $json.recommendedAction }}  {{ $json.description }}",
        "chatId": "=YOUR_OPERATOR_TELEGRAM_CHAT_ID",
        "additionalFields": {}
      },
      "typeVersion": 1.2,
      "continueOnFail": true
    },
    {
      "id": "2e04207f-9b79-4c18-9902-a4e7f1951973",
      "name": "Gmail - Send Supervisor Alert",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1296,
        2176
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=<h2>Quality Control Failure</h2><table border=\"1\" cellpadding=\"6\" style=\"border-collapse:collapse\"><tr><td><b>Product Code</b></td><td>{{ $json.productCode }}</td></tr><tr><td><b>Result</b></td><td>{{ $json.result }}</td></tr><tr><td><b>Confidence</b></td><td>{{ $json.confidence }}%</td></tr><tr><td><b>Defect Type</b></td><td>{{ $json.defectType }}</td></tr><tr><td><b>Location</b></td><td>{{ $json.defectLocation }}</td></tr><tr><td><b>Severity</b></td><td>{{ $json.severity }}</td></tr><tr><td><b>Recommended Action</b></td><td>{{ $json.recommendedAction }}</td></tr><tr><td><b>Source</b></td><td>{{ $json.source }}</td></tr><tr><td><b>Timestamp</b></td><td>{{ $json.timestamp }}</td></tr></table><p>{{ $json.description }}</p>",
        "options": {},
        "subject": "=\u26a0\ufe0f QC FAIL Alert - {{ $json.productCode }} ({{ $json.severity }} severity)"
      },
      "typeVersion": 2.1
    },
    {
      "id": "d97b5191-cfc0-491c-81e2-76fe1b80de2c",
      "name": "Google Sheets - Log Rejected Item",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1296,
        2560
      ],
      "parameters": {
        "columns": {
          "value": {
            "source": "={{ $json.source }}",
            "severity": "={{ $json.severity }}",
            "timestamp": "={{ $json.timestamp }}",
            "defectType": "={{ $json.defectType }}",
            "description": "={{ $json.description }}",
            "productCode": "={{ $json.productCode }}",
            "recommendedAction": "={{ $json.recommendedAction }}"
          },
          "schema": [
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productCode",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "productCode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "defectType",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "defectType",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "severity",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "severity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendedAction",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "recommendedAction",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 766416446,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=766416446",
          "cachedResultName": "Rejected_Items"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "QC Inspection Sheet"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "e4e76d2b-4e2b-4580-80c6-9830f1dc2ad6",
      "name": "Telegram - Send Pass Confirmation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1312,
        2816
      ],
      "parameters": {
        "text": "=\u2705 PASS \u2014 {{ $json.productCode }}\nConfidence: {{ $json.confidence }}%\n{{ $json.description }}",
        "chatId": "={{ $json.chatId }}",
        "additionalFields": {}
      },
      "typeVersion": 1.2,
      "continueOnFail": true
    },
    {
      "id": "eae29780-697d-4a8d-8f98-acf1e9cbfd3a",
      "name": "Section \u2013 Error Handling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        2912
      ],
      "parameters": {
        "color": 7,
        "width": 924,
        "height": 584,
        "content": "## \u26a0\ufe0f Error Handling\nA workflow-level error trigger catches any node failure and posts a Slack alert. The Gemini AI node also has a dedicated error output path with its own Slack alert. Replace `YOUR_SLACK_CHANNEL_ID` in both Slack nodes before activating."
      },
      "typeVersion": 1
    },
    {
      "id": "e1dd2bae-c4fe-477f-b598-729fb670021b",
      "name": "On Workflow Error",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -176,
        3200
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7170b378-551c-471f-b707-20c621c2bcf1",
      "name": "Slack \u2013 Post Workflow Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        96,
        3200
      ],
      "parameters": {
        "text": "=\u26a0\ufe0f *AI Crisis Management Agent Error*\n\n*Workflow:* {{ $workflow.name }}\n*Failed Node:* {{ $execution.lastNodeExecuted }}\n*Time:* {{ $now.format('MMM D, YYYY \u2013 HH:mm') }}\n*Execution ID:* {{ $execution.id }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "your-alerts-channel"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "id": "a890c2a0-2d9f-41f8-8b20-da45042de262",
      "name": "Slack \u2013 Post Defect Detection AI Error",
      "type": "n8n-nodes-base.slack",
      "position": [
        400,
        3200
      ],
      "parameters": {
        "text": "=Error in the Gemini node .",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "your-alerts-channel"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "75615a0a-44b1-4245-8951-18539b40dec3",
  "nodeGroups": [],
  "connections": {
    "IF - Has Photo?": {
      "main": [
        [
          {
            "node": "Code - Extract Metadata (Telegram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Workflow Error": {
      "main": [
        [
          {
            "node": "Slack \u2013 Post Workflow Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF - Defect Detected?": {
      "main": [
        [
          {
            "node": "Telegram - Send Failure Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Gmail - Send Supervisor Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Sheets - Log Rejected Item",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram - Send Pass Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Image with Gemini": {
      "main": [
        [
          {
            "node": "Code - Parse Gemini Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack \u2013 Post Defect Detection AI Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Parse Gemini Response": {
      "main": [
        [
          {
            "node": "Google Sheets - Log Inspection Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Prepare Gemini Request": {
      "main": [
        [
          {
            "node": "Analyze Image with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Extract Metadata (Telegram)": {
      "main": [
        [
          {
            "node": "Google Sheets - Get Reference Standard",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets - Log Inspection Result": {
      "main": [
        [
          {
            "node": "IF - Defect Detected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets - Get Reference Standard": {
      "main": [
        [
          {
            "node": "Code - Prepare Gemini Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger - New Inspection Image": {
      "main": [
        [
          {
            "node": "IF - Has Photo?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack \u2013 Post Defect Detection AI Error": {
      "main": [
        [
          {
            "node": "IF - Has Photo?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow accepts product inspection photos from Telegram, looks up product-specific quality standards in Google Sheets, and uses Google Gemini to return a structured pass/fail defect verdict that is logged to Sheets and routed to operators and supervisors via Telegram,…

Source: https://n8n.io/workflows/17972/ — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

This workflow lets customers order and refill prescriptions via Telegram by extracting medicines from prescription images with Google Gemini, checking and updating inventory in Google Sheets, and send

Telegram Trigger, Telegram, Google Gemini +3
Slack & Telegram

This workflow runs daily to forecast SKU demand from Google Sheets data, drafts purchase-order justifications with OpenAI, routes critical and warning items for Telegram review and Slack alerts, logs

Error Trigger, Slack, Google Sheets +4
Slack & Telegram

This workflow manages clinic appointments across Google Sheets and Google Calendar, using webhooks and Telegram to book and confirm visits, Gmail and Telegram to deliver prescriptions, scheduled Teleg

Google Calendar, Telegram, Google Sheets +4
Slack & Telegram

This workflow handles customer order complaints submitted via Telegram by looking up order details in Google Sheets, using OpenAI to classify message sentiment, and routing each case to auto-approval,

Telegram Trigger, Google Sheets, Telegram +3
Slack & Telegram

This workflow handles COD order confirmation and abandoned-cart recovery by combining webhooks, Google Sheets logging, OpenAI message generation, and Telegram messaging with inline buttons, plus Slack

Telegram Trigger, Google Sheets, Telegram +3