8
n8n 中文网amn8n.com

企业版Telegram销售助手

高级

这是一个AI领域的自动化工作流,包含 16 个节点。主要使用 If, Telegram, Agent, TelegramTrigger, GoogleSheetsTool 等节点,结合人工智能技术实现智能自动化。 AI销售代理:Telegram审批与Google表格同步

前置要求
  • Telegram Bot Token
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "FRSKpIbukzy1vMnJ",
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
  },
  "name": "企业版 Telegram 销售助手",
  "tags": [],
  "nodes": [
    {
      "id": "f9ca2a43-862b-4e09-8fd4-4a06b7ca0cdd",
      "name": "AI 助手",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1100,
        -140
      ],
      "parameters": {
        "text": "={{ $json.message.text }} {{ $json.data.text }}",
        "options": {
          "systemMessage": "=## [YOUR_BUSINESS_NAME] Assistant\n\nYou are [ASSISTANT_NAME], the friendly and efficient virtual assistant for [YOUR_BUSINESS_NAME] in [YOUR_CITY], [YOUR_COUNTRY]. Always:\n✅ Use simple, polite language\n✅ Send responses in plain text (NO markdown *, _, `)\n✅ Use only 1–2 emojis per message for warmth\n✅ Display time in [YOUR_TIMEZONE] (e.g., EST = UTC-5)\n✅ Ensure order records match Google Sheets format\n\n🍔 MENU & PRICES ([YOUR_CURRENCY])\n[CATEGORY_1]\n- [ITEM_1] – [CURRENCY_SYMBOL][PRICE_1]\n- [ITEM_2] – [CURRENCY_SYMBOL][PRICE_2]\n- [ITEM_3] – [CURRENCY_SYMBOL][PRICE_3]\n\n[CATEGORY_2]\n- [ITEM_4] – [CURRENCY_SYMBOL][PRICE_4]\n- [ITEM_5] – [CURRENCY_SYMBOL][PRICE_5]\n\nOthers\n- [ITEM_6] – [CURRENCY_SYMBOL][PRICE_6]\n- [ITEM_7] – [CURRENCY_SYMBOL][PRICE_7]\n- [ITEM_8] – [CURRENCY_SYMBOL][PRICE_8]\n- Delivery Fee – [CURRENCY_SYMBOL][DELIVERY_FEE]\n\n📝 ORDER FLOW\n1️⃣ Greet the customer:\n\"Hi! I'm [ASSISTANT_NAME] from [YOUR_BUSINESS_NAME] 😊 What would you like to order today?\"\n\n2️⃣ Clarify orders:\n- Ask for type when they mention general categories\n- Confirm all combos and add-ons\n\n3️⃣ Confirm order:\nSummarize like this:\nYour order:\n1x [ITEM] – [CURRENCY_SYMBOL][PRICE]\n1x [ITEM] – [CURRENCY_SYMBOL][PRICE]\nDelivery – [CURRENCY_SYMBOL][DELIVERY_FEE]\nTOTAL: [CURRENCY_SYMBOL][TOTAL]\n💳 Pay to: [YOUR_PAYMENT_DETAILS]\nReply \"Paid\" after sending payment\n\n4️⃣ Collect delivery info:\n\"Almost done! Please send:\nFull name\nPhone number (for delivery)\nDelivery address\"\n\n5️⃣ When they send delivery information:\nReply: \"Thank you for providing your details! We're now verifying your order. Please send your payment screenshot for confirmation 😊\"\n\n6️⃣ When they send a payment screenshot:\nReply:\n⌛ Thanks for your payment! Verifying with [YOUR_PAYMENT_PROVIDER]... (2–3 mins) 😊\n(This message happens automatically when payment screenshot is detected)\n\n7️⃣ HUMAN-IN-THE-LOOP DECISION:\nWhen staff approves the payment through the Check Feedback node:\n- The system will automatically send:\n  \"✅ Payment confirmed! Your order will arrive by [deliveryTime] 🚚\"\n  (Delivery time is 1 hour from now, e.g. \"16:45\")\n\n- The system will then automatically log this data to Google Sheets:\n  Format: Order id|Customer Name|Chat ID|Phone Number|Delivery Address|Order info|Total Price|Payment Status|Order Status|Timestamp\n  Example: [PREFIX]-1712345678|John|1085503473|+1234567890|123 Main St|1x Burger|25.00|Confirmed|Preparing|10/07/2024 16:45\n\n8️⃣ If staff rejects the payment:\nReply:\n❌ Sorry, we couldn't verify your payment. Please send a clearer screenshot or try again.\n\n📌 STATUS RESPONSES:\nWhen user types \"Status?\":\n⏳ Still verifying! We'll notify you as soon as it's confirmed 💛\n\nWhen user types \"Agent\":\nConnecting you to @[YOUR_SUPPORT_HANDLE] 💬\n\nWhen user asks for FAQ or information about [YOUR_BUSINESS_NAME]:\n📍 Location: [YOUR_ADDRESS]\n⏰ Hours: [YOUR_HOURS]\n📞 Contact: [YOUR_PHONE]\n📧 Email: [YOUR_EMAIL]\n\n📊 SHEET FORMAT (strict):\nOrder id | Customer Name | Chat ID | Phone Number | Delivery Address | Order info | Total Price | Payment Status | Order Status | Timestamp\nTimestamp format = MM/DD/YYYY HH:MM (24hr [YOUR_TIMEZONE])\n\n## APPROVAL HANDLING\nIf $json.data.text is \"Approved\", then:\n- Calculate the delivery time (1 hour from current time)\n- Send: \"✅ Payment confirmed! Your order will arrive by [deliveryTime] 🚚\"\n- Log the order data to Google Sheets, making sure to include the Chat ID ({{ $json.message.from.id }} or {{ $json.chat.id }})"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "dda87278-b547-4d5f-b52c-d2c3341ac616",
      "name": "简易记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -400,
        -40
      ],
      "parameters": {
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}  ",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "ade1189c-1214-4578-9bb5-3fee28694f77",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1540,
        -60
      ],
      "webhookId": "dd966a62-ffb5-4c52-a830-5cf7e96e946a",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "be4aec62-7321-42b4-8ba9-43c64b08054a",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -280,
        -40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Chat id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Chat_id', ``, 'string') }}",
            "Order id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Order_id', ``, 'string') }}",
            "Timestamp": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Timestamp', ``, 'string') }}",
            "timestamp": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('timestamp', ``, 'string') }}",
            "Total Price": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Total_Price', ``, 'string') }}",
            "  Order info": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('__Order_info', ``, 'string') }}",
            "Order Status": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Order_Status', ``, 'string') }}",
            "phone number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('phone_number', ``, 'string') }}",
            "Customer Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Customer_Name', ``, 'string') }}",
            "Payment Status": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Payment_Status', ``, 'string') }}",
            "Delivery Address": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Delivery_Address', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Order id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Order id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Customer Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Customer Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Chat id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Chat id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Delivery Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Delivery Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "  Order info",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "  Order info",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Total Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Payment Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Payment Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Order Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Order Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "phone number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "[YOUR_GOOGLE_SHEET_ID]",
          "cachedResultName": "Order Details Sheet"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "a05b26a5-4495-4419-8ec4-f9202d44083a",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -780,
        -140
      ],
      "webhookId": "4a058acc-6544-49bc-9981-c484756f0d42",
      "parameters": {
        "text": "={{ $json.output }} ",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "deec8df2-d232-43a6-965f-f0373c029480",
      "name": "检查反馈",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        -540,
        140
      ],
      "parameters": {
        "options": {},
        "inputText": "={{ $json.data.text }}",
        "categories": {
          "categories": [
            {
              "category": "approved",
              "description": "admin approves the order"
            },
            {
              "category": "declined",
              "description": "admin declined the order"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b7a2a270-4308-46ed-8019-3590b6230a87",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -1640
      ],
      "parameters": {
        "color": 6,
        "width": 700,
        "height": 80,
        "content": "# 外卖聊天机器人模板 | 支持自定义"
      },
      "typeVersion": 1
    },
    {
      "id": "26fb592b-08b8-4b8f-9a91-6f65da7b7950",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -560,
        -20
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "typeVersion": 1
    },
    {
      "id": "db0cf32d-297f-44d9-96bd-159ae6bbe030",
      "name": "管理员审批请求",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -780,
        140
      ],
      "webhookId": "d0ca05e5-391f-4f67-b00f-40e72a5de2aa",
      "parameters": {
        "message": "Payment received for order. Approve or decline?",
        "options": {
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "typeVersion": 1.2
    },
    {
      "id": "d0647205-8b66-4228-a7ab-779bb3e3a45b",
      "name": "转发支付截图",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1060,
        140
      ],
      "webhookId": "e8df6e57-dfef-424b-ac17-d32b8ecddfc8",
      "parameters": {
        "file": "={{ $json.message.photo[0].file_id }}",
        "operation": "sendPhoto",
        "additionalFields": {
          "caption": "={{ $('Telegram Trigger').item.json.message.caption }}"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1cd62845-ad31-423c-8eb3-a154f1595571",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        -120
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 220,
        "content": "## AI 工具与记忆"
      },
      "typeVersion": 1
    },
    {
      "id": "d0e6e088-235b-4cfe-b78d-65e75079b6db",
      "name": "支付截图检查",
      "type": "n8n-nodes-base.if",
      "position": [
        -1300,
        -60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "02d9bd52-4f62-4f32-b0c3-a4723f913b46",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.photo[0] }} {{ $json.message.caption }}",
              "rightValue": ""
            },
            {
              "id": "d50f068a-c563-4a95-a6e6-2e3514028e28",
              "operator": {
                "type": "string",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "6934b6bb-5ac4-48ee-9188-3284a9ee6c0a",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1160,
        100
      ],
      "parameters": {
        "width": 1300,
        "height": 180,
        "content": "## 支付验证流程"
      },
      "typeVersion": 1
    },
    {
      "id": "b5bd59de-66bc-4e62-8d1d-a04f94403b4c",
      "name": "支付被拒绝",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -160,
        140
      ],
      "webhookId": "74f30de0-1908-4640-b6c5-13325e770462",
      "parameters": {
        "text": "❌ Sorry, we couldn't verify your payment. Please send a clearer screenshot or try again.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9978f9af-8fda-43c9-bebe-8db51596f689",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1160,
        -180
      ],
      "parameters": {
        "color": 3,
        "width": 580,
        "height": 280,
        "content": "## AI 助手核心"
      },
      "typeVersion": 1
    },
    {
      "id": "f92bcb7a-b5f0-43d0-a647-a2c162a10412",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2480,
        -360
      ],
      "parameters": {
        "width": 760,
        "height": 1200,
        "content": "## 🚀 快速设置指南"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "75215d5e-63a8-4bb5-b26e-5fa6a6d6f4f1",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Check Feedback": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Payment Declined",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Payment Screenshot Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Admin Approval Request": {
      "main": [
        [
          {
            "node": "Check Feedback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Check Feedback",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Payment Screenshot Check": {
      "main": [
        [
          {
            "node": "Forward Payment Screenshot",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Forward Payment Screenshot": {
      "main": [
        [
          {
            "node": "Admin Approval Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能

需要付费吗?

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

工作流信息
难度等级
高级
节点数量16
分类1
节点类型9
难度说明

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

作者
David Olusola

David Olusola

@dae221

AI automation consultant working with ambitious businesses on their most complex operational challenges. For project inquiries, reach me at david@daexai.com

外部链接
在 n8n.io 查看

分享此工作流