WA-机器人模块-测验-v1-数据库销售完整版

高级

这是一个Sales、Marketing领域的自动化工作流,包含 39 个节点。主要使用 If、Set、Sort、Switch、Postgres 等节点。 使用PostgreSQL自动化WhatsApp测验和结果排名("测验"模块)

前置要求
  • PostgreSQL 数据库连接信息
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "QTuJfyY6vm7iEIH6",
  "meta": {
    "instanceId": "888b5b52ac2aa3f8f1bab6800cae8fce6f3d7947e840e64245b5198449908655",
    "templateCredsSetupCompleted": true
  },
  "name": "WA-机器人模块-测验-v1-数据库销售完整版",
  "tags": [
    {
      "id": "XPad0ERjSdqfxG52",
      "name": "module",
      "createdAt": "2025-03-31T08:11:00.151Z",
      "updatedAt": "2025-03-31T08:11:00.151Z"
    },
    {
      "id": "NeRMkUNq0sRVlL99",
      "name": "whatsapp",
      "createdAt": "2025-03-10T18:20:40.864Z",
      "updatedAt": "2025-03-10T18:20:40.864Z"
    },
    {
      "id": "2ocrWSzdKoCOU2AC",
      "name": "sell",
      "createdAt": "2025-04-19T15:39:51.859Z",
      "updatedAt": "2025-04-19T15:39:51.859Z"
    }
  ],
  "nodes": [
    {
      "id": "6eb96949-f6bc-4044-b0cf-7bac329ce722",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        420,
        520
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "42f5adf9-8663-44f7-a2da-20631d01dc0f",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        520
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2e406d54-a333-4767-a1bb-e2c61d60c5b6",
      "name": "开始",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        480,
        560
      ],
      "webhookId": "c9e66b18-77be-4d85-94f5-11824c2ce53c",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7d6e48cb-6154-48a5-97c5-aef2bfcffc58",
      "name": "获取机器人状态",
      "type": "n8n-nodes-base.postgres",
      "position": [
        480,
        760
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.5,
      "alwaysOutputData": true
    },
    {
      "id": "a998e1fe-c919-4b61-a051-17afa7f14c0e",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        1400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2ed48b30-5737-4d84-bceb-a8046c950fe6",
      "name": "命令",
      "type": "n8n-nodes-base.switch",
      "position": [
        980,
        760
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "0039047d-110f-4726-a29d-2d1035e924ec",
      "name": "主菜单",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1260,
        560
      ],
      "webhookId": "4ab7201b-786d-4004-96ec-e0a4c7105ed1",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "53c8427c-a23d-4818-a2d5-f8ad3cd78816",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2960,
        940
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "743ef248-8f5c-444b-91c9-07249ae98540",
      "name": "定义流程",
      "type": "n8n-nodes-base.switch",
      "position": [
        700,
        760
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "68ae7054-369d-4b61-ad76-eeba27d8fc98",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        740
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "988f33f4-a8d9-44d9-ac2c-3ad00c64217f",
      "name": "启动时更新机器人状态",
      "type": "n8n-nodes-base.postgres",
      "position": [
        700,
        560
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "719d9e1d-61e1-44de-8cfc-bc28b8e5f53c",
      "name": "初始化",
      "type": "n8n-nodes-base.set",
      "position": [
        240,
        760
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "2908320f-4f14-4d9a-9896-72b4187f8217",
      "name": "启动时更新机器人状态",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1480,
        560
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "ef1d9288-56f0-41ce-81a3-c3452e6ac86a",
      "name": "测试时更新机器人状态",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3020,
        960
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "a42629ec-0966-4e63-b863-a0f541003171",
      "name": "随机化问题",
      "type": "n8n-nodes-base.sort",
      "position": [
        2360,
        960
      ],
      "parameters": {},
      "executeOnce": false,
      "typeVersion": 1
    },
    {
      "id": "08429844-5483-44d7-8a5c-4e9e0f6f120e",
      "name": "有任何问题吗?",
      "type": "n8n-nodes-base.if",
      "position": [
        2140,
        1160
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "c2fe1635-6536-4895-9842-a815eb7902aa",
      "name": "更新答案",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1700,
        1160
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.5
    },
    {
      "id": "ea2fe4f7-1cd3-41a8-a1b1-1fe94e416a5f",
      "name": "获取未回答问题",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1920,
        1160
      ],
      "parameters": {},
      "typeVersion": 2.5,
      "alwaysOutputData": true
    },
    {
      "id": "3000d5c8-a99c-4d1d-b6ff-a49ec1ea73c2",
      "name": "获取测试",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1480,
        760
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "118fe642-e11f-4f1d-ab38-34f9b4b3e329",
      "name": "将编号与问题合并",
      "type": "n8n-nodes-base.set",
      "position": [
        1700,
        760
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "aa592693-5434-44e8-8e90-00887b261b1f",
      "name": "合并列表",
      "type": "n8n-nodes-base.summarize",
      "position": [
        1920,
        760
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "fcac55cc-3ce0-4f2c-8d36-605927fce0fb",
      "name": "计算答案",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2360,
        1160
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "c03e0632-74ea-471a-a0d4-7f754d062db4",
      "name": "WhatsApp 触发器",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        20,
        760
      ],
      "webhookId": "314e7a55-d4ca-4514-9d28-0b41c7d64945",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "726f6b67-542f-4a11-aa48-e1427be1074e",
      "name": "列出测试",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2140,
        760
      ],
      "webhookId": "d7d17714-5fe6-4d42-82a0-23590e4cf957",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c365a231-8572-4a40-8c07-21000690e9af",
      "name": "列表?",
      "type": "n8n-nodes-base.if",
      "position": [
        1260,
        760
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "94d08401-dc68-4979-b94e-600e79000679",
      "name": "获取测试",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1700,
        960
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.5
    },
    {
      "id": "ff451553-cae3-450d-8f0c-ae4a89f146d8",
      "name": "获取测试",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1480,
        960
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.5
    },
    {
      "id": "66608e4e-2771-4210-aee8-f1fcb3453cef",
      "name": "测试",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1920,
        960
      ],
      "webhookId": "0e07e27a-bce0-4c89-8b7a-afad148361ca",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3e36fbcd-fbe7-4343-8eb7-2ee0c2bac223",
      "name": "获取问题与答案",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2140,
        960
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.5
    },
    {
      "id": "78efdb33-a094-4a36-98f8-30de68292d4c",
      "name": "更新预测答案",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2580,
        960
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.5
    },
    {
      "id": "6ff36dd2-b8b0-4f45-997a-7d098f9eb56f",
      "name": "请求答案",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2800,
        960
      ],
      "webhookId": "4e533cdd-57de-43b6-8b24-36b93013fb01",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "75937466-26c4-424b-ae46-54890d044c12",
      "name": "获取答案",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1260,
        1160
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.5
    },
    {
      "id": "9638190f-351e-40ee-8708-20231701c650",
      "name": "结果",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        2580,
        1160
      ],
      "webhookId": "5869922e-9e0e-4482-9637-21e753689c22",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "65c40000-24b8-4317-a3f8-99cf8618b508",
      "name": "获取问题变体",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1480,
        1160
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 2.5
    },
    {
      "id": "a082da78-ab1a-4e61-8d6b-cb24ffb3ed9d",
      "name": "启动时更新机器人状态",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2800,
        1160
      ],
      "parameters": {},
      "typeVersion": 2.5
    },
    {
      "id": "1ea5577a-5ac6-4884-9ec3-f20bc17c33e4",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        760
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0cc3c717-85c3-4cb0-8526-4f4e6b6a54dd",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        520
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "08ed150c-151c-42f9-9f72-cf46b2791011",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        1080
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f31fa5b3-0c9d-4479-8026-70fc779ed579",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        1080
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ddae069a-aa64-4421-9090-01171c60d0d0",
  "connections": {
    "Test": {
      "main": [
        [
          {
            "node": "Get Questions AND Answers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List?": {
      "main": [
        [
          {
            "node": "Get Tests",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Tests ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Result": {
      "main": [
        [
          {
            "node": "Update Bot Status on START",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Starts": {
      "main": [
        [
          {
            "node": "Upsert Bot Status on START",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Commands": {
      "main": [
        [
          {
            "node": "Main Menu",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "List?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Test": {
      "main": [
        [
          {
            "node": "Test",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Tests": {
      "main": [
        [
          {
            "node": "Union Number with Question",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Main Menu": {
      "main": [
        [
          {
            "node": "Update Bot Status on START ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Answer": {
      "main": [
        [
          {
            "node": "Get Question variants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Tests ": {
      "main": [
        [
          {
            "node": "Get Test",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Union list": {
      "main": [
        [
          {
            "node": "List Tests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Flow": {
      "main": [
        [
          {
            "node": "Starts",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Commands",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Answer",
            "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
          }
        ]
      ]
    },
    "Get Bot Status": {
      "main": [
        [
          {
            "node": "Define Flow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialization": {
      "main": [
        [
          {
            "node": "Get Bot Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request Answer": {
      "main": [
        [
          {
            "node": "Update Bot Status on TEST",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Initialization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate answers": {
      "main": [
        [
          {
            "node": "Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert pred Answer": {
      "main": [
        [
          {
            "node": "Request Answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Randomize questions": {
      "main": [
        [
          {
            "node": "Upsert pred Answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Question variants": {
      "main": [
        [
          {
            "node": "Update Answer",
            "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、Marketing等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

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

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

作者
Andrew

Andrew

@boanse

Analyst-Developer

外部链接
在 n8n.io 上查看 →

分享此工作流