8
n8n 中文网amn8n.com

[模板] Meta Conversion API

中级

这是一个CRM领域的自动化工作流,包含 10 个节点。主要使用 If, Set, Crypto, HttpRequest, GoogleCalendarTrigger 等节点。 通过 Google Calendar 到 Meta Conversions API 集成跟踪演示预约

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "name": "[模板] Meta Conversion API",
  "nodes": [
    {
      "id": "5b569d35-f4fc-44ca-bdb5-87ede5ae4b9d",
      "name": "Google Calendar 触发器",
      "type": "n8n-nodes-base.googleCalendarTrigger",
      "position": [
        140,
        0
      ],
      "parameters": {
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "eventCreated",
        "calendarId": {
          "__rl": true,
          "mode": "list",
          "value": "your-email@email-domain.com",
          "cachedResultName": "your-email@email-domain.com"
        }
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "FYaXEXCuzrj6vHQ6",
          "name": "Google account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "110ee9bc-5592-4b3b-9397-c10ac54dd6ca",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        560,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "b128a6f2-74fd-45d9-828e-083b5e46fff2",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.summary }}",
              "rightValue": "={{ $json.event_name_filter }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "23224570-ea11-42f0-8d88-2823c471c9b4",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        820,
        200
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "decd0bf8-ef4e-4070-990c-76d507248ef2",
      "name": "HTTP 请求 - Meta Conversion API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1220,
        -100
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/{{$('Config').item.json.FB_API_VERSION}}/{{$('Config').item.json.FB_PIXEL_ID}}/events",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "data",
              "value": "=[\n    {\n      event_name: \"Schedule\",\n      event_time: {{ $json.event_time }},\n      action_source: \"website\",\n      event_source_url: \"{{$('Config').item.json.source_url}}\",\n      user_data: {\n        em: [\"{{ $json.em }}\"],\n        client_ip_address: \"{{ $json.client_ip_address }}\",\n        client_user_agent: \"{{ $json.client_user_agent }}\"\n      },\n      attribution_data: {\n        attribution_share: \"1.0\"\n      },\n      original_event_data: {\n        event_name: \"Schedule\",\n        event_time: {{ $json.event_time }}\n      }\n    }\n]"
            },
            {
              "name": "access_token",
              "value": "={{$('Config').item.json.FB_ACCESS_TOKEN}}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9d3d13ff-b3a8-40bd-95bc-ac2f11ad4852",
      "name": "加密货币",
      "type": "n8n-nodes-base.crypto",
      "position": [
        780,
        -100
      ],
      "parameters": {
        "type": "SHA256",
        "value": "={{ $json.attendees[1].email }}",
        "dataPropertyName": "hashedEmail"
      },
      "typeVersion": 1
    },
    {
      "id": "b7f75d45-e2d0-4afd-a023-2b9fdfbad958",
      "name": "参数",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        -100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cc2c20cc-d4f7-4bb3-b435-f2b719736a66",
              "name": "em",
              "type": "string",
              "value": "={{ $json.hashedEmail }}"
            },
            {
              "id": "8fad81a5-4a22-4190-a199-7c2ebccd9893",
              "name": "client_ip_address",
              "type": "string",
              "value": "={{$json.clientIp || '0.0.0.0'}}"
            },
            {
              "id": "44afb80a-3cbb-4df6-baab-cd79991967d8",
              "name": "client_user_agent",
              "type": "string",
              "value": "={{$json.userAgent || 'n8n/MetaCAPI'}}"
            },
            {
              "id": "c4502ba7-bcb8-4abe-9629-1811addf419e",
              "name": "event_time",
              "type": "string",
              "value": "={{Math.floor(Date.now() / 1000)}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "cd525037-3aed-4e4a-9f21-bb7e368e3ad7",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -220
      ],
      "parameters": {
        "width": 460,
        "height": 520,
        "content": "# 欢迎使用 Meta Conversion API 工作流!"
      },
      "typeVersion": 1
    },
    {
      "id": "eb620669-c58d-4896-a6e0-b58685bc52ef",
      "name": "配置",
      "type": "n8n-nodes-base.set",
      "position": [
        360,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c2fc1894-0d50-475d-be54-67d377573090",
              "name": "FB_PIXEL_ID",
              "type": "string",
              "value": "your-pixel-id-here"
            },
            {
              "id": "0cb0174f-e07f-4294-9818-c2e140707b78",
              "name": "FB_ACCESS_TOKEN",
              "type": "string",
              "value": "your-access-token-here"
            },
            {
              "id": "bc87c01e-7f37-4a26-ba95-6bcf16c7d462",
              "name": "FB_API_VERSION",
              "type": "string",
              "value": "v22.0"
            },
            {
              "id": "d9297f81-1577-4bcd-903f-c67d25cc4245",
              "name": "source_url",
              "type": "string",
              "value": "https://your-landing-page-url-here.com"
            },
            {
              "id": "2502bc03-8196-45cd-bd03-7df0d79d658b",
              "name": "event_name_filter",
              "type": "string",
              "value": "your-demo-event-name-here"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "67a859f7-3b54-479b-95d3-e325cfc8a6ba",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -220
      ],
      "parameters": {
        "color": 4,
        "width": 220,
        "height": 400,
        "content": "**在此处配置:**"
      },
      "typeVersion": 1
    },
    {
      "id": "eebabd9b-151e-490a-a6ad-5a462a6ac0af",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        -280
      ],
      "parameters": {
        "color": 3,
        "width": 360,
        "height": 140,
        "content": "## 发送附加属性"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "Params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Params": {
      "main": [
        [
          {
            "node": "HTTP Request - Meta Conversion API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar Trigger": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 客户关系管理

需要付费吗?

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

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

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

作者
Marcelo Abreu

Marcelo Abreu

@mabreum

founder@pdforge

外部链接
在 n8n.io 查看

分享此工作流