Detect Meta Ads spend anomalies and creative fatigue with OpenAI and Slack

Go to Workflow
0 views
Built by Rahul Joshi Rahul Joshi
Created on October 01, 2026

Description

Quick overview
This workflow runs daily and pulls Meta Ads account and ad insights from the Meta Graph API, detects spend/performance anomalies and creative fatigue, uses OpenAI (gpt-4o-mini) to propose fixes for flagged accounts, and posts either an alert or an all-clear message to Slack.

How it works
Runs every day at 9:00 AM (cron schedule).
Loads your configured Meta ad accounts and generates the “yesterday” and 7-day lookback date window for each account.
Queries the Meta Graph API for account-level daily metrics, active ad-level daily metrics, and 7-day ad totals for baseline comparison.
Compares yesterday’s performance to the 7-day baseline to flag issues like spend spikes/drops, CPA spikes, CTR drops, CPM spikes, missing results, or missing data, and identifies ads with creative fatigue based on frequency and CTR trend.
If issues are found, sends the findings to OpenAI (gpt-4o-mini) to generate a short diagnosis and prioritized fix recommendations (plus creative ideas when fatigue is present).
Formats the results into a Slack message (including an Ads Manager link) and posts either the alert or an optional all-clear message to the configured Slack channel.
If the workflow fails, triggers an error handler that posts a workflow error alert to Slack.

Setup
Add a Meta access token as an HTTP Header Auth credential and connect it to the three Meta Graph API HTTP Request nodes.
Add an OpenAI API credential for the OpenAI node using the gpt-4o-mini model.
Add a Slack OAuth2 credential and update the Slack channel IDs used for posting alerts and workflow error notifications.
Update the account list and defaults in the configuration step (ad account IDs, client name, goal, target CPA, default Slack channel, currency symbol, and action types).
Adjust the detection thresholds and limits in the configuration (lookback days, minimum spend, spend/CPA/CTR/CPM thresholds, frequency threshold, and max fatigued ads) to match your reporting needs.

Nodes Used (7)

AI Agent
@n8n/n8n-nodes-langchain.agent
Code
n8n-nodes-base.code
Google Sheets
n8n-nodes-base.googleSheets
HTTP Request
n8n-nodes-base.httpRequest
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Slack
n8n-nodes-base.slack
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured