Generate and Auto-Evaluate Facebook Ad Headlines using GPT-4o-mini

Last edited 58 days ago

Generate and Auto-Evaluate Facebook Ad Headlines using GPT-4o-mini

Built with n8n + OpenAI

This workflow captures a product description, generates ad headlines, evaluates them with custom criteria, decides whether another draft is needed, and finally sends the best version via Gmail.


⚡ Section 1: Capture the Brief & Build the Prompt

  • 📝 FormTrigger_CopywritingBrief → A simple form asks: “What is your product about?”
  • ⚙️ Set_PromptForHeadline → Prepares the input by appending the instruction:
    “Write a Facebook ad headline for this product:”

Benefit: Ensures consistent, structured prompts so the AI receives clear context every time.


✍️ Section 2: Draft the Headline

  • 💬 LLM_HeadlineWriterModel → GPT-4o-mini model provides the intelligence.
  • ✍️ Agent_HeadlineWriter → Generates a first-pass Facebook ad headline.

Benefit: Produces creative copy instantly without waiting on a human writer.


📋 Section 3: Define Scoring Criteria

  • 💬 LLM_EvalCriteriaModel → Calls GPT-4o-mini again.
  • 📑 Agent_EvalCriteriaBuilder → Suggests 5 scoring parameters (scale 1-10).
    Example: Clarity, Relevance, Hook Strength, Brand Voice, Scroll-Stoppage.

Benefit: Builds an objective, repeatable evaluation rubric automatically.


🔍 Section 4: Evaluate the Headline

  • 💬 LLM_HeadlineEvaluatorModel → Supplies reasoning power.

  • 🔍 Agent_HeadlineEvaluator → Applies the 5 criteria to the generated headline and outputs:

    • JSON with scores per parameter
    • An average score
    • A plain-language bottom-line

Benefit: Turns subjective copy quality into measurable numbers.


🔄 Section 5: Decide & Iterate (if needed)

  • 💬 LLM_BottomLineModel → Interprets the evaluation results.

  • 🤔 Agent_IterationDecision → Decides:

    • Return NO → headline is acceptable.
    • Return YES + feedback → headline should be rewritten.
  • 🔀 If_NeedMoreIterations → Branches:

    • If NO → continue workflow.
    • If YES → (loop wiring possible) headline can be regenerated with feedback.

Benefit: Keeps iterating until the AI headline meets your standards.


📩 Section 6: Deliver the Result

  • 📧 Send a message (Gmail node) → Sends the accepted headline via email.

Benefit: Automates delivery of the polished, AI-approved headline to your inbox or team.


📊 Workflow Overview

Section

Purpose

Key Nodes

Benefit

⚡ Capture Brief

Collect product info & prep prompt

FormTrigger, Set

Structured AI input

✍️ Draft Headline

Generate first headline

LLM_HeadlineWriterModel, Agent_HeadlineWriter

Instant creative draft

📋 Define Criteria

Build scoring rubric

LLM_EvalCriteriaModel, Agent_EvalCriteriaBuilder

Objective evaluation

🔍 Evaluate Headline

Score headline & summarize

LLM_HeadlineEvaluatorModel, Agent_HeadlineEvaluator

Transparent quality check

🔄 Decide & Iterate

Accept or refine headline

LLM_BottomLineModel, Agent_IterationDecision, If

Only good results move forward

📩 Deliver Result

Share the final copy

Gmail

Automates delivery


✅ Final Benefits

  • 🚀 One-click workflow: from product description to tested headline.
  • 📊 Automatic rubric: objective scoring each time.
  • 🔄 Self-improving: poor headlines can auto-iterate with feedback.
  • 📧 Direct integration: approved headlines land in Gmail instantly.
  • 🧩 Fully modular: easy to extend with Google Sheets, Slack, or CRM nodes.

New to n8n?

Need help building new n8n workflows? Process automation for you or your company will save you time and money, and it's completely free!