AutomationFlowsAI & RAG › Optimize Ad Campaigns with Slack Alerts

Optimize Ad Campaigns with Slack Alerts

Original n8n title: Optimize Campaigns

Optimize Campaigns. Uses httpRequest, slack, supabase. Scheduled trigger; 10 nodes.

Cron / scheduled trigger★★★★☆ complexity10 nodesHTTP RequestSlackSupabase
AI & RAG Trigger: Cron / scheduled Nodes: 10 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Slack recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Optimize Campaigns",
  "nodes": [
    {
      "parameters": {},
      "id": "feb071ec-e104-4330-93fe-66226a2573ea",
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        -608,
        112
      ]
    },
    {
      "parameters": {
        "functionCode": "return items.map(item => {\n  const m = item.json;\n  let action = null;\n  if(m.cpl && m.cpl > 50 && m.conversions >= 5) action = 'pause';\n  else if(m.roas && m.roas < 1.2 && m.spend > 100) action = 'reduce_budget';\n  return {json:{...m,action}};\n});"
      },
      "id": "a4ce930a-2ed2-418e-bb28-8c66b3efec46",
      "name": "Function Apply Rules",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        -64,
        112
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json[\"action\"]}}",
              "value2": "pause"
            }
          ]
        }
      },
      "id": "fa170e85-99bf-44e1-8dfa-889b69000b68",
      "name": "If Pause",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        208,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json[\"action\"]}}",
              "value2": "reduce_budget"
            }
          ]
        }
      },
      "id": "8f3264a0-d8f6-4206-b185-f1bbf791c167",
      "name": "If Budget",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        208,
        208
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://mockapi.io/projects/apply-action",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "options": {}
      },
      "id": "ec058c60-0fd3-4943-a9c2-01c095fdaa2f",
      "name": "HTTP Apply Action",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        432,
        112
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "channel": "#alerts",
        "text": "Action: {{$json[\"action\"]}} on campaign {{$json[\"campaign_name\"]}} (CPL: {{$json[\"cpl\"]}}, ROAS: {{$json[\"roas\"]}})",
        "otherOptions": {},
        "attachments": []
      },
      "id": "5f62acdc-3cc5-4f1a-ada7-0cb8a40d2d58",
      "name": "Slack Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        608,
        112
      ],
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "get",
        "tableId": "campaign_metrics",
        "filters": {
          "conditions": [
            {
              "keyName": "date"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -320,
        112
      ],
      "id": "16390da3-f0f4-4254-b50b-d3f5f5a7a830",
      "name": "Get Campaign Metrics",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "tableId": "campaign_actions"
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        816,
        112
      ],
      "id": "b493028e-a3cd-4bfb-9bb2-def743f37bd9",
      "name": "Create a row",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        432,
        -48
      ],
      "id": "7617ee2c-727f-4699-ad9d-4257c3af395e",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        448,
        304
      ],
      "id": "3832379f-c341-4124-bd3e-20ff52c438a2",
      "name": "Do Nothing"
    }
  ],
  "connections": {
    "Cron": {
      "main": [
        [
          {
            "node": "Get Campaign Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function Apply Rules": {
      "main": [
        [
          {
            "node": "If Pause",
            "type": "main",
            "index": 0
          },
          {
            "node": "If Budget",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Pause": {
      "main": [
        [
          {
            "node": "HTTP Apply Action",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Budget": {
      "main": [
        [
          {
            "node": "HTTP Apply Action",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Do Nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Apply Action": {
      "main": [
        [
          {
            "node": "Slack Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Campaign Metrics": {
      "main": [
        [
          {
            "node": "Function Apply Rules",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Alert": {
      "main": [
        [
          {
            "node": "Create a row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b274dab1-718e-4d9a-ae44-db6118ee23ae",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "KHJchHLKZs5skeyr",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Optimize Campaigns. Uses httpRequest, slack, supabase. Scheduled trigger; 10 nodes.

Source: https://github.com/Paulinho19/ad-optimization-agent/blob/c4357bc957f05fd90c20e1c7506433e041b126fe/workflows/optimize.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

It identifies SKUs with low inventory per source and sends daily alerts via:

Slack, HTTP Request, Gmail
AI & RAG

Linear Router — Reconciler. Uses httpRequest, slack. Scheduled trigger; 17 nodes.

HTTP Request, Slack
AI & RAG

Agent Team Watchdog — Weekly Strategic-Routine Canary. Uses httpRequest, slack. Scheduled trigger; 10 nodes.

HTTP Request, Slack
AI & RAG

LinkedIn_Job_Hunt_and_Cover_Letter. Uses outputParserStructured, outputParserAutofixing, googleDrive, agent. Scheduled trigger; 85 nodes.

Output Parser Structured, Output Parser Autofixing, Google Drive +6
AI & RAG

Created by: Peyton Leveillee Last updated: October 2025

OpenAI Chat, Google Sheets, HTTP Request +5