8
n8n 中文网amn8n.com

同步 Facebook 潜在客户广告到 Google 表格和 Salesforce CRM

中级

这是一个Lead Generation领域的自动化工作流,包含 6 个节点。主要使用 Set, Start, Salesforce, GoogleSheets, FacebookLeadAdsTrigger 等节点。 将 Facebook/Google 潜在客户广告同步至 Google 表格和 Salesforce CRM

前置要求
  • Salesforce OAuth 凭证
  • Google Sheets API 凭证
  • Facebook Graph API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移

无法加载工作流预览

导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "同步Facebook潜在客户广告到Google表格和Salesforce CRM",
  "nodes": [
    {
      "name": "开始",
      "type": "n8n-nodes-base.start",
      "position": [
        250,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Facebook潜在客户广告",
      "type": "n8n-nodes-base.facebookLeadAdsTrigger",
      "position": [
        450,
        300
      ],
      "parameters": {
        "formId": "={{ $credential.formId }}",
        "pageId": "={{ $credential.pageId }}",
        "options": {}
      },
      "credentials": {
        "facebookLeadAdsTriggerApi": {
          "id": "YOUR_FB_CREDENTIAL_ID",
          "name": "Facebook Lead Ads credential"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "记录潜在客户到Google表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        890,
        300
      ],
      "parameters": {
        "columns": {
          "values": [
            {
              "value": "={{ $now.toFormat('yyyy-MM-dd HH:mm:ss') }}",
              "column": "Timestamp"
            },
            {
              "value": "={{$json.full_name}}",
              "column": "FullName"
            },
            {
              "value": "={{$json.email}}",
              "column": "Email"
            },
            {
              "value": "={{$json.phone_number}}",
              "column": "PhoneNumber"
            },
            {
              "value": "={{$json.leadgen_id}}",
              "column": "LeadID"
            },
            {
              "value": "Processing",
              "column": "CRM_Status"
            }
          ]
        },
        "options": {},
        "sheetName": "YOUR_SHEET_NAME",
        "documentId": "YOUR_GOOGLE_SHEET_ID"
      },
      "credentials": {
        "googleSheetsApi": {
          "id": "YOUR_GOOGLE_CREDENTIAL_ID",
          "name": "Google Sheets credential"
        }
      },
      "typeVersion": 3
    },
    {
      "name": "在Salesforce中创建潜在客户",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        1110,
        300
      ],
      "parameters": {
        "fields": {
          "additionalFields": {
            "Email": "={{$nodes[\"Prepare CRM Data\"].json.email}}",
            "Phone": "={{$nodes[\"Prepare CRM Data\"].json.phone_number}}",
            "Company": "Lead from Facebook",
            "LastName": "={{$nodes[\"Prepare CRM Data\"].json.lastName}}",
            "FirstName": "={{$nodes[\"Prepare CRM Data\"].json.firstName}}",
            "LeadSource": "Facebook Lead Ad"
          }
        },
        "options": {},
        "resource": "lead",
        "operation": "create"
      },
      "credentials": {
        "salesforceApi": {
          "id": "YOUR_SALESFORCE_CREDENTIAL_ID",
          "name": "Salesforce credential"
        }
      },
      "typeVersion": 2
    },
    {
      "name": "准备CRM数据",
      "type": "n8n-nodes-base.set",
      "position": [
        670,
        300
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "firstName",
              "value": "={{ $json.full_name.split(' ').slice(0, -1).join(' ') || $json.full_name }}"
            },
            {
              "name": "lastName",
              "value": "={{ $json.full_name.split(' ').pop() }}"
            }
          ]
        },
        "options": {
          "dotNotation": true
        }
      },
      "typeVersion": 2
    },
    {
      "name": "在表格中更新状态",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1330,
        300
      ],
      "parameters": {
        "key": "LeadID",
        "value": "={{$nodes[\"Log Lead to Google Sheets\"].json.LeadID}}",
        "columns": {
          "values": [
            {
              "value": "Synced to Salesforce",
              "column": "CRM_Status"
            }
          ]
        },
        "options": {},
        "sheetName": "={{$nodes[\"Log Lead to Google Sheets\"].parameters.sheetName}}",
        "documentId": "={{$nodes[\"Log Lead to Google Sheets\"].parameters.documentId}}"
      },
      "credentials": {
        "googleSheetsApi": {
          "id": "YOUR_GOOGLE_CREDENTIAL_ID",
          "name": "Google Sheets credential"
        }
      },
      "typeVersion": 3
    }
  ],
  "active": false,
  "settings": {},
  "connections": {
    "Facebook Lead Ad": {
      "main": [
        [
          {
            "node": "Prepare CRM Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare CRM Data": {
      "main": [
        [
          {
            "node": "Log Lead to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Lead in Salesforce": {
      "main": [
        [
          {
            "node": "Update Status in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Lead to Google Sheets": {
      "main": [
        [
          {
            "node": "Create Lead in Salesforce",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 潜在客户开发

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流