8
n8n 中文网amn8n.com

每日货币更新

中级

这是一个Crypto Trading领域的自动化工作流,包含 7 个节点。主要使用 Set, Gmail, HttpRequest, ScheduleTrigger 等节点。 通过CurrencyFreaks API和Gmail发送每日货币汇率更新

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "UXgh0OxJeBzvsPd0",
  "meta": {
    "instanceId": "77af0a283c09c10f98abd9ba129a0199590d5be1cf9e92f97fb6ae6972b0a52f",
    "templateCredsSetupCompleted": true
  },
  "name": "每日货币更新",
  "tags": [],
  "nodes": [
    {
      "id": "fa7e8916-7e89-4981-a95b-970b419c4189",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -500,
        -120
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "390155b0-6040-40fd-ab6f-284c579f29bb",
      "name": "设置API密钥和首选货币",
      "type": "n8n-nodes-base.set",
      "position": [
        -280,
        -120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4669b111-8540-4de2-a5f7-672f2ad81e98",
              "name": "API Key",
              "type": "string",
              "value": ""
            },
            {
              "id": "58c89ccb-2e3d-4334-9366-d0b285fdfbd8",
              "name": "Preferred Currencies",
              "type": "string",
              "value": "PKR,GBP,EUR,USD,BDT,INR"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f90d7646-8bba-426f-ba8e-c2e6e7f23b69",
      "name": "获取最新汇率",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -60,
        -120
      ],
      "parameters": {
        "url": "=https://api.currencyfreaks.com/v2.0/rates/latest?apikey={{ $json['API Key'] }}&symbols={{ $json['Preferred Currencies'] }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "0d270093-d04a-486a-92df-8b10104dc0e3",
      "name": "发送消息",
      "type": "n8n-nodes-base.gmail",
      "position": [
        540,
        -120
      ],
      "webhookId": "7b0cefce-98ec-45dc-bfb8-59fe78172598",
      "parameters": {
        "sendTo": "={{ $('Set Recipient Email').item.json['Recipient Email'] }}",
        "message": "=<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Currency Rate Update</title>\n    <style>\n      body {\n        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n        background-color: #f9fafb;\n        color: #111827;\n        margin: 0;\n        padding: 2rem;\n      }\n      .email-container {\n        max-width: 600px;\n        margin: 0 auto;\n        background-color: #ffffff;\n        border-radius: 12px;\n        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);\n        padding: 2rem;\n        border: 1px solid #e5e7eb;\n      }\n      .heading {\n        font-size: 1.25rem;\n        font-weight: 600;\n        margin-bottom: 1rem;\n        color: #1f2937;\n      }\n      .section {\n        margin-bottom: 1rem;\n      }\n      .rates {\n        background-color: #f3f4f6;\n        padding: 1rem;\n        border-radius: 8px;\n        font-family: monospace;\n        white-space: pre-line;\n        font-size: 0.95rem;\n      }\n      .footer {\n        margin-top: 2rem;\n        font-size: 0.875rem;\n        color: #6b7280;\n      }\n    </style>\n  </head>\n  <body>\n    <div class=\"email-container\">\n      <div class=\"heading\">📈 Daily Currency Rate Update</div>\n      <div class=\"section\">\n        <strong>Date:</strong>\n        {{ $('Get Latest Rate').item.json.date }}<br />\n        <strong>Base Currency:</strong>\n        {{ $('Get Latest Rate').item.json.base }}\n      </div>\n      <div class=\"section\">\n  <strong>Exchange Rates:</strong>\n  <div class=\"rates\">{{ Object.entries($('Get Latest Rate').item.json.rates).map(([k, v]) => `${k}: ${v}`).join('\\n') }}</div>\n</div>\n      <div class=\"footer\">\n        If you have any questions or would like to receive updates in a different format or frequency, feel free to reply to this email.<br /><br />\n        Best regards,<br />\n        <strong>Your Automation Bot</strong>\n      </div>\n    </div>\n  </body>\n</html>\n",
        "options": {},
        "subject": "={{ $json.Subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "snhNEnMsqNIkO9GP",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "52c25dd1-6ae8-49f7-9858-a452e53e5f9b",
      "name": "设置收件人邮箱",
      "type": "n8n-nodes-base.set",
      "position": [
        140,
        -120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b0969ab-45d1-427c-bac0-bd59a43661d7",
              "name": "Recipient Email",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "eb16bc9f-ab43-4ae9-a243-95c27230a9b8",
      "name": "设置邮件主题",
      "type": "n8n-nodes-base.set",
      "position": [
        340,
        -120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ad95bad5-c4ac-4864-a83c-06d59d99b415",
              "name": "Subject",
              "type": "string",
              "value": "Daily Currency Update: PKR, GBP, EUR, USD, BDT, INR"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "08160c70-de91-48e2-9bff-aa87bc24975b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -500
      ],
      "parameters": {
        "width": 640,
        "height": 320,
        "content": "#### 每日货币更新工作流 (n8n)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8f4bb63b-5d83-41b6-bf78-307f20926d49",
  "connections": {
    "Send a message": {
      "main": [
        []
      ]
    },
    "Get Latest Rate": {
      "main": [
        [
          {
            "node": "Set Recipient Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set API Key & Preferred Currencies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set E-mail Subject": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Recipient Email": {
      "main": [
        [
          {
            "node": "Set E-mail Subject",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set API Key & Preferred Currencies": {
      "main": [
        [
          {
            "node": "Get Latest Rate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 加密货币交易

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流