8
n8n 中文网amn8n.com

使用表单、Bright Data 和 GPT-4o-mini 的定制交易推荐邮件

中级

这是一个Sales, AI领域的自动化工作流,包含 8 个节点。主要使用 Form, Html, SplitOut, EmailSend, FormTrigger 等节点,结合人工智能技术实现智能自动化。 通过表单、Bright Data 和 GPT-4o-mini 发送定制交易推荐邮件

前置要求
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "b1f85eae352fde76d801a1a612661df6824cc2e68bfd6741e31305160a737e6e",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a85eff80-4330-4bd8-acd9-9bf6e0b67c59",
      "name": "获取 MediaMarkt 优惠网站",
      "type": "n8n-nodes-brightdata.brightData",
      "position": [
        40,
        -160
      ],
      "parameters": {
        "url": "https://www.mediamarkt.es/es/campaign/campanas-y-ofertas",
        "zone": {
          "__rl": true,
          "mode": "list",
          "value": "web_unlocker1",
          "cachedResultName": "web_unlocker1"
        },
        "format": "json",
        "country": {
          "__rl": true,
          "mode": "list",
          "value": "es",
          "cachedResultName": "es"
        },
        "requestOptions": {}
      },
      "credentials": {
        "brightdataApi": {
          "id": "jk945kIuAFAo9bcg",
          "name": "BrightData account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d27b03e0-b0f1-4c76-b68e-d716391c71da",
      "name": "创建邮件 HTML 内容",
      "type": "n8n-nodes-document-generator.documentGenerator",
      "position": [
        60,
        100
      ],
      "parameters": {
        "template": "<br>\nThese are our recommended deals today:<br>\n<ul>\n{{#each items}}\n<li>{{category}}: <a href=\"https://www.bestbuy.com{{link}}\">{{name}}</a> for {{price}}€</li>\n{{/each}}\n</ul>\n<br>",
        "oneTemplate": true
      },
      "typeVersion": 1
    },
    {
      "id": "d47ee04f-c1c5-4aac-a615-aa68f5a2d6cd",
      "name": "从结果中提取项目",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -140,
        100
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "message.content.results"
      },
      "typeVersion": 1
    },
    {
      "id": "34df63de-9b0d-4245-8f87-3654cab0c17e",
      "name": "通过邮件通知最终用户",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        280,
        100
      ],
      "webhookId": "626001db-5451-4225-bf98-cd74c3952754",
      "parameters": {
        "html": "=Hi!\n<br>\n{{ $json.text }}\n\nBest,\n<br>\nThe n8nhackers team!",
        "options": {},
        "subject": "Your last deals!",
        "toEmail": "={{ $('When User Completes Form').first().json.Email}}",
        "fromEmail": "deals@n8nhackers.com"
      },
      "credentials": {
        "smtp": {
          "id": "z3kiLWNZTH4wQaGy",
          "name": "SMTP account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "fbbd7e95-d972-401a-9aca-8015a1acf553",
      "name": "显示表单结果页面",
      "type": "n8n-nodes-base.form",
      "position": [
        480,
        100
      ],
      "webhookId": "a67843b4-3ab9-427b-8e52-dfc42831065d",
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Our recommended deals!",
        "completionMessage": "=We have sent {{ $('Extract items from results').all().length }} recommended deals to your email!"
      },
      "typeVersion": 1
    },
    {
      "id": "e03ebc2b-db42-4a8d-8758-b3d988c4b943",
      "name": "从网站提取正文和标题",
      "type": "n8n-nodes-base.html",
      "position": [
        240,
        -160
      ],
      "parameters": {
        "options": {
          "trimValues": true
        },
        "operation": "extractHtmlContent",
        "dataPropertyName": "body",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "cssSelector": "title"
            },
            {
              "key": "body",
              "cssSelector": "body"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "74b0dcd7-d833-452c-82fe-98a21bd39d12",
      "name": "按类别生成优惠列表",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -520,
        100
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "Generate a list of recommended deals in json list. Classify items by category. Generate the next properties: name, description, price, link and category. All properties will be in a property called: results. Translate texts to english if required."
            },
            {
              "content": "=The input text is:\n{{ $json.body }}"
            },
            {
              "content": "=Categories to filter: {{ $('When User Completes Form').item.json.Category.join(',') }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "oKzfvOwieOm4upQ2",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "a1095cea-6adc-4cf9-93fe-3a67dc061276",
      "name": "当用户完成表单时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -180,
        -160
      ],
      "webhookId": "33e8f7c3-82fb-4339-9c91-4b19aa6c14ba",
      "parameters": {
        "options": {
          "path": "get-top-deals",
          "ignoreBots": true,
          "buttonLabel": "Get Deals"
        },
        "formTitle": "Top deals",
        "formFields": {
          "values": [
            {
              "fieldType": "dropdown",
              "fieldLabel": "Category",
              "multiselect": true,
              "fieldOptions": {
                "values": [
                  {
                    "option": "Appliances"
                  },
                  {
                    "option": "Cameras, CamCorders & Drones"
                  },
                  {
                    "option": "Car Electronics "
                  },
                  {
                    "option": "Cell Phones"
                  },
                  {
                    "option": "Computers & Tablets"
                  },
                  {
                    "option": "TV & Home Theater"
                  },
                  {
                    "option": "Video Games"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "Email",
              "placeholder": "Complete your email",
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode",
        "formDescription": "This form returns top deals by your preferences in the same page.\n\nYou can schedule your future deals once per day at the end of this test."
      },
      "typeVersion": 2.2
    }
  ],
  "pinData": {},
  "connections": {
    "Create HTML for Email": {
      "main": [
        [
          {
            "node": "Notify End User by Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify End User by Email": {
      "main": [
        [
          {
            "node": "Show Form Results Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When User Completes Form": {
      "main": [
        [
          {
            "node": "Get MediaMarkt Offers Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract items from results": {
      "main": [
        [
          {
            "node": "Create HTML for Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get MediaMarkt Offers Website": {
      "main": [
        [
          {
            "node": "Extract Body and Title from Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate List of Deals by Category": {
      "main": [
        [
          {
            "node": "Extract items from results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Body and Title from Website": {
      "main": [
        [
          {
            "node": "Generate List of Deals by Category",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 销售, 人工智能

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流