Skip to content
Marketing

AI Facebook Ad Image Generation from Drive References

17 nodes 39 4 Manual trigger
Download

Loading workflow…

Workflow Description

A manually triggered workflow reads reference ad images and product images from two hardcoded Google Drive folders, analyzes them with GPT-4o to extract ad style principles and product emotions, merges both analyses, then an AI agent with a structured output parser generates ten image prompts. Each prompt loops through a 15-second wait, calls the OpenAI image generation API (gpt-image-1, 1024x1024), converts the base64 result to a PNG file, and uploads it to a target Drive folder.

How it works

  1. 1.Lists and downloads files from the inspiration folder and product folder in Google Drive.
  2. 2.GPT-4o analyzes inspiration images for reusable static ad style principles and product images for core emotions and product identity.
  3. 3.A third OpenAI node combines both analyses into a single prompt making the product the hero.
  4. 4.An AI agent with a GPT-4 chat model and structured output parser produces ten JSON-formatted image prompts that Split Out separates.
  5. 5.Loop Over Items routes each prompt through a 15-second Wait node then a POST to api.openai.com/v1/images/generations.
  6. 6.Convert to File turns data[0].b64_json into image.png, Google Drive4 uploads it, and the loop returns for the next item.

Use cases

  • Batch-generating 1:1 static Facebook/Instagram ad creatives featuring a specific product.
  • Turning a swipe file of high-performing ads into reusable style templates applied to new products.

Requirements

  • Google Drive OAuth2 credentials with read access to both source folders and write access to the output folder.
  • A single OpenAiApi credential covering GPT-4o, GPT-4, and gpt-image-1 with sufficient credit for ten images per run.
  • Replacing the three hardcoded Drive folder IDs with your own folder identifiers.

Setup and testing in n8n

  1. Run manually and confirm both Drive listings and both GPT-4o analyses return content.
  2. Verify the agent emits valid JSON with ten unique prompts before Split Out.
  3. Check the target Drive folder for the ten generated PNG files and inspect the OpenAI API usage for errors.

Service Value

Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.

Apps Used

Manual Trigger Google Drive OpenAI AI Agent Output Parser Split Out HTTP Request Split In Batches Wait Convert To File

Details

Trigger Manual trigger
Nodes 17
Apps 10
Views 39
Downloads 4

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (17)

/

When clicking ‘Test workflow’

Manual Trigger

#1

Google Drive

Google Drive

#2

Google Drive1

Google Drive

#3

OpenAI

OpenAI

#4

Google Drive2

Google Drive

#5

Google Drive3

Google Drive

#6

OpenAI1

OpenAI

#7

OpenAI Chat Model

OpenAI

#8

AI prompt agent

Agent

#9

Structured Output Parser

Output Parser Structured

#10

Split Out

Split Out

#11

HTTP Request1

HTTP Request

#12

Loop Over Items1

Split In Batches

#13

Wait

Wait

#14

Convert to File

Convert To File

#15

OpenAI2

OpenAI

#16

Google Drive4

Google Drive

#17

Source and license

Sticky Note

#18
Stay in the loop

Fresh workflows, straight to your inbox

Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.

  • New workflows
  • Clear overviews
  • Setup guides

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime