TG-Bot-Module-Quiz-v4-db-sell-full
高级
这是一个Sales、Building Blocks、Marketing领域的自动化工作流,包含 36 个节点。主要使用 If、Set、Code、Sort、Wait 等节点。 通过Telegram在Postgres中自动化测试和收集响应("测验"模块)
前置要求
- •PostgreSQL 数据库连接信息
- •Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "Tetxh8UaZ85ELSAL",
"meta": {
"instanceId": "888b5b52ac2aa3f8f1bab6800cae8fce6f3d7947e840e64245b5198449908655",
"templateCredsSetupCompleted": true
},
"name": "TG-Bot-Module-Quiz-v4-db-sell-full",
"tags": [
{
"id": "EwFGeL3ePPNgm0R7",
"name": "telegram",
"createdAt": "2025-02-10T18:10:47.435Z",
"updatedAt": "2025-02-10T18:10:47.435Z"
},
{
"id": "XPad0ERjSdqfxG52",
"name": "module",
"createdAt": "2025-03-31T08:11:00.151Z",
"updatedAt": "2025-03-31T08:11:00.151Z"
},
{
"id": "2ocrWSzdKoCOU2AC",
"name": "sell",
"createdAt": "2025-04-19T15:39:51.859Z",
"updatedAt": "2025-04-19T15:39:51.859Z"
}
],
"nodes": [
{
"id": "c6772c56-7373-46f6-b550-106b0912f725",
"name": "用于测试",
"type": "n8n-nodes-base.switch",
"position": [
1560,
-380
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "8bc83292-4eb2-4580-aedb-14ff3f66c40a",
"name": "测试",
"type": "n8n-nodes-base.telegram",
"position": [
2040,
-580
],
"webhookId": "fa9dab38-1032-401d-a22b-81ad71c93b22",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "57fe6fd6-476c-4516-b230-c8e01d0c9ffb",
"name": "随机化问题",
"type": "n8n-nodes-base.sort",
"position": [
2260,
-580
],
"parameters": {},
"executeOnce": false,
"typeVersion": 1
},
{
"id": "8c36a7a3-c912-4d3f-87a6-6b700795c8ef",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
3140,
-580
],
"webhookId": "5c6a2358-d77f-470d-b4e2-201ad524f965",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "69461198-edcf-451c-9847-1f359d109c7a",
"name": "变量",
"type": "n8n-nodes-base.set",
"position": [
2480,
-780
],
"parameters": {},
"executeOnce": true,
"typeVersion": 3.4
},
{
"id": "0c9b0b8d-70af-4716-b675-9bb3dd426466",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
2700,
-580
],
"parameters": {},
"typeVersion": 3
},
{
"id": "7d5994d0-fb8b-45f3-ae5a-515075b5228d",
"name": "问题",
"type": "n8n-nodes-base.telegram",
"position": [
2920,
-580
],
"webhookId": "1ecc015e-a82d-4f0c-a925-842976a3f4b1",
"parameters": {},
"executeOnce": true,
"retryOnFail": false,
"typeVersion": 1.2
},
{
"id": "f277d6f3-8fa0-4704-b82e-e9508cfe92b0",
"name": "命令",
"type": "n8n-nodes-base.switch",
"position": [
1180,
20
],
"parameters": {},
"retryOnFail": false,
"typeVersion": 3.2
},
{
"id": "465e22be-5d23-4889-8a5e-aca17c4b9a11",
"name": "按钮",
"type": "n8n-nodes-base.switch",
"position": [
1180,
-380
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "f972e09f-4a96-45e8-977f-62ac6e479613",
"name": "切换",
"type": "n8n-nodes-base.switch",
"position": [
900,
-180
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "00300fed-0dfc-469f-a58e-6428f7f97141",
"name": "列出测试",
"type": "n8n-nodes-base.telegram",
"position": [
2480,
-40
],
"webhookId": "c2c62c30-a0e7-4652-8900-a0649ee01922",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "091321f2-80e4-4fe0-8118-b7b0464989d9",
"name": "主菜单",
"type": "n8n-nodes-base.telegram",
"position": [
1560,
-780
],
"webhookId": "58039678-a25b-4fef-b163-0d578950a916",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "4b372e39-86dc-494d-9479-1416564e450a",
"name": "启动时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
1820,
-780
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "b760dbfd-6415-4099-baa0-2d65c6107882",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
0,
-180
],
"webhookId": "1bced82d-35e8-45ad-a06c-175b68ec6797",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "d517ac45-bfc1-4499-92b0-ebd884ccaf95",
"name": "初始化",
"type": "n8n-nodes-base.set",
"position": [
460,
-180
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "faa1c338-6312-4bfe-a94e-f19dc021bf79",
"name": "有任何问题吗?",
"type": "n8n-nodes-base.if",
"position": [
2260,
-380
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "881939f8-27e9-4b76-8bf0-bb827b058aa6",
"name": "删除消息",
"type": "n8n-nodes-base.telegram",
"position": [
3360,
-580
],
"webhookId": "7137be3f-013b-4aab-b83e-283890cf5846",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "d1142c38-0438-4b00-ae0f-edfc9d40b339",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
2480,
-580
],
"parameters": {},
"executeOnce": true,
"typeVersion": 2
},
{
"id": "b7ef9d15-b4ba-437a-b1ce-c6c91620366b",
"name": "获取问题和答案",
"type": "n8n-nodes-base.postgres",
"position": [
2040,
-780
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "b76407ba-058d-47a2-9e34-4e934baf9a24",
"name": "更新答案",
"type": "n8n-nodes-base.postgres",
"position": [
1820,
-380
],
"parameters": {},
"executeOnce": true,
"typeVersion": 2.5
},
{
"id": "de961e0f-cfc8-4d3d-a22c-bd60bbaeea93",
"name": "获取未回答问题",
"type": "n8n-nodes-base.postgres",
"position": [
2040,
-380
],
"parameters": {},
"typeVersion": 2.5,
"alwaysOutputData": true
},
{
"id": "4b242a0a-96b3-4e68-901f-5a51203a1aab",
"name": "获取测试",
"type": "n8n-nodes-base.postgres",
"position": [
1820,
-40
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "d4578eb5-351e-42da-b8aa-dd7b31cd273a",
"name": "将数字与问题合并",
"type": "n8n-nodes-base.set",
"position": [
2040,
-40
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "c41aad19-b64d-4b65-9897-9db4dbe4d173",
"name": "合并列表",
"type": "n8n-nodes-base.summarize",
"position": [
2260,
-40
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "34ce463e-0a46-4c18-ad0c-93eb27451d1a",
"name": "获取测试",
"type": "n8n-nodes-base.postgres",
"position": [
1820,
-580
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "c352c16b-c407-4a66-9157-26b8b7ccf2e2",
"name": "测试结果",
"type": "n8n-nodes-base.telegram",
"position": [
2700,
-380
],
"webhookId": "b0dd03ee-8a93-4a0f-9c87-4f881ebe2195",
"parameters": {},
"executeOnce": true,
"retryOnFail": false,
"typeVersion": 1.2
},
{
"id": "3cd53065-2bb5-42e6-8052-e0d8145a6d33",
"name": "计算答案",
"type": "n8n-nodes-base.postgres",
"position": [
2480,
-380
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "fd55a57b-e510-4f5e-9739-a83a7eca457b",
"name": "更新或插入预测答案",
"type": "n8n-nodes-base.postgres",
"position": [
2920,
-780
],
"parameters": {},
"executeOnce": true,
"typeVersion": 2.5
},
{
"id": "0fcc8a1d-f643-4999-9508-6992149d913b",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-20,
160
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "abdcb075-fe51-4ae0-b7c5-14c42b8db097",
"name": "变量 TG",
"type": "n8n-nodes-base.set",
"position": [
220,
-180
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "d8ed0d39-d250-436f-b5fb-ef727d4e4fb0",
"name": "是开始吗?",
"type": "n8n-nodes-base.if",
"position": [
680,
-180
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "b9db0964-0e46-4335-859e-5a9d11b2132c",
"name": "欢迎消息",
"type": "n8n-nodes-base.telegram",
"position": [
680,
-380
],
"webhookId": "75295e22-ccce-48b3-b0a8-80690f0a8449",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "f3319cfd-6d30-4efd-b322-1c8eb46302a3",
"name": "错误",
"type": "n8n-nodes-base.telegram",
"position": [
1560,
160
],
"webhookId": "8b2f9495-7524-4579-953e-71f9d0e3ea04",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "5cf3c126-a6a9-4d25-98d2-191af91b12d9",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-440,
-420
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "40325b66-5ac3-4275-b00b-d097834dfe15",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-440,
-180
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "f31c4ec7-3651-4c02-8c3c-8dd2f135a291",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-440,
160
],
"parameters": {
"content": ""
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "f377e631-c16e-4bc3-a4f5-4c66d314fe5d",
"connections": {
"Code": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Test": {
"main": [
[
{
"node": "Get Questions AND Answers",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Delete message",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Upsert pred Answer",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Buttons",
"type": "main",
"index": 0
}
],
[
{
"node": "Commands",
"type": "main",
"index": 0
}
]
]
},
"Buttons": {
"main": [
[
{
"node": "Main Menu",
"type": "main",
"index": 0
}
],
[
{
"node": "For Tests",
"type": "main",
"index": 0
}
]
]
},
"Commands": {
"main": [
[
{
"node": "Get Tests",
"type": "main",
"index": 0
}
],
[
{
"node": "Error",
"type": "main",
"index": 0
}
],
[
{
"node": "Error",
"type": "main",
"index": 0
}
]
]
},
"Get Test": {
"main": [
[
{
"node": "Test",
"type": "main",
"index": 0
}
]
]
},
"Question": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"For Tests": {
"main": [
[
{
"node": "Get Tests",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Test",
"type": "main",
"index": 0
}
],
[
{
"node": "Update Answer",
"type": "main",
"index": 0
}
]
]
},
"Get Tests": {
"main": [
[
{
"node": "Union Number with Question",
"type": "main",
"index": 0
}
]
]
},
"Is Start?": {
"main": [
[
{
"node": "Welcome Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Main Menu": {
"main": [
[
{
"node": "Update Bot Status on start",
"type": "main",
"index": 0
}
]
]
},
"Variables": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Union list": {
"main": [
[
{
"node": "List tests",
"type": "main",
"index": 0
}
]
]
},
"Variables TG": {
"main": [
[
{
"node": "Initialization",
"type": "main",
"index": 0
}
]
]
},
"Update Answer": {
"main": [
[
{
"node": "Get Non-Answered Questions",
"type": "main",
"index": 0
}
]
]
},
"Any questions?": {
"main": [
[
{
"node": "Randomize questions",
"type": "main",
"index": 0
}
],
[
{
"node": "Calculate answers",
"type": "main",
"index": 0
}
]
]
},
"Initialization": {
"main": [
[
{
"node": "Is Start?",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Variables TG",
"type": "main",
"index": 0
}
]
]
},
"Calculate answers": {
"main": [
[
{
"node": "Result Test",
"type": "main",
"index": 0
}
]
]
},
"Upsert pred Answer": {
"main": [
[
{
"node": "Question",
"type": "main",
"index": 0
}
]
]
},
"Randomize questions": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
},
{
"node": "Variables",
"type": "main",
"index": 0
}
]
]
},
"Get Questions AND Answers": {
"main": [
[
{
"node": "Randomize questions",
"type": "main",
"index": 0
}
]
]
},
"Get Non-Answered Questions": {
"main": [
[
{
"node": "Any questions?",
"type": "main",
"index": 0
}
]
]
},
"Union Number with Question": {
"main": [
[
{
"node": "Union list",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个高级难度的工作流,适用于Sales、Building Blocks、Marketing等场景。适合高级用户,包含 16+ 个节点的复杂工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
TG-机器人模块-跨平台发布-v1-数据库-销售完整版
使用Postgres自动化Telegram频道帖子("跨平台发布"模块)
If
Set
Switch
+5
47 节点Andrew
Sales
TG机器人-复选框模块-v2-数据库-销售完整版
Telegram机器人,用于多选项目并保存到PostgreSQL("复选框"模块)
If
Set
Code
+6
46 节点Andrew
Sales
TG机器人-抽奖模块-v4-数据库-销售完整版
Telegram频道订阅者抽奖活动("抽奖"模块)
If
Set
Sort
+6
44 节点Andrew
Building Blocks
TG-Bot-模块-检查_订阅-v4-数据库-销售-完整版
使用 Postgres 验证 Telegram 频道订阅并进行访问控制
If
Set
Switch
+7
45 节点Andrew
Building Blocks
WA-机器人模块-测验-v1-数据库销售完整版
使用PostgreSQL自动化WhatsApp测验和结果排名("测验"模块)
If
Set
Sort
+6
39 节点Andrew
Sales
WA-机器人模块-预约-v1-数据库-销售-完整版
通过Telegram和PostgreSQL的自动化客户预约("预约"模块)
If
Set
Merge
+6
49 节点Andrew
Sales