从 Google Sheets 到 Telegram 的自动化测验交付与状态跟踪
中级
这是一个Social Media, Multimodal AI领域的自动化工作流,包含 13 个节点。主要使用 If, Set, Code, Telegram, HttpRequest 等节点。 从 Google Sheets 到 Telegram 的自动化测验交付与状态跟踪
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "c5e931c455fcffaf668d434579b8144a682ba36c13be12948f5ddd388753d54c"
},
"nodes": [
{
"id": "56689bfc-a856-463e-bf85-53dde3ddd928",
"name": "读取测验数据",
"type": "n8n-nodes-base.googleSheets",
"notes": "Read all quiz rows from Google Sheets",
"position": [
-768,
240
],
"parameters": {
"options": {},
"sheetName": "Sheet1",
"documentId": "<<<YOUR_SHEET_ID>>>"
},
"typeVersion": 4
},
{
"id": "dec9e4a5-2815-4a95-a148-94d22f00cfea",
"name": "过滤待处理测验",
"type": "n8n-nodes-base.code",
"notes": "Keep only the earliest pending quiz (🟨). If none, pass a marker item.",
"position": [
-448,
240
],
"parameters": {
"jsCode": "// Filter for pending quizzes (🟨) and pick the lowest quiz_number\nconst items = $input.all();\nconst pending = items.filter(i => i.json.status && i.json.status === '🟨');\nif (pending.length) {\n pending.sort((a,b) => parseInt(a.json.quiz_number) - parseInt(b.json.quiz_number));\n return [pending[0]];\n}\nreturn [{ json: { message: 'not exist' } }];\n"
},
"typeVersion": 2
},
{
"id": "807289e3-a0e7-4750-b3f2-9d39fe20fee3",
"name": "检查测验是否存在",
"type": "n8n-nodes-base.if",
"notes": "If status exists (i.e., a real quiz row), send the poll; else send a refill notice.",
"position": [
-192,
240
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "dfdcc097-994d-4e6d-ac8b-9ef226a37ee1",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.status }}"
}
]
}
},
"typeVersion": 2
},
{
"id": "3eadd4a7-7658-4f4e-89dc-3722d2e37c5d",
"name": "发送 Telegram 投票",
"type": "n8n-nodes-base.httpRequest",
"notes": "Calls Telegram sendPoll. Set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID as env vars.",
"position": [
112,
112
],
"parameters": {
"url": "https://api.telegram.org/bot{{ $env.TELEGRAM_BOT_TOKEN }}/sendPoll",
"method": "POST",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $env.TELEGRAM_CHAT_ID }}"
},
{
"name": "question",
"value": "={{ $json.question }}"
},
{
"name": "options",
"value": "=[\"{{ $json.option_a }}\", \"{{ $json.option_b }}\", \"{{ $json.option_c }}\", \"{{ $json.option_d }}\"]"
}
]
}
},
"typeVersion": 4.1
},
{
"id": "c48ba649-d2ea-41ff-8574-4d02039f21f7",
"name": "准备状态更新",
"type": "n8n-nodes-base.set",
"notes": "Set the new status and include the quiz_number for matching.",
"position": [
352,
0
],
"parameters": {
"fields": {
"values": [
{
"name": "status",
"stringValue": "✅"
},
{
"name": "quiz_number",
"stringValue": "={{ $('Read Quiz Data').item.json.quiz_number }}"
}
]
},
"include": "selected",
"options": {}
},
"typeVersion": 3.2
},
{
"id": "ce67a494-ff14-4b9c-9f9f-8b047d58c8ee",
"name": "通知缺失测验 (Telegram)",
"type": "n8n-nodes-base.telegram",
"notes": "Sends a message if no pending quiz exists. Provide TELEGRAM_NOTIFY_CHAT_ID.",
"position": [
352,
320
],
"webhookId": "1b8bcd70-16eb-4e81-a0dd-aee8f847bd9e",
"parameters": {
"text": "⚠️ No pending quiz found in Google Sheet. Please refill.",
"chatId": "={{ $env.TELEGRAM_NOTIFY_CHAT_ID }}",
"additionalFields": {
"appendAttribution": false
}
},
"typeVersion": 1.1
},
{
"id": "f949b91d-aa8b-4453-bc49-5cb21befc1b3",
"name": "更新测验状态1",
"type": "n8n-nodes-base.googleSheets",
"notes": "Update the row that matches quiz_number, setting status to ✅.",
"position": [
560,
64
],
"parameters": {
"columns": {
"mappingMode": "autoMapInputData",
"matchingColumns": [
"quiz_number"
]
},
"options": {},
"operation": "update",
"sheetName": "Sheet1",
"documentId": "<<<YOUR_SHEET_ID>>>"
},
"typeVersion": 4
},
{
"id": "7175b83d-7483-484e-8ddd-6e6d63b409f5",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-912,
48
],
"parameters": {
"color": 7,
"width": 368,
"height": 432,
"content": "## 注意"
},
"typeVersion": 1
},
{
"id": "19b16b1c-1bdd-495d-acfa-fbb25fcd025f",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-528,
48
],
"parameters": {
"color": 2,
"width": 288,
"height": 432,
"content": "过滤标记为 🟨 的行并按编号选择最早的测验。"
},
"typeVersion": 1
},
{
"id": "6efd2557-da1d-4b98-a15e-111fb61a6561",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
48
],
"parameters": {
"color": 4,
"width": 288,
"height": 432,
"content": "根据是否找到待处理测验进行分支。"
},
"typeVersion": 1
},
{
"id": "26069e47-cfb6-4947-878e-2f6a0a927ec0",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-16
],
"parameters": {
"color": 5,
"width": 192,
"height": 496,
"content": "通过 Telegram Bot API 将测验作为投票发送到群组。"
},
"typeVersion": 1
},
{
"id": "8b424c6d-6733-467f-93f5-f6380381dce8",
"name": "便签说明4",
"type": "n8n-nodes-base.stickyNote",
"position": [
528,
-16
],
"parameters": {
"color": 7,
"width": 192,
"height": 496,
"content": "将测验行标记为 ✅ 以防止重新发送。"
},
"typeVersion": 1
},
{
"id": "c1057db4-4926-41b7-a0e0-d36aaf3cbc61",
"name": "便签说明5",
"type": "n8n-nodes-base.stickyNote",
"position": [
304,
176
],
"parameters": {
"color": 5,
"width": 192,
"height": 304,
"content": "如果没有可用的待处理测验,则提醒管理员。"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Read Quiz Data": {
"main": [
[
{
"node": "Filter Pending Quiz",
"type": "main",
"index": 0
}
]
]
},
"Check Quiz Exists": {
"main": [
[
{
"node": "Send Telegram Poll",
"type": "main",
"index": 0
}
],
[
{
"node": "Notify Missing Quiz (Telegram)",
"type": "main",
"index": 0
}
]
]
},
"Send Telegram Poll": {
"main": [
[
{
"node": "Prepare Status Update",
"type": "main",
"index": 0
}
]
]
},
"Filter Pending Quiz": {
"main": [
[
{
"node": "Check Quiz Exists",
"type": "main",
"index": 0
}
]
]
},
"Prepare Status Update": {
"main": [
[
{
"node": "Update Quiz Status1",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 社交媒体, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
X 推文和 Meta Threads 发布器
使用 Late API 和 Google Sheets 自动发布平台优化内容到 X 和 Threads
If
Set
Code
+6
20 节点Fariez
社交媒体
Telegram自动复制器
基于GPT-4o-mini的Telegram频道内容自动复制与翻译
If
Set
Code
+6
19 节点Shohani
社交媒体
通过WhatsApp、邮件和Twilio SMS发送的食品菜单更新通知器
食品菜单更新通知器
If
Set
Code
+7
22 节点Oneclick AI Squad
社交媒体
✨🩷自动化社交媒体内容发布工厂 + 系统提示组合
使用GPT-4o为6个平台生成平台优化的社交媒体内容
If
Set
Code
+20
100 节点Luan Correia
社交媒体
LinkedIn内容工厂(含OpenAI研究与品牌图像生成)
LinkedIn内容工厂,集成OpenAI研究与Replicate品牌图像生成
If
Set
Code
+10
23 节点Onur
社交媒体
自动化推荐工作流
使用GPT-4处理推荐信,并通过Google表格自动生成社交媒体卡片
If
Set
Code
+9
34 节点Jitesh Dugar
社交媒体