8
n8n 中文网amn8n.com

使用GPT-4个性化邮件和短信跟进的Salesforce潜在客户捕获

中级

这是一个Lead Generation, Multimodal AI领域的自动化工作流,包含 7 个节点。主要使用 Switch, Twilio, EmailSend, Salesforce, FormTrigger 等节点。 使用GPT-4个性化邮件和短信跟进的Salesforce潜在客户捕获

前置要求
  • Salesforce OAuth 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "9a562c06a632241f66aadd52a495ad98e76b760ef5cfce9c319a4759c47cd94e",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ec1d0463-087c-41e4-a4c9-e1672c1bee61",
      "name": "创建Salesforce潜在客户",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -380,
        -200
      ],
      "parameters": {
        "company": "=Web Lead {{ $json[\"Last Name\"] }}",
        "lastname": "={{ $json[\"Last Name\"] }}",
        "additionalFields": {
          "email": "={{ $json.Email }}",
          "firstname": "={{ $json[\"First Name\"] }}",
          "description": "={{ $json[\"Tell Us About Yourself (Description)\"] }}",
          "mobilePhone": "={{ $json[\"Phone (SMS)\"] }}"
        }
      },
      "credentials": {
        "salesforceOAuth2Api": {
          "id": "XhjgRQcYQYRIgOfD",
          "name": "Salesforce account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3595d4f3-b3c3-4aa7-ba99-398ff7ab6fad",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -580,
        -200
      ],
      "webhookId": "aa0154af-fba9-48fb-9d2e-60d5b90e9338",
      "parameters": {
        "options": {
          "buttonLabel": "Submit"
        },
        "formTitle": "Contact Us",
        "formFields": {
          "values": [
            {
              "fieldLabel": "First Name",
              "requiredField": true
            },
            {
              "fieldLabel": "Last Name",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "Email"
            },
            {
              "fieldLabel": "Phone (SMS)"
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Tell Us About Yourself (Description)"
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Contact Preference:",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Email"
                  },
                  {
                    "option": "Phone"
                  }
                ]
              },
              "requiredField": true
            },
            {}
          ]
        },
        "formDescription": "We'll get back to you soon"
      },
      "typeVersion": 2.2
    },
    {
      "id": "4349f4a7-98a1-4805-a7b1-fcc475274eea",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -160,
        -200
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Create a personalized welcome message for this lead:\n{{ JSON.stringify($('On form submission').item.json)}}\n\nTailor the message to their interest in booking an n8n form creation. Make it warm and helpful."
            },
            {
              "role": "system",
              "content": "You are a friendly, professional sales assistant for an automation and software development service specializing in n8n workflows, Salesforce integrations, and custom forms. Your goal is to create engaging, personalized welcome messages that respond directly to the user's description, encouraging them to proceed with booking or next steps. \n\nAdapt the message format based on the contact preference:\n- If preference is \"Email\": Make it detailed, positive, and action-oriented (under 200 words). Include a greeting, body with personalization, call-to-action (e.g., reply or schedule), and end with your company signature: \"Best regards, [Your Company Name] Team\" and  without the Subject.\n- If preference is \"Phone (SMS)\": Keep it very concise (under 160 characters), friendly, and direct. Include a short greeting, key offer, and simple call-to-action. No signature or links; focus on quick engagement; without the Subject.\n\nAlways personalize using the user's first name, last name, and description. If the description mentions booking or creating something (e.g., an n8n form), offer specific help and suggest packages."
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "ciKVFfcmd36noEnL",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "cac8625a-bd57-48b1-b98f-70daa4561c7c",
      "name": "条件分支",
      "type": "n8n-nodes-base.switch",
      "position": [
        200,
        -200
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "72c22b5b-16f6-424f-b3eb-e93da457e797",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('On form submission').item.json[\"Contact Preference:\"] }}",
                    "rightValue": "Phone (SMS)"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8d42ed48-0064-4a5f-b924-a7968a91c919",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('On form submission').item.json[\"Contact Preference:\"] }}",
                    "rightValue": "Email"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "05b99b9d-a6ce-44a1-9269-508b7afce052",
      "name": "发送短信",
      "type": "n8n-nodes-base.twilio",
      "notes": "Send SMS using Twilio",
      "position": [
        520,
        -300
      ],
      "parameters": {
        "to": "={{ $('On form submission').item.json[\"Phone (SMS)\"] }}",
        "from": "phoneNumber",
        "message": "={{ $('OpenAI').item.json.message.content }}",
        "options": {}
      },
      "credentials": {
        "twilioApi": {
          "id": "vM2JERicK76paC8V",
          "name": "Twilio account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5d392311-853e-4e97-a436-874cc891bc6b",
      "name": "发送邮件",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        520,
        -80
      ],
      "webhookId": "653bd18e-774f-45aa-b28f-858e1a2bba32",
      "parameters": {
        "text": "={{ $('OpenAI').item.json.message.content }}",
        "options": {},
        "subject": "=Welcome {{ $('On form submission').item.json[\"First Name\"] }}",
        "toEmail": "={{ $('On form submission').item.json.Email }}",
        "fromEmail": "emailPlaceholder",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "id": "JNtQ5FosqXaLKi5O",
          "name": "SMTP account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "10d1bb22-1c6e-4762-937a-f4d1cbba7259",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -480
      ],
      "parameters": {
        "width": 320,
        "height": 460,
        "content": "## n8n网页潜在客户表单替代Salesforce Web-to-Lead"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {
    "On form submission": [
      {
        "Email": "alex.kim@example.com",
        "formMode": "live",
        "Last Name": "Kim",
        "First Name": "Alex",
        "Phone (SMS)": "1234567890",
        "submittedAt": "2025-07-18T10:00:00.000-04:00",
        "Contact Preference:": "Phone (SMS)",
        "Tell Us About Yourself (Description)": "I'm looking for a packaged software developer solution to build a custom CRM integration with n8n and Salesforce. Need something scalable for my startup."
      }
    ]
  },
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Send SMS",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Create Salesforce Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Salesforce Lead": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 潜在客户开发, 多模态 AI

需要付费吗?

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

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

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

作者
Le Nguyen

Le Nguyen

@leeseifer

Salesforce Architect with 10+ years of experience in CRM, integrations, and automation. Skilled in Apex, LWC, REST APIs, and full-stack dev (JavaScript, .NET). I build secure, scalable workflows in n8n—connecting Salesforce, Stripe, and more. Passionate about lead scoring, data sync, and secure field masking. Certified Application Architect with deep expertise in platform, integration, and data architecture.

外部链接
在 n8n.io 查看

分享此工作流