8
n8n 中文网amn8n.com

通过Webhook生成QR码

中级

这是一个Building Blocks, IT Ops领域的自动化工作流,包含 6 个节点。主要使用 Webhook, HttpRequest, RespondToWebhook 等节点。 通过 Webhook 生成二维码

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "2Ttwb1pfwNkhBDuB",
  "meta": {
    "instanceId": "1777696fb9fddfee653e70940936c2b1e28ba1f1bde53b7182fbd6eb01988706"
  },
  "name": "通过Webhook生成QR码",
  "tags": [],
  "nodes": [
    {
      "id": "1a6f0b70-47f1-4a13-9d06-569574438a07",
      "name": "Webhook触发器说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -40
      ],
      "parameters": {
        "height": 320,
        "content": "此节点监听传入的POST请求。它期望一个包含'data'属性(或当前配置的'sampleData')的JSON主体,该数据将被编码到QR码中。您可以轻松调整Webhook路径。"
      },
      "typeVersion": 1
    },
    {
      "id": "b66d7f5a-cf82-43bd-902c-3e9a74fc4e3e",
      "name": "QR码生成说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -40
      ],
      "parameters": {
        "color": 2,
        "width": 280,
        "height": 320,
        "content": "此节点向QR服务器API发出HTTP GET请求以生成QR码图像。URL中的'data'参数由传入的Webhook填充。可以在此处调整'size'参数。"
      },
      "typeVersion": 1
    },
    {
      "id": "e55153df-3269-46d5-8c01-289eb72415ae",
      "name": "Webhook响应说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        -60
      ],
      "parameters": {
        "color": 3,
        "width": 300,
        "height": 340,
        "content": "此节点将来自QR服务器API的响应(通常是QR码图像数据本身,或者如果您更改了API调用,则是其URL)发送回Webhook的原始调用者。您可以在此节点之前插入其他节点来保存图像、通过电子邮件发送等。"
      },
      "typeVersion": 1
    },
    {
      "id": "c9a692b7-62bd-40e2-8c92-0dbbc37f3e12",
      "name": "生成二维码",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        580,
        140
      ],
      "parameters": {
        "url": "=https://api.qrserver.com/v1/create-qr-code/?size=150x150&data={{ $json.body.data }}",
        "method": "=GET",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "cb065a0f-562a-432f-9ed4-c942fdd6a808",
      "name": "接收数据Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        260,
        140
      ],
      "webhookId": "6960391c-83cf-49b3-aa8d-761cd8263d76-unique-id",
      "parameters": {
        "path": "generate-qr",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "acd3ea0f-7694-4875-994c-3b365c10fc28",
      "name": "响应QR码",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        920,
        140
      ],
      "parameters": {
        "options": {},
        "respondWith": "allIncomingItems"
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "23aac7b6-e36d-4074-b81d-dbdcb8204451",
  "connections": {
    "Generate QR Code": {
      "main": [
        [
          {
            "node": "Respond with QR Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Data Webhook": {
      "main": [
        [
          {
            "node": "Generate QR Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 构建模块, IT 运维

需要付费吗?

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

工作流信息
难度等级
中级
节点数量6
分类2
节点类型4
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
ist00dent

ist00dent

@ist00dent

I’m a dedicated automation engineer passionate about no-code and low-code solutions. I design and implement robust n8n workflows—integrating APIs, databases, and messaging—to eliminate manual tasks and accelerate delivery. Leveraging Python and C#, I build scalable, adaptable automations that empower teams to focus on high-value work.

外部链接
在 n8n.io 查看

分享此工作流