TG-机器人模块-跨平台发布-v1-数据库-销售完整版
高级
这是一个Sales、Building Blocks、Marketing领域的自动化工作流,包含 47 个节点。主要使用 If、Set、Switch、Postgres、Telegram 等节点。 使用Postgres自动化Telegram频道帖子("跨平台发布"模块)
前置要求
- •PostgreSQL 数据库连接信息
- •Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "3m4RmGRaROTWw0HS",
"meta": {
"instanceId": "888b5b52ac2aa3f8f1bab6800cae8fce6f3d7947e840e64245b5198449908655",
"templateCredsSetupCompleted": true
},
"name": "TG-机器人模块-跨平台发布-v1-数据库-销售完整版",
"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": "a7bca41e-ffae-4fbb-99ed-1326834ddd5d",
"name": "变量 TG",
"type": "n8n-nodes-base.set",
"position": [
80,
-140
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "61767f36-0f76-4a96-ab15-56aa3bc37881",
"name": "初始化",
"type": "n8n-nodes-base.set",
"position": [
320,
-140
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "0b89e490-8518-471b-aa8c-f097a28ff83d",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-140,
-140
],
"webhookId": "562c7311-5b7c-4a45-b743-04a46d760873",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "0bc07dff-a624-4c29-8327-0b7bff57c150",
"name": "选择频道",
"type": "n8n-nodes-base.postgres",
"position": [
1480,
-140
],
"parameters": {},
"typeVersion": 2.6
},
{
"id": "1c902af0-1f96-46c0-94db-ece5b937955d",
"name": "是管理员吗?",
"type": "n8n-nodes-base.if",
"position": [
540,
-140
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "de2d68d1-1c60-4ac6-916d-38a9ea334320",
"name": "添加频道",
"type": "n8n-nodes-base.postgres",
"onError": "continueErrorOutput",
"position": [
1480,
-740
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "cdae9e24-c42f-4f2d-ae30-2c7940031490",
"name": "获取机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
760,
-340
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "2cd05fd6-b798-4017-8e36-88fd83143f50",
"name": "定义流程",
"type": "n8n-nodes-base.switch",
"position": [
980,
-460
],
"parameters": {},
"typeVersion": 3.2,
"alwaysOutputData": false
},
{
"id": "f335a4e1-aa19-4122-abcb-fa2a660c7cdf",
"name": "命令",
"type": "n8n-nodes-base.switch",
"position": [
1260,
-1220
],
"parameters": {},
"retryOnFail": false,
"typeVersion": 3.2
},
{
"id": "6682aef5-5b37-4b48-babf-556e582d7101",
"name": "频道存在",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-740
],
"webhookId": "2fa81265-abbd-46bb-8f15-51cd9605376f",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "7a36302d-4a37-49e2-82d6-7e2bcb6f38d2",
"name": "请求添加频道",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-1540
],
"webhookId": "57fa4033-f28c-4224-86a3-75df85cf87e5",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "c72ed6b3-8d6b-4b48-a97a-7dad06d18682",
"name": "请求删除频道",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-1340
],
"webhookId": "ac025c14-b675-42c2-b9c1-12f924066114",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "2757870e-e7fe-4c7c-9fe6-97cc56155ec4",
"name": "请求新删除频道",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-540
],
"webhookId": "d7cde909-a6a9-4c36-95cb-39fe1f33a76e",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "e93c1544-670d-4334-a32f-cde3fb323b33",
"name": "请求新添加频道",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-940
],
"webhookId": "1f6f57f4-bfca-47f9-9877-627b6a7e3738",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "6ee36bc2-8cf2-41ee-a7f6-5e1b49c7ea4f",
"name": "频道不存在",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-340
],
"webhookId": "925adc00-3c0a-4f02-bdd3-28546097d3c5",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "83fcaa57-ed1b-4aa7-99e3-f81d7226e4d3",
"name": "删除频道",
"type": "n8n-nodes-base.postgres",
"onError": "continueRegularOutput",
"position": [
1480,
-540
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "e8f24107-14db-4b04-8c4e-84e3cc78ab7e",
"name": "获取频道列表",
"type": "n8n-nodes-base.postgres",
"position": [
1480,
-1140
],
"parameters": {},
"typeVersion": 2.5,
"alwaysOutputData": true
},
{
"id": "ef44ee6a-b8e3-4919-a8ec-048744444b45",
"name": "添加分隔频道",
"type": "n8n-nodes-base.summarize",
"position": [
1700,
-1140
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "427f077c-fe69-4b33-867b-657dd60fea18",
"name": "频道",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-1140
],
"webhookId": "c95be6d1-ed84-48c2-8f69-48c1ac652710",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "d660dfa0-a708-45ba-ad02-a3984015a2c6",
"name": "定义类型",
"type": "n8n-nodes-base.switch",
"position": [
540,
-380
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "3a9175c0-ed95-44ff-bd31-ff8413d88d3b",
"name": "获取频道列表",
"type": "n8n-nodes-base.postgres",
"position": [
1260,
-340
],
"parameters": {},
"typeVersion": 2.5,
"alwaysOutputData": true
},
{
"id": "13e83abd-4baf-4ab7-b07b-85120bda8939",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
1480,
-340
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "b89da002-4ddc-4518-8211-ebf0ad69f197",
"name": "启动时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
2140,
-1740
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "d216d87f-6669-4d79-bee1-9798b1e89eb2",
"name": "按钮",
"type": "n8n-nodes-base.switch",
"position": [
980,
-1940
],
"parameters": {},
"typeVersion": 3.2,
"alwaysOutputData": false
},
{
"id": "fea2d8b6-4d06-4c06-96e1-cf9649bad22e",
"name": "添加频道时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
2140,
-1540
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "a27124ca-3270-4fb3-87a6-6a9cacd5a0a0",
"name": "删除频道时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
2140,
-1340
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "13d55ebf-5a73-4a02-9ec2-94fb223b2a46",
"name": "成功发送帖子",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-140
],
"webhookId": "2b427835-021b-4641-9967-541579d14013",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "1ed13ae9-6aff-4b5a-8350-115ba6f7d067",
"name": "启动时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
1260,
-140
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "e5f6c9fa-a040-4f5f-afaf-f6a961d45179",
"name": "欢迎消息",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-1740
],
"webhookId": "984e7085-9223-46ca-b1c3-336bc3f576fd",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "2fcc98fc-a040-4687-ba65-3ce4a633b287",
"name": "帖子文本请求时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
2140,
-1940
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "76242590-48c7-4c30-b022-5c116ae10d9c",
"name": "请求帖子文本",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-1940
],
"webhookId": "113a42b1-9b96-4756-99fd-7fe90e73859b",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "5fc877af-d50e-4125-a880-deaa77b5dc34",
"name": "请求帖子图片文本",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-2140
],
"webhookId": "d47f6817-462c-474b-80ac-77c24fda0057",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "7ffa1597-50a0-4cb6-bedf-f364fb3c6ac9",
"name": "帖子图片请求文本时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
2140,
-2140
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "4515b82a-e42f-4c36-a808-831702862d0e",
"name": "帖子图片请求图片时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
1260,
60
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "cd08a0b8-1af2-4a16-8859-33408fa41f0d",
"name": "选择频道",
"type": "n8n-nodes-base.postgres",
"position": [
1480,
260
],
"parameters": {},
"typeVersion": 2.6
},
{
"id": "0b778c0a-0966-4bef-8300-0b50fb608131",
"name": "请求帖子图片",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
60
],
"webhookId": "1be72d6c-af3d-4426-b665-607bc48321e9",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "d3edced1-3957-49ab-a844-e1b5d267a3fb",
"name": "成功发送图片帖子",
"type": "n8n-nodes-base.telegram",
"position": [
2140,
260
],
"webhookId": "1add9ac7-b8c8-41a9-86d1-488cd656087e",
"parameters": {},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "ce28cb11-8ffe-490d-9ec0-0a22c4556172",
"name": "启动时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
1260,
260
],
"parameters": {},
"typeVersion": 2.5
},
{
"id": "ff3156da-186e-4799-91fc-19707648112a",
"name": "条件判断1",
"type": "n8n-nodes-base.if",
"position": [
1700,
260
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "4b4d39fb-ff75-47cf-ac6d-f4e655568bf7",
"name": "发送帖子 (4922)",
"type": "n8n-nodes-base.telegram",
"position": [
1700,
-140
],
"webhookId": "4a35dabe-a97c-4338-b023-bc5afa2001ee",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "91146a01-ffe7-4df1-8929-5158623c91f0",
"name": "发送图片帖子 (4922)",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
260
],
"webhookId": "993e2cf3-0b82-4015-9841-8795636f2b86",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "6f13b321-742c-467e-957f-d3e69cd43c2c",
"name": "发送图片帖子 (4922)",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
460
],
"webhookId": "4d0c8d50-036e-497c-b009-22c5c840754f",
"parameters": {},
"typeVersion": 1.2
},
{
"id": "14b56b60-90ab-4acc-8641-b3ef0a7a1014",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-180,
200
],
"parameters": {
"content": "## 重要说明"
},
"typeVersion": 1
},
{
"id": "6a100ae0-0f27-4620-9df7-3b7d122b8020",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-420
],
"parameters": {
"content": "## 重要说明"
},
"typeVersion": 1
},
{
"id": "36cae884-0392-4ab9-96e2-9b00fdd3c7a5",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-140
],
"parameters": {
"content": "## 重要说明"
},
"typeVersion": 1
},
{
"id": "2b56999f-cacc-49d0-9f1a-6c5f8bb22cc3",
"name": "### 需要帮助?",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
200
],
"parameters": {
"content": "## 重要说明"
},
"typeVersion": 1
},
{
"id": "c8df3d2c-cb65-46e3-b905-8405684ddafd",
"name": "启动时更新机器人状态",
"type": "n8n-nodes-base.postgres",
"position": [
1920,
-2320
],
"parameters": {},
"typeVersion": 2.5
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "744c1004-cb2f-4097-80be-76a6768db0f6",
"connections": {
"If": {
"main": [
[
{
"node": "Delete Channel",
"type": "main",
"index": 0
}
],
[
{
"node": "Channel Not Exists",
"type": "main",
"index": 0
}
]
]
},
"If1": {
"main": [
[
{
"node": "Send Posts Image (4922)",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Posts Image (4922) ",
"type": "main",
"index": 0
}
]
]
},
"Buttons": {
"main": [
[
{
"node": "Upsert bot status on START ",
"type": "main",
"index": 0
}
],
[
{
"node": "Request Post Image Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Request Post Text",
"type": "main",
"index": 0
}
]
]
},
"Commands": {
"main": [
[],
[
{
"node": "Welcome Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Request Add Channel",
"type": "main",
"index": 0
}
],
[
{
"node": "Request Delete Channel",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Channels ",
"type": "main",
"index": 0
}
]
]
},
"Is Admin?": {
"main": [
[
{
"node": "Define Type",
"type": "main",
"index": 0
}
]
]
},
"Add Channel": {
"main": [
[
{
"node": "Request New Add Channel",
"type": "main",
"index": 0
}
],
[
{
"node": "Channel Exists",
"type": "main",
"index": 0
}
]
]
},
"Define Type": {
"main": [
[
{
"node": "Get Bot Status",
"type": "main",
"index": 0
}
],
[
{
"node": "Buttons",
"type": "main",
"index": 0
}
],
[],
[
{
"node": "Get Bot Status",
"type": "main",
"index": 0
}
]
]
},
"Define flow": {
"main": [
[
{
"node": "Commands",
"type": "main",
"index": 0
}
],
[
{
"node": "Add Channel",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Channels ",
"type": "main",
"index": 0
}
],
[
{
"node": "Update bot status on START ",
"type": "main",
"index": 0
}
],
[
{
"node": "Update bot status on POST IMAGE REQUEST IMAGE",
"type": "main",
"index": 0
}
],
[
{
"node": "Update bot status on START ",
"type": "main",
"index": 0
}
]
]
},
"Variables TG": {
"main": [
[
{
"node": "Initialization",
"type": "main",
"index": 0
}
]
]
},
"Get Channels ": {
"main": [
[
{
"node": "Add Divide Channels",
"type": "main",
"index": 0
}
]
]
},
"Delete Channel": {
"main": [
[
{
"node": "Request New Delete Channel",
"type": "main",
"index": 0
}
]
]
},
"Get Bot Status": {
"main": [
[
{
"node": "Define flow",
"type": "main",
"index": 0
}
]
]
},
"Get Channels ": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Initialization": {
"main": [
[
{
"node": "Is Admin?",
"type": "main",
"index": 0
}
]
]
},
"Select Channels": {
"main": [
[
{
"node": "Send Posts (4922)",
"type": "main",
"index": 0
}
]
]
},
"Welcome Message": {
"main": [
[
{
"node": "Upsert bot status on START",
"type": "main",
"index": 0
}
]
]
},
"Select Channels ": {
"main": [
[
{
"node": "If1",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Variables TG",
"type": "main",
"index": 0
}
]
]
},
"Request Post Text": {
"main": [
[
{
"node": "Update bot status on POST TEXT REQUEST",
"type": "main",
"index": 0
}
]
]
},
"Send Posts (4922)": {
"main": [
[
{
"node": "Success Send Post",
"type": "main",
"index": 0
}
]
]
},
"Add Divide Channels": {
"main": [
[
{
"node": "Channels",
"type": "main",
"index": 0
}
]
]
},
"Request Add Channel": {
"main": [
[
{
"node": "Update bot status on ADD CHANNEL",
"type": "main",
"index": 0
}
]
]
},
"Request Delete Channel": {
"main": [
[
{
"node": "Update bot status on DELETE CHANNEL",
"type": "main",
"index": 0
}
]
]
},
"Request Post Image Text": {
"main": [
[
{
"node": "Update bot status on POST IMAGE REQUEST TEXT",
"type": "main",
"index": 0
}
]
]
},
"Send Posts Image (4922)": {
"main": [
[
{
"node": "Success Send Post Image",
"type": "main",
"index": 0
}
]
]
},
"Send Posts Image (4922) ": {
"main": [
[
{
"node": "Success Send Post Image",
"type": "main",
"index": 0
}
]
]
},
"Update bot status on START ": {
"main": [
[
{
"node": "Select Channels",
"type": "main",
"index": 0
}
]
]
},
"Update bot status on START ": {
"main": [
[
{
"node": "Select Channels ",
"type": "main",
"index": 0
}
]
]
},
"Update bot status on POST IMAGE REQUEST IMAGE": {
"main": [
[
{
"node": "Request Post Image Image",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个高级难度的工作流,适用于Sales、Building Blocks、Marketing等场景。适合高级用户,包含 16+ 个节点的复杂工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
TG-Bot-Module-Quiz-v4-db-sell-full
通过Telegram在Postgres中自动化测试和收集响应("测验"模块)
If
Set
Code
+9
36 节点Andrew
Sales
TG机器人-复选框模块-v2-数据库-销售完整版
Telegram机器人,用于多选项目并保存到PostgreSQL("复选框"模块)
If
Set
Code
+6
46 节点Andrew
Sales
TG-Bot-模块-检查_订阅-v4-数据库-销售-完整版
使用 Postgres 验证 Telegram 频道订阅并进行访问控制
If
Set
Switch
+7
45 节点Andrew
Building Blocks
TG机器人-抽奖模块-v4-数据库-销售完整版
Telegram频道订阅者抽奖活动("抽奖"模块)
If
Set
Sort
+6
44 节点Andrew
Building Blocks
WA-机器人-模块-问卷-v1-数据库-销售-完整版
在Postgres中收集WhatsApp问卷回复("Anketa"模块)
If
Set
Switch
+4
32 节点Andrew
Sales
WA-机器人模块-测验-v1-数据库销售完整版
使用PostgreSQL自动化WhatsApp测验和结果排名("测验"模块)
If
Set
Sort
+6
39 节点Andrew
Sales