11 监控社交媒体广告表现
高级
这是一个Market Research, AI Summarization领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Code, Gmail, McpClientTool 等节点。 使用 Bright Data MCP 监控社交媒体广告表现并发送告警
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
使用的节点 (19)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "UGLIZpcTDotxu1nV",
"meta": {
"instanceId": "60046904b104f0f72b2629a9d88fe9f676be4035769f1f08dad1dd38a76b9480",
"templateCredsSetupCompleted": true
},
"name": "11 监控社交媒体广告表现",
"tags": [],
"nodes": [
{
"id": "72af5a15-95d1-488b-a9a8-6eb31dc6eb4c",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
460,
240
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "8sEyPDkC5p4w4Jha",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "37046d2c-78fd-48fe-aa34-8151eadff9f0",
"name": "MCP 客户端",
"type": "n8n-nodes-mcp.mcpClientTool",
"position": [
600,
240
],
"parameters": {
"toolName": "scrape_as_markdown",
"operation": "executeTool",
"toolParameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}"
},
"credentials": {
"mcpClientApi": {
"id": "eqq94k789oJCd6jU",
"name": "MCP Client (STDIO) account"
}
},
"typeVersion": 1
},
{
"id": "ee246d60-83c9-45bb-9537-65bc2054c561",
"name": "🔁 每小时检查广告",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
0,
0
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "1ea00dae-2733-42af-8ad3-7560210a214d",
"name": "📥 设置 Facebook 广告仪表板 URL",
"type": "n8n-nodes-base.set",
"position": [
220,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "25ed5a8d-5316-493e-aa16-d93b1dfa9ba8",
"name": "url",
"type": "string",
"value": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=US&q=nike&sort_data[direction]=desc&sort_data[mode]=relevancy_monthly_grouped"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "61aceca9-5347-462f-b037-b0f89db55f87",
"name": "🧠 通过 MCP Agent 抓取广告",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
480,
0
],
"parameters": {
"text": "=scrape the data from the from facebook ads dashboard:\n{{ $json.url }}",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2
},
{
"id": "5ce15013-60bf-41b2-afa3-bfbdc014c007",
"name": "🔄 每次返回一个广告",
"type": "n8n-nodes-base.code",
"position": [
920,
0
],
"parameters": {
"jsCode": "// Input: full JSON from agent, stored in $json\n// Assumes: $json.ads is an array of ad objects\n\nconst ads = $json.ads;\n\n// Return only the first ad\nif (ads && ads.length > 0) {\n return [ads[0]];\n} else {\n return []; // no ads found\n}\n"
},
"typeVersion": 2
},
{
"id": "c4f10143-aac8-44c9-b02f-9c6262d5a442",
"name": "🚨 广告表现不佳吗?",
"type": "n8n-nodes-base.if",
"position": [
1100,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bc9e2914-a4df-4a01-a093-a788dff98603",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $json.estimated_ctr }}",
"rightValue": 1
},
{
"id": "aa6b27ad-9603-486d-b063-12712082c555",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.estimated_cpa }}",
"rightValue": 10
}
]
}
},
"typeVersion": 2.2
},
{
"id": "7d6e60e6-4d6a-4fc8-a63b-0b301d6ebf10",
"name": "📬 发送警报邮件",
"type": "n8n-nodes-base.gmail",
"position": [
1440,
-100
],
"webhookId": "77e871d3-d676-4447-8d85-4c6e57f413c2",
"parameters": {
"sendTo": "shahkar.genai@gmail.com",
"message": "=<h2>📉 Ad Alert: Performance Below Threshold</h2><p><strong>Ad Title:</strong> {{$json.ad_title}}</p><p><strong>Status:</strong> {{$json.status}}</p><p><strong>Estimated CTR:</strong> {{$json.estimated_ctr}}%</p><p><strong>Estimated CPA:</strong> ${{$json.estimated_cpa}}</p><p><strong>Start Date:</strong> {{$json.start_date}}</p><p><strong>Platforms:</strong> {{$json.platforms.join(', ')}}</p><p><strong>Ad Text:</strong><br>{{$json.ad_text}}</p><p><a href='{{$json.media_url}}'>View Media</a></p>",
"options": {},
"subject": "🚨 Underperforming Ad Detected"
},
"credentials": {
"gmailOAuth2": {
"id": "AQDSl75AdzK3vmqJ",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "ec09018c-78e8-4c08-935b-d98e7b23ecbe",
"name": "✅ 不执行操作(广告正常)",
"type": "n8n-nodes-base.noOp",
"position": [
1440,
100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f5749714-9f5b-4230-9314-68555ce76171",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-60,
-700
],
"parameters": {
"color": 2,
"width": 420,
"height": 880,
"content": "## 🧩 第一部分:**触发器与输入设置**"
},
"typeVersion": 1
},
{
"id": "a4fc03cf-b7a2-4612-aeab-c17ac3069486",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
440,
-1080
],
"parameters": {
"color": 5,
"width": 320,
"height": 1260,
"content": "## 🤖 第二部分:**通过AI Agent抓取广告(Bright Data MCP)**"
},
"typeVersion": 1
},
{
"id": "79a75c43-404f-426c-bbc5-c3ea755cde3f",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
-920
],
"parameters": {
"color": 6,
"width": 340,
"height": 1100,
"content": "## 🔎 第三部分:**处理单个广告并检查是否表现不佳**"
},
"typeVersion": 1
},
{
"id": "7b51b10e-00d7-42d9-b699-d28732f04943",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1360,
-1040
],
"parameters": {
"color": 3,
"width": 280,
"height": 1280,
"content": "## 📬 第四部分:**根据广告质量采取行动**"
},
"typeVersion": 1
},
{
"id": "a496134d-ecc0-4f90-bdd9-0e0cd102794d",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1960,
-680
],
"parameters": {
"color": 4,
"width": 1300,
"height": 320,
"content": "======================================="
},
"typeVersion": 1
},
{
"id": "4652568e-1bcc-4ba8-bcaa-79043084b1a3",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1960,
-340
],
"parameters": {
"color": 4,
"width": 1289,
"height": 2778,
"content": "# 🚨 智能广告监控:自动抓取Facebook广告并在表现不佳时发送警报(通过Bright Data MCP)"
},
"typeVersion": 1
},
{
"id": "9bf1083f-82d7-4a5d-8006-b160e97ca7a9",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1720,
-1040
],
"parameters": {
"color": 7,
"width": 380,
"height": 240,
"content": "## 如果您通过此链接加入Bright Data,我将获得少量佣金——感谢您支持更多免费内容!"
},
"typeVersion": 1
},
{
"id": "58f73834-e35a-42d3-9385-76ee106eeb1d",
"name": "自动修复输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
"position": [
740,
240
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "4337a0cc-b008-494b-ae51-ada351830438",
"name": "OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
700,
460
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "8sEyPDkC5p4w4Jha",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "df736167-a084-49b2-bca8-1e9b12862f79",
"name": "结构化输出解析器1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
880,
460
],
"parameters": {
"jsonSchemaExample": "{\n \"ads\": [\n {\n \"ad_id\": \"1234567890\",\n \"advertiser\": \"Nike\",\n \"ad_title\": \"Just Do It - Air Max 2025\",\n \"platforms\": [\"Facebook\", \"Instagram\"],\n \"status\": \"Active\",\n \"start_date\": \"2025-06-25\",\n \"ad_text\": \"Feel the future. Experience Air Max like never before.\",\n \"media_type\": \"Image\",\n \"media_url\": \"https://example.com/ad1.jpg\",\n \"impressions\": 150000,\n \"engagement\": {\n \"likes\": 1200,\n \"shares\": 300,\n \"comments\": 220\n },\n \"estimated_ctr\": 0.85,\n \"estimated_cpa\": 11.20\n },\n {\n \"ad_id\": \"0987654321\",\n \"advertiser\": \"Nike\",\n \"ad_title\": \"Nike Running Club Promo\",\n \"platforms\": [\"Facebook\"],\n \"status\": \"Active\",\n \"start_date\": \"2025-06-20\",\n \"ad_text\": \"Join the Nike Running Club and push your limits.\",\n \"media_type\": \"Video\",\n \"media_url\": \"https://example.com/ad2.mp4\",\n \"impressions\": 80000,\n \"engagement\": {\n \"likes\": 600,\n \"shares\": 80,\n \"comments\": 95\n },\n \"estimated_ctr\": 0.45,\n \"estimated_cpa\": 15.90\n },\n {\n \"ad_id\": \"1122334455\",\n \"advertiser\": \"Nike\",\n \"ad_title\": \"Summer Sale – Up to 40% Off!\",\n \"platforms\": [\"Messenger\", \"Instagram\"],\n \"status\": \"Inactive\",\n \"start_date\": \"2025-06-10\",\n \"ad_text\": \"Heat up your summer with big savings on Nike gear.\",\n \"media_type\": \"Image\",\n \"media_url\": \"https://example.com/ad3.jpg\",\n \"impressions\": 200000,\n \"engagement\": {\n \"likes\": 1900,\n \"shares\": 410,\n \"comments\": 350\n },\n \"estimated_ctr\": 1.20,\n \"estimated_cpa\": 7.60\n }\n ],\n \"scraped_at\": \"2025-06-30T20:50:00Z\"\n}\n"
},
"typeVersion": 1.2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "9cafbbb6-0fe7-4384-ac97-e1d781957885",
"connections": {
"MCP Client": {
"ai_tool": [
[
{
"node": "🧠 Scrape Ads via MCP Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "🧠 Scrape Ads via MCP Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Auto-fixing Output Parser",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Auto-fixing Output Parser": {
"ai_outputParser": [
[
{
"node": "🧠 Scrape Ads via MCP Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Structured Output Parser1": {
"ai_outputParser": [
[
{
"node": "Auto-fixing Output Parser",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"🔁 Check Ads Every Hour": {
"main": [
[
{
"node": "📥 Set facebook ad dashboard URL",
"type": "main",
"index": 0
}
]
]
},
"🚨 Is Ad Underperforming?": {
"main": [
[
{
"node": "📬 Send Alert Email",
"type": "main",
"index": 0
}
],
[
{
"node": "✅ Do Nothing (Ad is OK)",
"type": "main",
"index": 0
}
]
]
},
"🔄 Return One Ad at a Time": {
"main": [
[
{
"node": "🚨 Is Ad Underperforming?",
"type": "main",
"index": 0
}
]
]
},
"🧠 Scrape Ads via MCP Agent": {
"main": [
[
{
"node": "🔄 Return One Ad at a Time",
"type": "main",
"index": 0
}
]
]
},
"📥 Set facebook ad dashboard URL": {
"main": [
[
{
"node": "🧠 Scrape Ads via MCP Agent",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 市场调研, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
23 分析客户终身价值
使用GPT-4和Bright Data MCP分析与定位高价值客户
If
Set
Code
+9
20 节点Yaron Been
市场调研
22 监控流失指标
使用Bright Data MCP和OpenAI监控客户流失指标
If
Set
Code
+10
20 节点Yaron Been
客户关系管理
4跟踪竞争对手网站更新
使用Bright Data MCP和OpenAI的自动竞争对手价格监控
If
Set
Google Sheets
+8
18 节点Yaron Been
市场调研
16 监控竞争对手定价
基于Bright Data MCP和Google表格的竞争对手定价自动监控
Set
Code
Gmail
+8
18 节点Yaron Been
市场调研
竞争对手产品发布监控
基于Bright Data和OpenAI的即时竞争对手产品发布监控,发送至邮箱/表格
Set
Code
Gmail
+8
18 节点Yaron Been
市场调研
15 个追踪反向链接机会
使用 Bright Data MCP 和 GPT-4o 追踪并分析反向链接机会
If
Set
Gmail
+9
19 节点Yaron Been
市场调研
工作流信息
难度等级
高级
节点数量19
分类2
节点类型12
作者
Yaron Been
@yaron-nofluffBuilding AI Agents and Automations | Growth Marketer | Entrepreneur | Book Author & Podcast Host If you need any help with Automations, feel free to reach out via linkedin: https://www.linkedin.com/in/yaronbeen/ And check out my Youtube channel: https://www.youtube.com/@YaronBeen/videos
外部链接
在 n8n.io 查看 →
分享此工作流