This workflow corresponds to n8n.io template #4684 — we link there as the canonical source.
This workflow follows the Agent → Facebookgraphapi recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "HSkxJKrT4lRkab16",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Analyze Meta Ads, Create Ad Texts & Upload Image & Video Ads to Meta Ads Manager",
"tags": [],
"nodes": [
{
"id": "6205a675-8533-458b-a0db-1298740d5161",
"name": "Upload Ad Video",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
2340,
1980
],
"parameters": {},
"typeVersion": 1
},
{
"id": "fe523d79-a5c5-43d4-a6b0-e89c190d9007",
"name": "Get Video Preview Image",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
2740,
1980
],
"parameters": {},
"typeVersion": 1
},
{
"id": "49f08c36-3494-4304-8542-67ff1deb244e",
"name": "Analyze Video with Gemini",
"type": "n8n-nodes-base.httpRequest",
"position": [
2740,
1020
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "c638cf41-7820-4bf0-a253-dd9387a5ed32",
"name": "Gemini - Generate Upload URL",
"type": "n8n-nodes-base.httpRequest",
"position": [
1300,
1120
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "4025ddce-afd4-4526-9a94-b59cbaa5837a",
"name": "Gemini - Upload File",
"type": "n8n-nodes-base.httpRequest",
"position": [
1720,
1120
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "c116efd1-ac34-46bd-ae31-4650cc369f25",
"name": "Download from Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
1520,
1120
],
"parameters": {},
"typeVersion": 3
},
{
"id": "cd25f2c2-5697-44d7-919b-1ef23505d124",
"name": "Create Asset",
"type": "n8n-nodes-base.googleSheets",
"position": [
2380,
780
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "55aae2bf-e57b-4e06-baca-9ca3ca99d8b5",
"name": "Get All Rows",
"type": "n8n-nodes-base.googleSheets",
"position": [
2640,
780
],
"parameters": {},
"executeOnce": true,
"typeVersion": 4.5
},
{
"id": "5dc2e330-814b-43c7-9228-7c412a4bd4a3",
"name": "AI Description is Empty",
"type": "n8n-nodes-base.filter",
"position": [
2880,
780
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "b402bfd8-7e64-4220-b5e8-7e88b765d896",
"name": "Check State",
"type": "n8n-nodes-base.httpRequest",
"position": [
2340,
1120
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "e81071cf-e86a-42f0-ac80-13432e6b2097",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
2540,
1120
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "0719ebaf-3c86-4d46-b5f3-9ed00c53936e",
"name": "Wait 2 Seconds",
"type": "n8n-nodes-base.wait",
"position": [
2720,
1220
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "110d630e-0e17-42b9-998a-a224fa844b54",
"name": "Wait 3 Seconds",
"type": "n8n-nodes-base.wait",
"position": [
2140,
1120
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "48520a4b-7a8b-41e5-8c43-329c20870bc9",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
2960,
1020
],
"parameters": {},
"typeVersion": 1.8
},
{
"id": "57fa5985-8551-42a6-bd47-9519589a3bf7",
"name": "Video or Image",
"type": "n8n-nodes-base.switch",
"position": [
3300,
780
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "649afa30-f30a-4c09-94ed-923f34515fd8",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2940,
1220
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "ab605d41-39a5-4a97-ab2f-8b1b52a5d846",
"name": "Get File Metadata",
"type": "n8n-nodes-base.httpRequest",
"position": [
3100,
780
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "e571a88e-ca16-4572-ad6c-62f068504fb1",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
3160,
1220
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "29dc39cb-f783-4f94-868e-e5e6a40a73b2",
"name": "Get Ads to Process",
"type": "n8n-nodes-base.googleSheets",
"position": [
1260,
2020
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "7d39fa34-bca9-45f1-b88f-76480317de39",
"name": "Get Settings",
"type": "n8n-nodes-base.googleSheets",
"position": [
1260,
2300
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "304aafc4-5bd0-44f5-b20e-a38e5baefa75",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
1720,
2160
],
"parameters": {},
"typeVersion": 3.1
},
{
"id": "618ec524-d237-4495-8a51-0333069784e3",
"name": "AI Agent1",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
2960,
1440
],
"parameters": {},
"typeVersion": 1.8
},
{
"id": "b56d7a32-7772-48ec-bf20-dbc8709484ab",
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
1300,
1440
],
"parameters": {},
"typeVersion": 3
},
{
"id": "6a63d1f4-4e33-4cb5-ac02-7b73c9c7e216",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2940,
1660
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "d24b46b8-2dfe-4979-a678-5f43e23491ec",
"name": "Structured Output Parser1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
3160,
1660
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "655d8706-a92c-4ad7-8b07-0bf14ce3febf",
"name": "When clicking \u2018Test workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
920,
2140
],
"parameters": {},
"typeVersion": 1
},
{
"id": "4ad90a98-acbc-4866-a51a-4d11d7a3a44e",
"name": "Get Video",
"type": "n8n-nodes-base.httpRequest",
"position": [
2160,
1980
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "f02961b4-328a-4b5f-9d99-6ea5be623123",
"name": "Wait",
"type": "n8n-nodes-base.wait",
"position": [
2540,
1980
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "e7f640d3-b382-4076-895b-3482bce6bee6",
"name": "Video or Image Asset",
"type": "n8n-nodes-base.switch",
"position": [
1900,
2160
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "7133563d-7b1a-4ad2-94b8-92e09c1bf7dd",
"name": "Facebook Graph API",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
3800,
2280
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6b07b2cd-a0cd-494d-9243-0f3ebe836830",
"name": "Get image 1",
"type": "n8n-nodes-base.httpRequest",
"position": [
2160,
2280
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "783616dd-ddae-459a-b01b-381c0616812f",
"name": "Get image ",
"type": "n8n-nodes-base.httpRequest",
"position": [
2800,
2200
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "dae5668c-4be2-4a19-800f-83d7b63e1518",
"name": "Google Drive Folder Updated",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
1260,
780
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9b6145e0-3fd8-4664-a9dc-297f7d949191",
"name": "Fetch All Files",
"type": "n8n-nodes-base.googleDrive",
"position": [
1520,
780
],
"parameters": {},
"typeVersion": 3
},
{
"id": "d3566142-d98e-47dc-a0a1-74a0be61170f",
"name": "Get Files Metadata",
"type": "n8n-nodes-base.httpRequest",
"position": [
1780,
780
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "5135bbca-2715-401c-9019-5b21b1b76362",
"name": "Extract File Specs",
"type": "n8n-nodes-base.set",
"position": [
2060,
780
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "75a91825-ea89-461c-85e5-77a2a6736dee",
"name": "Save Video Analysis Output",
"type": "n8n-nodes-base.googleSheets",
"position": [
3320,
1020
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "367910e1-f247-4bcd-8ba3-e65afd3ac731",
"name": "Save Image Analysis Output",
"type": "n8n-nodes-base.googleSheets",
"position": [
3340,
1440
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "d730546f-874b-4f85-882b-415f201f3941",
"name": "Filter Unprocessed Ads",
"type": "n8n-nodes-base.filter",
"position": [
1480,
2020
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "485afc5d-4490-44a1-b25a-d87b21f1fe04",
"name": "Create Video Ad Creative",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
2960,
1980
],
"parameters": {},
"typeVersion": 1
},
{
"id": "31fc206d-3f57-4c40-a24e-8299bbd6e452",
"name": "Create Video Ad",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
3580,
1980
],
"parameters": {},
"typeVersion": 1
},
{
"id": "51e84264-cd4a-4385-be69-ee11ae4429d5",
"name": "Save Video Ad Details",
"type": "n8n-nodes-base.googleSheets",
"position": [
4120,
1980
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "cb41025e-e1e0-454c-93b5-a36eba57dba5",
"name": "Check if two or one image",
"type": "n8n-nodes-base.if",
"position": [
2560,
2280
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "73757cd6-9a2c-4bc5-8842-f92177a31cd3",
"name": "Upload Ad Image",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
2340,
2280
],
"parameters": {},
"typeVersion": 1
},
{
"id": "93f5be7e-8a94-4aaa-8e65-e2316e7bc15a",
"name": "Create Multiple Image Creative",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
3240,
2200
],
"parameters": {},
"typeVersion": 1
},
{
"id": "49efc025-f772-4669-96c7-a9ed4b2dca63",
"name": "Create Image Creative",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
3000,
2520
],
"parameters": {},
"typeVersion": 1
},
{
"id": "d7fe1213-3db6-47b3-ac69-debc873c79e0",
"name": "Upload Second Ad Image",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
3020,
2200
],
"parameters": {},
"typeVersion": 1
},
{
"id": "4887b86c-c0be-4810-90ff-0a5be4a07b71",
"name": "Create Image Ad",
"type": "n8n-nodes-base.facebookGraphApi",
"position": [
3580,
2280
],
"parameters": {},
"typeVersion": 1
},
{
"id": "77f3371f-b818-4bf0-9381-126aa374f453",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1260,
660
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "92a00fa1-89be-45e0-9055-189ac0479114",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
2380,
660
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "c064fecd-9d51-4839-bf86-9134b12102c4",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
3500,
1100
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "f27867dc-13f3-4d7a-8a5b-04776c6389ff",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
3520,
1520
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "cc280912-6f45-4836-8c22-edd471c13ec8",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
4080,
1880
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "225cde15-4ded-41b1-a6ea-b40ea1c9e961",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
4080,
2460
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "9875016f-c878-4215-ba17-a350d8fa26e6",
"name": "Save Image Ad Details",
"type": "n8n-nodes-base.googleSheets",
"position": [
4120,
2280
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "72d1819a-b983-4f0c-afc2-1f83baf6416f",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1220,
2460
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "79292ebc-98f7-4acb-aca7-01d641091301",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
1220,
1920
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "bb4afb0c-97cb-41db-a42d-44c10aed33f3",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
680,
660
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "729d2f7e-4e14-4c91-8fa5-1d42eef3923c",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
2900,
1340
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "82abdc96-707e-4a9f-8717-217dc583c06f",
"name": "Sticky Note10",
"type": "n8n-nodes-base.stickyNote",
"position": [
2900,
1780
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "051d9a9f-d786-4188-91a5-0f33cf8dba24",
"name": "Sticky Note11",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
1940
],
"parameters": {
"content": ""
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "7ec4840f-4712-4879-b777-fa11bb265770",
"connections": {
"If": {
"main": [
[
{
"node": "Analyze Video with Gemini",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait 2 Seconds",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Get Video Preview Image",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Video or Image Asset",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Save Video Analysis Output",
"type": "main",
"index": 0
}
]
]
},
"AI Agent1": {
"main": [
[
{
"node": "Save Image Analysis Output",
"type": "main",
"index": 0
}
]
]
},
"Get Video": {
"main": [
[
{
"node": "Upload Ad Video",
"type": "main",
"index": 0
}
]
]
},
"Get image ": {
"main": [
[
{
"node": "Upload Second Ad Image",
"type": "main",
"index": 0
}
]
]
},
"Check State": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Get image 1": {
"main": [
[
{
"node": "Upload Ad Image",
"type": "main",
"index": 0
}
]
]
},
"Create Asset": {
"main": [
[
{
"node": "Get All Rows",
"type": "main",
"index": 0
}
]
]
},
"Get All Rows": {
"main": [
[
{
"node": "AI Description is Empty",
"type": "main",
"index": 0
}
]
]
},
"Get Settings": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Google Drive": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
},
"Video or Image": {
"main": [
[
{
"node": "Gemini - Generate Upload URL",
"type": "main",
"index": 0
}
],
[
{
"node": "Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Wait 2 Seconds": {
"main": [
[
{
"node": "Check State",
"type": "main",
"index": 0
}
]
]
},
"Wait 3 Seconds": {
"main": [
[
{
"node": "Check State",
"type": "main",
"index": 0
}
]
]
},
"Create Image Ad": {
"main": [
[
{
"node": "Facebook Graph API",
"type": "main",
"index": 0
}
]
]
},
"Create Video Ad": {
"main": [
[
{
"node": "Save Video Ad Details",
"type": "main",
"index": 0
}
]
]
},
"Fetch All Files": {
"main": [
[
{
"node": "Get Files Metadata",
"type": "main",
"index": 0
}
]
]
},
"Upload Ad Image": {
"main": [
[
{
"node": "Check if two or one image",
"type": "main",
"index": 0
}
]
]
},
"Upload Ad Video": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Get File Metadata": {
"main": [
[
{
"node": "Video or Image",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Extract File Specs": {
"main": [
[
{
"node": "Create Asset",
"type": "main",
"index": 0
}
]
]
},
"Facebook Graph API": {
"main": [
[
{
"node": "Save Image Ad Details",
"type": "main",
"index": 0
}
]
]
},
"Get Ads to Process": {
"main": [
[
{
"node": "Filter Unprocessed Ads",
"type": "main",
"index": 0
}
]
]
},
"Get Files Metadata": {
"main": [
[
{
"node": "Extract File Specs",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Gemini - Upload File": {
"main": [
[
{
"node": "Wait 3 Seconds",
"type": "main",
"index": 0
}
]
]
},
"Video or Image Asset": {
"main": [
[
{
"node": "Get Video",
"type": "main",
"index": 0
}
],
[
{
"node": "Get image 1",
"type": "main",
"index": 0
}
]
]
},
"Create Image Creative": {
"main": [
[
{
"node": "Create Image Ad",
"type": "main",
"index": 0
}
]
]
},
"Filter Unprocessed Ads": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Upload Second Ad Image": {
"main": [
[
{
"node": "Create Multiple Image Creative",
"type": "main",
"index": 0
}
]
]
},
"AI Description is Empty": {
"main": [
[
{
"node": "Get File Metadata",
"type": "main",
"index": 0
}
]
]
},
"Get Video Preview Image": {
"main": [
[
{
"node": "Create Video Ad Creative",
"type": "main",
"index": 0
}
]
]
},
"Create Video Ad Creative": {
"main": [
[
{
"node": "Create Video Ad",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Analyze Video with Gemini": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Check if two or one image": {
"main": [
[
{
"node": "Get image ",
"type": "main",
"index": 0
}
],
[
{
"node": "Create Image Creative",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser1": {
"ai_outputParser": [
[
{
"node": "AI Agent1",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Download from Google Drive": {
"main": [
[
{
"node": "Gemini - Upload File",
"type": "main",
"index": 0
}
]
]
},
"Google Drive Folder Updated": {
"main": [
[
{
"node": "Fetch All Files",
"type": "main",
"index": 0
}
]
]
},
"Gemini - Generate Upload URL": {
"main": [
[
{
"node": "Download from Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Create Multiple Image Creative": {
"main": [
[
{
"node": "Create Image Ad",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Test workflow\u2019": {
"main": [
[
{
"node": "Get Ads to Process",
"type": "main",
"index": 0
},
{
"node": "Get Settings",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This comprehensive n8n workflow automates the entire Meta (Facebook/Instagram) advertising process, from asset analysis to ad creation. It combines AI-powered content analysis with automated ad deployment, streamlining the creation of high-converting social media advertisements.
Source: https://n8n.io/workflows/4684/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.
Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.
This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste
💥 Automate video ads with NanoBanana, Seedream 4, ChatGPT Image and Veo 3 - VIDE. Uses telegram, telegramTrigger, googleDrive, agent. Event-driven trigger; 63 nodes.
This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.