# Track and classify Facebook ad angles with Apify and OpenAI: n8n workflow

> Runs on demand, and works across Apify, Supabase and Supabase vectors. It puts OpenAI behind a retrieval step, so answers are drawn from documents you...

Source: https://millionrounds.com/workflow/track-and-classify-facebook-ad-angles-with-apify-and-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Data collection](https://millionrounds.com/workflows?category=Data+collection#library)

# Track and classify Facebook ad angles with Apify and OpenAI

Runs on demand, and works across Apify, Supabase and Supabase vectors. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 15 steps: a working afternoon to understand properly.

Medium Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-and-classify-facebook-ad-angles-with-apify-and-openai)

**15 steps** Medium: a working afternoon

**0** Branches: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Model 4 Logic 7 Service 4

The steps in the order they run, from what starts it.

- 1 **Set Dataset Inputs** Set *Logic*
- 2 **Create OpenAI Embeddings** Embeddings Open Ai *Model*
- 3 **Load Default Data** Document Default Data Loader *Model*
- 4 **Scrape Facebook Ads** Apify *Service*
- 5 **Embed Ad Copy in Vector Store** Vector Store Supabase *Model*
- 6 **Compile Ad Data** Code *Logic*
- 7 **AI Classify Ad Angle** Open Ai *Model*
- 8 **Check Ad Destination** Filter *Logic*
- 9 **Assemble Ad Information** Code *Logic*
- 10 **Fetch Shopify Data** Http Request *Service*
- 11 **Insert Ad to Supabase** Supabase *Service*
- 12 **Compile Product Data** Code *Logic*
- 13 **Filter New Ads** Filter *Logic*
- 14 **Deduplicate Products by ID** Remove Duplicates *Logic*
- 15 **Insert Product to Supabase** Supabase *Service*

## How it's built

- **Starts on:** Nothing automatic; you run it
- **Steps:** 15
- **Size:** Medium: a working afternoon
- **Connects to:** Apify, Supabase, Supabase vectors
- **Model:** OpenAI
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Apify, Supabase and Supabase vectors accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

Nothing starts it automatically. You run it by hand.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 15 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 15 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-and-classify-facebook-ad-angles-with-apify-and-openai)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Apify](https://millionrounds.com/workflows?service=Apify#library)[Supabase](https://millionrounds.com/workflows?service=Supabase#library)[Supabase vectors](https://millionrounds.com/workflows?service=Supabase+vectors#library)

## Workflows like it

Also data collection, with the same services where possible, closest in size first.

- [**Generate AI voice receptionists for local businesses** 15 steps · calls a model · Apify, Google Sheets](https://millionrounds.com/workflow/generate-ai-voice-receptionists-for-local-businesses)
- [**Generate and store Supabase images with Claude** 15 steps · Supabase](https://millionrounds.com/workflow/generate-and-store-supabase-images-with-claude)
- [**Learn secure webhook APIs with Supabase** 15 steps · Supabase](https://millionrounds.com/workflow/learn-secure-webhook-apis-with-supabase)
- [**AI-powered knowledge assistant with Google Sheets and OpenAI** 16 steps · calls a model · Google Sheets, Supabase vectors](https://millionrounds.com/workflow/ai-powered-knowledge-assistant-with-google-sheets-and-openai)
- [**Build a labeled Reddit opinion dataset with Apify and OpenAI** 16 steps · calls a model · Apify, Supabase](https://millionrounds.com/workflow/build-a-labeled-reddit-opinion-dataset-with-apify-and-openai)
- [**Categorize Revolut transactions with OpenAI and Supabase** 14 steps · calls a model · Google Drive, Supabase](https://millionrounds.com/workflow/categorize-revolut-transactions-with-openai-and-supabase)
