Facebook-Meta 转化API电商线索订单
高级
这是一个AI领域的自动化工作流,包含 17 个节点。主要使用 Set, Code, Webhook, ManualTrigger, FacebookGraphApi 等节点,结合人工智能技术实现智能自动化。 Facebook/Meta 转化API电商线索/订单处理
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
- •Facebook Graph API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "66ce8bb89c7868f862e0d2e755cd17c6a5aea7904e5504a5b2e292e317980443"
},
"nodes": [
{
"id": "7fd5ddfd-a858-4a0a-84b8-f8f4ec034d63",
"name": "数据标准化",
"type": "n8n-nodes-base.set",
"position": [
-60,
0
],
"parameters": {
"include": "except",
"options": {},
"assignments": {
"assignments": [
{
"id": "65d1994d-f4b8-478a-8cf1-490990e6639d",
"name": "user_data.phone",
"type": "string",
"value": "={{$json.user_data.phone.replace(/\\D/g, '').replace(/^0+/, '')}}"
},
{
"id": "5650546d-f0ad-4c69-829c-3e4283e16ac7",
"name": "event_time",
"type": "number",
"value": "={{Math.floor(new Date($json.event_time).getTime() / 1000)}}"
},
{
"id": "9475d631-348f-4d53-9e75-0d568654aeef",
"name": "user_data.first_name",
"type": "string",
"value": "={{$json.user_data.first_name}}"
},
{
"id": "77a8f321-abf9-4618-8fb2-ef5d567a9cd1",
"name": "user_data.last_name",
"type": "string",
"value": "={{$json.user_data.last_name}}"
}
]
},
"excludeFields": "user_data.name",
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "978d3854-44f6-4773-928e-4536a97a48b1",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-180,
-60
],
"parameters": {
"color": 7,
"width": 343,
"height": 252,
"content": "## 数据标准化"
},
"typeVersion": 1
},
{
"id": "feb4a686-278f-41d4-ab13-ba4fbc159ef6",
"name": "数据加密",
"type": "n8n-nodes-base.set",
"position": [
300,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "097ed7ff-c076-454e-930c-1f4820ac6e2e",
"name": "user_data.first_name",
"type": "string",
"value": "={{ $json.user_data.first_name.hash(\"sha256\") }}"
},
{
"id": "e285fa12-d272-48a0-a583-5e90b394fd74",
"name": "user_data.last_name",
"type": "string",
"value": "={{ $json.user_data.last_name.hash(\"sha256\") }}"
},
{
"id": "1e87a997-5b78-48d8-9616-edfb1b910743",
"name": "user_data.phone",
"type": "string",
"value": "={{ $json.user_data.phone.hash(\"sha256\") }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "1beb8a7c-0bce-489a-aea4-c2acb937601f",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
180,
-60
],
"parameters": {
"color": 7,
"width": 343,
"height": 252,
"content": "## 数据加密"
},
"typeVersion": 1
},
{
"id": "9f867c8b-fdc1-4294-b56e-12340c604111",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
680,
-220
],
"parameters": {
"color": 7,
"width": 375,
"height": 414,
"content": "## 发送事件"
},
"typeVersion": 1
},
{
"id": "c00c1fac-7550-4fa9-8fc9-e9f250519e6a",
"name": "向Meta发送事件",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
820,
20
],
"parameters": {
"edge": "events",
"node": "={{$('Format data').item.json.pixel_id}}",
"options": {
"queryParametersJson": "={\n \"data\": [\n {\n \"event_name\": \"{{ $('Encrypt data').item.json.event_name }}\",\n \"event_time\": {{ $('Encrypt data').item.json.event_time }},\n \"event_source_url\": \"{{ $('Encrypt data').item.json.event_source_url }}\",\n \"action_source\": \"{{ $('Encrypt data').item.json.action_source }}\",\n \"user_data\": {\n \"em\": \"{{ $('Encrypt data').item.json.user_data.email }}\",\n \"ph\": \"{{ $('Encrypt data').item.json.user_data.phone }}\",\n \"fn\": \"{{ $('Encrypt data').item.json.user_data.first_name }}\",\n \"ln\": \"{{ $('Encrypt data').item.json.user_data.last_name }}\",\n \"fbc\": \"{{ $('Encrypt data').item.json.user_data.fbp }}\",\n \"fbp\": \"{{ $('Encrypt data').item.json.user_data.fbc }}\",\n \"ip\": \"{{ $('Encrypt data').item.json.user_data.ip }}\",\n \"user_agent\": \"{{ $('Encrypt data').item.json.user_data.user_agent }}\"\n },\n \"custom_data\": {\n \"value\": {{ $('Encrypt data').item.json.custom_data.value }},\n \"currency\": \"{{ $('Encrypt data').item.json.custom_data.currency }}\"\n }\n }\n ],\n \"test_event_code\": \"TEST1337\"\n}\n"
},
"graphApiVersion": "=v20.0",
"httpRequestMethod": "POST"
},
"credentials": {
"facebookGraphApi": {
"id": "ThsFZDy4veCJfHRP",
"name": "Meta conversion api (WIJDANPROMO)"
}
},
"typeVersion": 1
},
{
"id": "5b486767-1ec1-4829-a556-ddc4f0c13f95",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
-1260,
-240
],
"webhookId": "b408defb-315d-4676-b4c4-1dcebe81ffc0",
"parameters": {
"path": "b408defb-315d-4676-b4c4-1dcebe81ffc0",
"options": {},
"httpMethod": [
"POST",
"GET"
],
"multipleMethods": true
},
"typeVersion": 2
},
{
"id": "8a8ee5fb-edf4-410c-b86c-a1b805a66319",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1160,
100
],
"parameters": {
"height": 220,
"content": "## 测试数据"
},
"typeVersion": 1
},
{
"id": "40240bfc-8e7b-4c5b-84e0-b8ccd52b097e",
"name": "测试数据",
"type": "n8n-nodes-base.code",
"position": [
-1100,
180
],
"parameters": {
"jsCode": "return {\n \"body\": {\n 'first_name': \"Alex\",\n 'last_name': \"Forbic\",\n 'phone': \"+116435562\",\n 'ip': \"16.115.243.190\",\n 'user_agent': \"Mozilla/5.0 (Linux; Android 14; SM-A065F Build/UP1A.231005.007; )\",\n 'fbp': \"fb.1.1750638230973.IwZXh0bgNhZW0BMABhZGlkAasgzcY0SboBHlIpXRPFXRua8Udfs9qnBwf4GN3xGWPk9HvipTCJeUYt8jaENcQyAm_TYaYITPrWtzJcJ8e38-CMQ\",\n 'fbc': \"fb.1.1750612363841.918837434857767253\",\n 'created_at': \"2025-06-18T15:24:06.000000Z\",\n 'amount': 120,\n 'currency': \"EUR\"\n }\n};"
},
"notesInFlow": true,
"typeVersion": 2
},
{
"id": "dbb5d646-4500-4ed9-89b6-607ebfc216d9",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1620,
80
],
"parameters": {
"height": 240,
"content": "## 测试工作流"
},
"typeVersion": 1
},
{
"id": "8473264d-fbad-4213-a0bf-84e7f841053e",
"name": "执行工作流",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1540,
180
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ad465243-cb30-492d-b77c-1066fec33c1b",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-220
],
"parameters": {
"color": 7,
"width": 340,
"height": 80,
"content": "## 在此处更改"
},
"typeVersion": 1
},
{
"id": "1b1c1cd5-ecfe-40d2-af82-1b0cc2b65e7c",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-120
],
"parameters": {
"color": 7,
"width": 343,
"height": 312,
"content": "## 收集数据"
},
"typeVersion": 1
},
{
"id": "63208dd1-6258-4630-9c3b-c8913cf04085",
"name": "格式化数据",
"type": "n8n-nodes-base.code",
"position": [
-520,
0
],
"parameters": {
"jsCode": "return [\n {\n json: {\n event_name: \"Purchase\",\n pixel_id:'1714041194725552', // you pixel ID\n user_data: {\n first_name: $input.first().json.body.first_name, // your customer first_name\n last_name: $input.first().json.body.last_name, // your customer last_name\n phone: $input.first().json.body.phone, // your customer phone\n ip: $input.first().json.body.ip, // your customer IP\n user_agent: $input.first().json.body.user_agent, // your customer User agent\n fbp: $input.first().json.body.fbp, // your customer fbp\n fbc: $input.first().json.body.fbc // your customer fbc\n },\n event_time: $input.first().json.body.created_at, // order Date like 2025-06-18T15:24:06.000000Z\n custom_data: {\n value: $input.first().json.body.amount, // pricing\n currency: $input.first().json.body.currency\n },\n action_source: \"website\",\n event_source_url: \"https://example.com/thanks\"\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "81bb1144-9e20-41d2-a611-c5f2422cba09",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
360
],
"parameters": {
"color": 4,
"width": 1700,
"height": 100,
"content": "## 需要更多帮助或有任何建议?"
},
"typeVersion": 1
},
{
"id": "a959b199-3d42-4a97-9c59-17cfa0b48124",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1620,
340
],
"parameters": {
"width": 700,
"height": 80,
"content": "## 仅用于测试"
},
"typeVersion": 1
},
{
"id": "541e0afe-1fd4-4c5e-a8e9-d7aa6f0e5832",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1300,
-320
],
"parameters": {
"color": 4,
"width": 200,
"height": 240,
"content": "## 生产环境"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Webhook": {
"main": [
[
{
"node": "Format data",
"type": "main",
"index": 0
}
]
]
},
"Test data": {
"main": [
[
{
"node": "Format data",
"type": "main",
"index": 0
}
]
]
},
"Format data": {
"main": [
[
{
"node": "Normalize data",
"type": "main",
"index": 0
}
]
]
},
"Encrypt data": {
"main": [
[
{
"node": "Send event to Meta",
"type": "main",
"index": 0
}
]
]
},
"Normalize data": {
"main": [
[
{
"node": "Encrypt data",
"type": "main",
"index": 0
}
]
]
},
"Execute workflow": {
"main": [
[
{
"node": "Test data",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
基于动态提示与Airtable的AI数据提取
通过动态提示与Airtable实现AI数据提取
Set
Code
Filter
+11
51 节点Jimleuk
人工智能
AI房地产经纪人:端到端运营自动化(网络、数据、语音)
AI房地产经纪人:端到端运营自动化(网络、数据、语音)
If
Set
Code
+16
45 节点Sam Yassine
销售
转录评估器
使用DeepGram和GPT-4o的音频对话分析与可视化
Set
Code
Html
+15
54 节点RealSimple Solutions
人工智能
自动化博客撰写与社交媒体推广代理
使用GPT-4、Perplexity和WordPress自动化SEO博客创建+社交媒体
Set
Code
Gmail
+21
79 节点LukaszB
设计
构建集成Azure搜索、Entra ID和Jira的AI IT支持助手
构建集成Azure搜索、Entra ID和Jira的AI IT支持助手
Set
Code
Webhook
+11
30 节点Adam Bertram
客户支持
呼叫中心分析(DeepSeek模型双AI验证)
使用DeepSeek模型进行双AI验证的呼叫中心分析
Code
Webhook
Http Request
+4
15 节点Omar Akoudad
客户关系管理
工作流信息
难度等级
高级
节点数量17
分类1
节点类型6
作者
Omar Akoudad
@mediaplusmaAutomation, Code, and Analytics for E-commerce businesses, We help businesses streamline operations using n8n, AI agents, and data science to enhance efficiency and scalability.
外部链接
在 n8n.io 查看 →
分享此工作流