Recap AI - Facebook広告クローンシステム

上級

これはContent Creation, Multimodal AI分野の自動化ワークフローで、18個のノードを含みます。主にIf, Set, Merge, Aggregate, FormTriggerなどのノードを使用。 Gemini AIとApifyを使って競合のFacebook広告をクローンし、カスタマイズ

前提条件
  • Google Drive API認証情報
  • ターゲットAPIの認証情報が必要な場合あり
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "qvBUGGr9hb1LlVuX",
  "meta": {
    "instanceId": "06e5009344f682419c20ccd4ecdcb5223bbb91761882af93ac6d468dbc2cbf8d",
    "templateCredsSetupCompleted": true
  },
  "name": "The Recap AI - Facebook Ad Cloning System",
  "tags": [],
  "nodes": [
    {
      "id": "02aa1570-98cc-4e51-8984-7078b67f8e69",
      "name": "form_trigger",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        224,
        224
      ],
      "webhookId": "739f6e4b-c69f-4baf-b6fe-f671f8ba6279",
      "parameters": {
        "options": {},
        "formTitle": "Facebook Ad Thief Form",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Facebook Ad Library Url",
              "placeholder": "https://www.facebook.com/",
              "requiredField": true
            },
            {
              "fieldType": "file",
              "fieldLabel": "Your Product Image",
              "multipleFiles": false,
              "requiredField": true
            }
          ]
        },
        "formDescription": "Upload your product image and submit a facebook ad library url for the ads you want to clone/spin for your produc.t"
      },
      "typeVersion": 2.2
    },
    {
      "id": "3b44e844-211b-435e-b559-b86f50c969bc",
      "name": "iterate_ads",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        224,
        448
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "a647a369-8233-4bf1-9fb4-12d40376672c",
      "name": "download_image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        864,
        464
      ],
      "parameters": {
        "url": "={{ $node['iterate_ads'].json.snapshot.cards.first().original_image_url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "01df58ea-a0b6-4282-ae66-681bc2dd3ace",
      "name": "convert_ad_image_to_base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1152,
        464
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "508fdd2d-1d9e-437b-83ea-a234eb755195",
      "name": "upload_ad_reference",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1152,
        288
      ],
      "parameters": {
        "name": "={{ $node['iterate_ads'].json.snapshot.cards.first().title }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "1HoXBHX3gvz5TxhczPwI0d5gWI3mxJT7h"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "PgwI1k1VFnoEhOi6",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "6145dd1e-1b1e-4acf-b41c-acdcbcc938d6",
      "name": "merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1424,
        448
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "a01db21f-c4b1-481b-a55b-31ede9b7814d",
      "name": "aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        224,
        704
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {}
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3b1c6a2e-eca8-494d-837a-3d09cc482c3d",
      "name": "get_image",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1424,
        720
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "image_result"
      },
      "typeVersion": 1.1
    },
    {
      "id": "2805dfd1-dce7-4d5d-86c9-dc3b925e9249",
      "name": "upload_image",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1712,
        784
      ],
      "parameters": {
        "name": "=Cloned Ad #{{ $runIndex + 1 }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "url",
          "value": "https://drive.google.com/drive/u/0/folders/1qY588PqswUfGTl3dZ_FbZhiDwK0Kv2Mz"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "PgwI1k1VFnoEhOi6",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "2e6a04de-1329-41bb-967a-73aade05fef8",
      "name": "set_result",
      "type": "n8n-nodes-base.set",
      "position": [
        1152,
        720
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "524da01b-f8b9-4c2c-9e28-319455903e4d",
              "name": "=image_result",
              "type": "string",
              "value": "={{ $json.candidates[0].content.parts.filter(item => item.inlineData).first().inlineData.data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "23c1e641-04d7-4540-8336-77b24c29007d",
      "name": "check_if_prohibited",
      "type": "n8n-nodes-base.if",
      "position": [
        864,
        704
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f46e65cf-d695-4e2e-a64c-be500cd788dd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.candidates.first().finishReason }}",
              "rightValue": "PROHIBITED_CONTENT"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d09e9817-e30f-4239-b105-e394e0b60d40",
      "name": "convert_product_image_to_base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        528,
        224
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery",
        "binaryPropertyName": "Your_Product_Image"
      },
      "typeVersion": 1
    },
    {
      "id": "f9af4c0e-e2d9-479a-a360-703407c0eba3",
      "name": "generate_ad_image_prompt",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        528,
        704
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [{\n    \"parts\": [\n      { \"text\": {{ JSON.stringify($json.prompt) }} },\n      {\n        \"inline_data\": {\n          \"mime_type\": \"image/png\",\n          \"data\": \"{{ $node['convert_product_image_to_base64'].json.data }}\"\n        }\n      },\n      {\n        \"inline_data\": {\n          \"mime_type\": \"image/jpeg\",\n          \"data\": \"{{ $node['convert_ad_image_to_base64'].json.data }}\"\n        }\n      }\n    ]\n  }]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "abcMckGk9RG9i0Ba",
          "name": "Google Gemini"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "43ae4270-b8d8-4d1d-9e30-024f5b0c1a17",
      "name": "generate_ad_image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        704,
        704
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [{\n    \"parts\": [\n      { \"text\": {{ JSON.stringify($json.candidates.first().content.parts.first().text) }} },\n      {\n        \"inline_data\": {\n          \"mime_type\": \"image/png\",\n          \"data\": \"{{ $node['convert_product_image_to_base64'].json.data }}\"\n        }\n      },\n      {\n        \"inline_data\": {\n          \"mime_type\": \"image/jpeg\",\n          \"data\": \"{{ $node['convert_ad_image_to_base64'].json.data }}\"\n        }\n      }\n    ]\n  }]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "abcMckGk9RG9i0Ba",
          "name": "Google Gemini"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "47fa9f9a-6699-4944-9ad0-531ad34b4ead",
      "name": "build_prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        368,
        704
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2fcf84d7-4a17-4899-9bea-a7d3b6027acd",
              "name": "prompt",
              "type": "string",
              "value": "You are an expert in image I need your help to write a perfect prompt that is going to help me generate/edit an image for my company's product called Thrive Mix. Attached to this request are two images: 1. Product picture of Thrive Mix (our product) 2. Reference image of the competitor's ad we're trying to replicate In your analysis of these images, I want you to come up with a plan and write a very detailed prompt on how we can clone and spin the ad from image number two (our competitor AG1) to make an identical ad that features our product with our packaging (ThriveMix) and image number one. We need to replicate the same style used on the AG1 competitor ad, but it should always be our packaging that's included. Some tricky edge cases you need to handle are: Partial branding items of the AG1 text (there can be text that says AG1, labels on products that say AG1, multiple products, multiple packages that are different from ours). Please check for all placements in the AG1 ad that need to be replaced. You need to figure out how to write a specific prompt that is going to detail this image generator how to replace it and create the ad for our product. The end result we're going for is a new ad that promotes our product ThriveMix. Make sure your prompt includes changes that need to be changed on the text of the image like labels and calls to action. It's possible that the source ad image for our competitor AG1 will have partial text on the product or packaging like \"A\", \"AG\", \"G, \"G\" (standalone), \"G1\", or some other partial text that needs to be checked for and analyzed in your plan. Keep the ad copy the same EXCEPT for switching \"AG1\" to \"ThriveMix\" to Think deeply about the prompt you are going to write."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1086bf1c-2495-45a2-93cf-2cefd2e51735",
      "name": "scrape_ads",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        864,
        224
      ],
      "parameters": {
        "memory": 512,
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "XtaWFhbtfxyzqrFmd",
          "cachedResultUrl": "https://console.apify.com/actors/XtaWFhbtfxyzqrFmd/input",
          "cachedResultName": "Facebook Ad Library Scraper (curious_coder/facebook-ads-library-scraper)"
        },
        "operation": "Run actor and get dataset",
        "customBody": "={\n    \"limitPerSource\": 20,\n    \"scrapeAdDetails\": false,\n    \"scrapePageAds.activeStatus\": \"all\",\n    \"scrapePageAds.countryCode\": \"ALL\",\n    \"urls\": [\n        {\n            \"url\": \"{{ $('form_trigger').item.json['Facebook Ad Library Url'] }}\",\n            \"method\": \"GET\"\n        }\n    ]\n}",
        "actorSource": "store",
        "authentication": "apifyOAuth2Api"
      },
      "credentials": {
        "apifyOAuth2Api": {
          "id": "H654WxAlFsyNy0MJ",
          "name": "Apify"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1041b268-c792-4c66-b4b4-18bc477fe4d5",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        96
      ],
      "parameters": {
        "color": 4,
        "width": 1792,
        "height": 960,
        "content": "## Nano Banana Facebook Ad Cloning System"
      },
      "typeVersion": 1
    },
    {
      "id": "24fb842b-4b2d-4c4b-85e3-67a9c2932e6a",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        96
      ],
      "parameters": {
        "width": 608,
        "height": 960,
        "content": "## Setup & Overview\n\nThis n8n template demonstrates how to automatically clone and adapt competitor Facebook ads for your own product using AI. Simply provide a Facebook Ad Library URL and your product image, and the workflow scrapes competitor ads, analyzes their design and messaging, then generates new versions featuring your product while maintaining the original ad's style and effectiveness.\n\n## Use cases\n* Adapt successful competitor ad creatives for your own products\n* Test proven ad formats without starting from scratch\n* Quickly produce multiple ad variations based on high-performing competitors\n* Scale ad creative production by leveraging competitor insights\n* A/B test different visual approaches inspired by market leaders\n\n## Good to know\n* The workflow processes up to 20 ads from the provided Facebook Ad Library URL\n* Gemini's image generation may occasionally flag content as prohibited (workflow handles this automatically)\n* Generated ads maintain the original style while swapping product branding and packaging\n* All competitor reference ads and generated clones are automatically saved to Google Drive\n* Image generation takes approximately 10-30 seconds per ad\n\n## How it works\n1. **Form Submission**: User submits a Facebook Ad Library URL and uploads their product image\n2. **Product Processing**: The product image is converted to base64 for AI processing\n3. **Ad Scraping**: Apify's Facebook Ad Library Scraper extracts up to 20 ads from the provided URL\n4. **Iteration Setup**: The workflow processes each scraped ad individually\n5. **Image Download**: Each competitor ad image is downloaded and converted to base64\n6. **Reference Storage**: Original competitor ads are uploaded to Google Drive for reference\n7. **Prompt Generation**: Gemini 2.5 Pro analyzes both images and creates detailed instructions for cloning the ad while replacing competitor branding with your product\n8. **Ad Generation**: Gemini 2.5 Flash Image Preview generates the new ad image based on the instructions\n9. **Content Filter**: Checks if generation was blocked for prohibited content\n10. **Upload & Loop**: Successfully generated ads are uploaded to Google Drive, then the workflow moves to the next ad\n\n## How to use\n1. Click the form trigger URL to access the submission form\n2. Enter a Facebook Ad Library URL (e.g., from a competitor's page showing active ads)\n3. Upload your product image with clear branding and packaging\n4. Submit the form and wait for processing to complete\n5. Find your cloned ads and reference images organized in Google Drive folders\n6. Review generated ads and select the best performers for your campaigns\n\n## Requirements\n* **Apify** account for Facebook Ad Library scraping\n* **Google Gemini API** account for ad analysis and image generation\n* **Google Drive** account for storing reference ads and generated clones\n* Valid Facebook Ad Library URL with accessible ads\n\n## Customizing this workflow\n* Adjust the **number of ads scraped** in the scrape_ads node (currently set to 20 per source)\n* Modify the **prompt instructions** in build_prompt node to emphasize different aspects (e.g., color schemes, layouts, text placement)\n* Change the **Google Drive folders** in upload_ad_reference and upload_image nodes to organize by campaign or product line\n* Add **text overlay generation** to include custom headlines or CTAs on generated images\n* Implement **quality scoring** to automatically filter and rank generated ad variations\n* Add **Slack/email notifications** when ad generation completes or fails\n* Include **metadata extraction** to capture ad copy and targeting insights from scraped adsRetryClaude does not have the ability to run the code it generates yet."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5e3b14f9-6688-444c-b973-43aaf9342aae",
  "connections": {
    "6145dd1e-1b1e-4acf-b41c-acdcbcc938d6": {
      "main": [
        [
          {
            "node": "a01db21f-c4b1-481b-a55b-31ede9b7814d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a01db21f-c4b1-481b-a55b-31ede9b7814d": {
      "main": [
        [
          {
            "node": "47fa9f9a-6699-4944-9ad0-531ad34b4ead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3b1c6a2e-eca8-494d-837a-3d09cc482c3d": {
      "main": [
        [
          {
            "node": "2805dfd1-dce7-4d5d-86c9-dc3b925e9249",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1086bf1c-2495-45a2-93cf-2cefd2e51735": {
      "main": [
        [
          {
            "node": "3b44e844-211b-435e-b559-b86f50c969bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2e6a04de-1329-41bb-967a-73aade05fef8": {
      "main": [
        [
          {
            "node": "3b1c6a2e-eca8-494d-837a-3d09cc482c3d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3b44e844-211b-435e-b559-b86f50c969bc": {
      "main": [
        [],
        [
          {
            "node": "a647a369-8233-4bf1-9fb4-12d40376672c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "47fa9f9a-6699-4944-9ad0-531ad34b4ead": {
      "main": [
        [
          {
            "node": "f9af4c0e-e2d9-479a-a360-703407c0eba3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "02aa1570-98cc-4e51-8984-7078b67f8e69": {
      "main": [
        [
          {
            "node": "d09e9817-e30f-4239-b105-e394e0b60d40",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2805dfd1-dce7-4d5d-86c9-dc3b925e9249": {
      "main": [
        [
          {
            "node": "3b44e844-211b-435e-b559-b86f50c969bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a647a369-8233-4bf1-9fb4-12d40376672c": {
      "main": [
        [
          {
            "node": "508fdd2d-1d9e-437b-83ea-a234eb755195",
            "type": "main",
            "index": 0
          },
          {
            "node": "01df58ea-a0b6-4282-ae66-681bc2dd3ace",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "43ae4270-b8d8-4d1d-9e30-024f5b0c1a17": {
      "main": [
        [
          {
            "node": "23c1e641-04d7-4540-8336-77b24c29007d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "23c1e641-04d7-4540-8336-77b24c29007d": {
      "main": [
        [
          {
            "node": "3b44e844-211b-435e-b559-b86f50c969bc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2e6a04de-1329-41bb-967a-73aade05fef8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "508fdd2d-1d9e-437b-83ea-a234eb755195": {
      "main": [
        [
          {
            "node": "6145dd1e-1b1e-4acf-b41c-acdcbcc938d6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f9af4c0e-e2d9-479a-a360-703407c0eba3": {
      "main": [
        [
          {
            "node": "43ae4270-b8d8-4d1d-9e30-024f5b0c1a17",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "01df58ea-a0b6-4282-ae66-681bc2dd3ace": {
      "main": [
        [
          {
            "node": "6145dd1e-1b1e-4acf-b41c-acdcbcc938d6",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "d09e9817-e30f-4239-b105-e394e0b60d40": {
      "main": [
        [
          {
            "node": "1086bf1c-2495-45a2-93cf-2cefd2e51735",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - コンテンツ作成, マルチモーダルAI

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

関連ワークフロー

WordPressブログの自動化プロフェッショナル版(先端研究)v2.1マーケットプラグイン
GPT-4o、Perplexity AI、そして多言語対応を使ったSEO最適化ブログ作成の自動化
If
Set
Xml
+
If
Set
Xml
125 ノードDaniel Ng
コンテンツ作成
OpenAI、ElevenLabs、Fal.ai を使用した動画・パ odcast・ASM R向けのウイルス性コンテンツ自動作成
OpenAI、ElevenLabs、そして Fal.ai を使って動画、ポッドキャスト、ASMR に向けたウイルスのコンテンツ作成を自動化
Set
Code
Wait
+
Set
Code
Wait
97 ノードAdam Crafts
コンテンツ作成
LinkedInおよびXウイルスのなコンテンツ自動エンジン
AIを使ってLinkedInとXにウイルスのなコンテンツを自動生成して公開する
If
Set
Wait
+
If
Set
Wait
156 ノードDiptamoy Barman
コンテンツ作成
家居装饰AI(Google Nano Banana)- Santhej Kallada
Google Geminiを基盤としたAI画像生成・編集およびTelegramボット
If
Set
Code
+
If
Set
Code
28 ノードSanthej Kallada
コンテンツ作成
OpenAIとFirecrawlを使って製品URLからAI生成のMeta広告キャンペーンを作成する
OpenAI と Firecrawl を使って製品 URL から AI 生成の Meta 広告キャンペーンを作成
If
Set
Code
+
If
Set
Code
40 ノードAdam Crafts
コンテンツ作成
オートメーション動画ジェネレーター
DeepSeek、TTS、Together.ai を使ってスクリプトから AI 動画を生成
Set
Code
Wait
+
Set
Code
Wait
81 ノードLakindu Siriwardana
コンテンツ作成
ワークフロー情報
難易度
上級
ノード数18
カテゴリー2
ノードタイプ12
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

作成者
Lucas Walter

Lucas Walter

@lucaswalter

Chief Automation Officer at The Recap AI. I build the AI systems and agents that power our business and teach others how to use n8n. Check out our YouTube channel linked below!

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34