N
n8n Store
Workflow Market
Sync Facebook Lead Ads to Google Sheets & Salesforce CRM

Sync Facebook Lead Ads to Google Sheets & Salesforce CRM

by candrareza0 views

Description

Categories

⚙️ Automation

Nodes Used

n8n-nodes-base.setn8n-nodes-base.startn8n-nodes-base.salesforcen8n-nodes-base.googleSheetsn8n-nodes-base.googleSheetsn8n-nodes-base.facebookLeadAdsTrigger
PriceGratuit
Views0
Last Updated11/28/2025
workflow.json
{
  "id": "1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Sync Facebook Lead Ads to Google Sheets & Salesforce CRM",
  "nodes": [
    {
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "position": [
        250,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Facebook Lead Ad",
      "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": "Log Lead to Google Sheets",
      "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": "Create Lead in 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": "Prepare CRM Data",
      "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": "Update Status in Sheet",
      "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
          }
        ]
      ]
    }
  }
}

相关工作流