8
n8n 中文网amn8n.com

利用运行时上下文和外部数据生成动态邮件序列

中级

这是一个Lead Nurturing, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 Webhook, Octave, HttpRequest, Agent, LmChatAnthropic 等节点。 使用Octave、LLM和外部数据生成个性化邮件序列

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
  • Anthropic API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "name": "利用运行时上下文和外部数据生成动态邮件序列",
  "tags": [],
  "nodes": [
    {
      "id": "sticky-note-main",
      "name": "便利贴 - 主要概览",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        450,
        -700
      ],
      "parameters": {
        "color": 1,
        "width": 450,
        "height": 500,
        "content": "🎯 具备运行时上下文的动态邮件序列"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-webhook",
      "name": "便利贴 - Webhook设置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        40,
        -150
      ],
      "parameters": {
        "color": 2,
        "width": 190,
        "height": 100,
        "content": "🚀 由此开始"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-research",
      "name": "便利贴 - 上下文研究",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -150
      ],
      "parameters": {
        "color": 4,
        "width": 190,
        "height": 100,
        "content": "🔍 上下文研究"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-llm",
      "name": "便利贴 - LLM处理",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        -300
      ],
      "parameters": {
        "color": 5,
        "width": 190,
        "height": 100,
        "content": "🧠 LLM处理"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-octave",
      "name": "便利贴 - Octave运行时",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -150
      ],
      "parameters": {
        "color": 3,
        "width": 190,
        "height": 100,
        "content": "⚡ 运行时上下文"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-email",
      "name": "便利贴 - 邮件平台",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -150
      ],
      "parameters": {
        "color": 6,
        "width": 190,
        "height": 100,
        "content": "📧 邮件平台"
      },
      "typeVersion": 1
    },
    {
      "id": "07920827-9d73-4099-8b6f-d599be97b929",
      "name": "潜在客户数据Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        120,
        0
      ],
      "webhookId": "your-webhook-id-here",
      "parameters": {
        "path": "your-webhook-path-here",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "4dc666e8-89dd-4647-8aeb-3880fd4aa59e",
      "name": "研究公司上下文",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        320,
        0
      ],
      "parameters": {
        "text": "=Output the name of an open role that {{ $json.body.companyDomain }} is hiring for. If you can't find a role they are hiring for, make up a basic one that would make sense for them to hire for. Normalize the job title to something that would be used in an internal email (i.e \"software engineer\" instead of \"Sr. Software Engineer II\"). Output just the name of the role and nothing else, with no pretext or posttext. Do NOT make any justification if you can't find a role, just give a dummy role and nothing else. No \"I wasn't able to find...\" BS.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "45c0b9e7-a035-4469-8a61-7e919502e715",
      "name": "LLM模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        220,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "your-llm-model",
          "cachedResultName": "Your LLM Model"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "Your LLM API Credentials"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5a08a3b4-4a19-4112-b97c-b100db4eefd8",
      "name": "使用运行时上下文生成序列",
      "type": "n8n-nodes-octavehq.octave",
      "position": [
        820,
        0
      ],
      "parameters": {
        "agentOId": "your-octave-sequence-agent-id",
        "jobTitle": "={{ $('Lead Data Webhook').item.json.body.jobTitle }}",
        "firstName": "={{ $('Lead Data Webhook').item.json.body.firstName }}",
        "operation": "runSequence",
        "companyName": "={{ $('Lead Data Webhook').item.json.body.companyName }}",
        "companyDomain": "={{ $('Lead Data Webhook').item.json.body.companyDomain }}",
        "linkedInProfile": "={{ $('Lead Data Webhook').item.json.body.profileURL }}",
        "runtimeContextStep1": "=they are hiring a {{ $json.output }}",
        "runtimeInstructionsStep1": "mention the role they're hiring for and that's why you reached out"
      },
      "credentials": {
        "octaveApi": {
          "name": "Octave API Credentials"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4ae4986a-547e-4d67-9d68-0774c1dc9ab7",
      "name": "将潜在客户添加至邮件营销活动",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "url": "https://api.instantly.ai/api/v2/leads",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "campaign",
              "value": "your-campaign-id-here"
            },
            {
              "name": "email",
              "value": "={{ $('Lead Data Webhook').item.json.body.email }}"
            },
            {
              "name": "first_name",
              "value": "={{ $('Lead Data Webhook').item.json.body.firstName }}"
            },
            {
              "name": "last_name",
              "value": "={{ $('Lead Data Webhook').item.json.body.lastName }}"
            },
            {
              "name": "company_name",
              "value": "={{ $('Lead Data Webhook').item.json.body.companyName }}"
            },
            {
              "name": "custom_variables",
              "value": "={{ { \"email1\": $json.emails[0].email || \"\", \"subject1\": $json.emails[0].subject || \"\", \"email2\": $json.emails[1].email || \"\", \"subject2\": $json.emails[1].subject || \"\", \"email3\": $json.emails[2].email || \"\", \"subject3\": $json.emails[2].subject || \"\" } }}"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "Email Platform API Key"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "LLM Model": {
      "ai_languageModel": [
        [
          {
            "node": "Research Company Context",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Lead Data Webhook": {
      "main": [
        [
          {
            "node": "Research Company Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research Company Context": {
      "main": [
        [
          {
            "node": "Generate Sequence with Runtime Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Sequence with Runtime Context": {
      "main": [
        [
          {
            "node": "Add Lead to Email Campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 客户培育, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流