8
n8n 中文网amn8n.com

黄金价格提醒

中级

这是一个Crypto Trading领域的自动化工作流,包含 10 个节点。主要使用 If, Html, HttpRequest, ScheduleTrigger 等节点。 基于网页抓取的LINE黄金价格阈值提醒

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "CQ33IAKSfdDbLzmK",
  "meta": {
    "instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a"
  },
  "name": "黄金价格提醒",
  "tags": [],
  "nodes": [
    {
      "id": "771277db-5553-4d8f-8519-a27e25107178",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -480,
        20
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cf148eee-50dc-41a7-9555-a906676bbc81",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        360,
        20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6decc8be-9041-4975-b700-16f8360578b5",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ parseFloat($json['#DetailPlace_uc_goldprices1_lblBLBuy'].replace(/[^\\d.]/g, '')) }}",
              "rightValue": 52300
            },
            {
              "id": "553a009d-a08a-4746-b546-d1a43352b07f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f98523e4-4dbc-486c-9a7e-babb024aa907",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -80
      ],
      "parameters": {
        "width": 260,
        "height": 260,
        "content": "计划每 6 小时检查一次当前黄金价格"
      },
      "typeVersion": 1
    },
    {
      "id": "62bd43cd-755c-44b7-b30d-27416d61f9a5",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 260,
        "content": "要获取普通网页,我们可以使用无需任何授权的 HTTP 请求,输出将是 HTML 代码"
      },
      "typeVersion": 1
    },
    {
      "id": "e6d39001-667e-4632-9b46-2890e2c9aa60",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 260,
        "content": "我们需指定从之前的 HTML 代码中提取什么,例如价格——您可以通过右键点击 > 检查来查找元素"
      },
      "typeVersion": 1
    },
    {
      "id": "ec2e7f8b-1867-436a-8537-af9c69d9c726",
      "name": "获取网页",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        20
      ],
      "parameters": {
        "url": "https://www.goldtraders.or.th/",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "35f7cac8-ce35-4ba8-893d-aa69e0ea5141",
      "name": "提取价格",
      "type": "n8n-nodes-base.html",
      "position": [
        80,
        20
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "#DetailPlace_uc_goldprices1_lblBLBuy",
              "cssSelector": "#DetailPlace_uc_goldprices1_lblBLBuy"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a8f8d4ed-124d-4921-a03a-25459a015100",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 260,
        "height": 320,
        "content": "我们不希望收到所有提醒。因此,我们仅在价格超过给定数字时过滤提醒一次。"
      },
      "typeVersion": 1
    },
    {
      "id": "1a3cce75-f2d0-4934-b0c9-7c7f8b4e5681",
      "name": "发送 Line 消息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        660,
        -120
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/push",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"to\": \"Ue9cc622e33e5333e3784298412ec9aed\",\n    \"messages\":[\n        {\n            \"type\":\"text\",\n            \"text\":\"ราคาทองวันนี้  {{ $json['#DetailPlace_uc_goldprices1_lblBLBuy'] }}\"\n        }\n    ]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "lKd3b2nc8uNJ148Z",
          "name": "Line @271dudsw MiniBear"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b979a549-4717-49f1-8678-e3b699682dc9",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        -220
      ],
      "parameters": {
        "width": 260,
        "height": 260,
        "content": "当条件满足时,它将通过 Line 发送消息。这也可以是其他平台,例如 Telegram 或电子邮件"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ac7f75f8-6820-4ec3-9934-0fbcc45cfad3",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Send Line Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Webpage": {
      "main": [
        [
          {
            "node": "Extract Price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Price": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Webpage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 加密货币交易

需要付费吗?

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

工作流信息
难度等级
中级
节点数量10
分类1
节点类型5
难度说明

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

外部链接
在 n8n.io 查看

分享此工作流