Monitoreo diario del gasto en publicidad: Google Sheets y alertas de umbrales en Slack

Intermedio

Este es unContent Creation, Multimodal AIflujo de automatización del dominio deautomatización que contiene 13 nodos.Utiliza principalmente nodos como If, Set, Code, Slack, Summarize. Monitoreo diario del gasto en publicidad usando Google Sheets y recordatorios por Slack con umbrales

Requisitos previos
  • Bot Token de Slack o URL de Webhook
  • Credenciales de API de Google Sheets
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "efb474b59b0341d7791932605bd9ff04a6c7ed9941fdd53dc4a2e4b99a6f9439"
  },
  "nodes": [
    {
      "id": "0ae2c8b2-5526-4254-84e2-9bb038e1ffc0",
      "name": "Test Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -80,
        420
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7992326c-7084-44b2-b221-25054dce8772",
      "name": "Schedule Workflow",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -80,
        600
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bd446d05-bbcf-43de-8b41-25aa616d2965",
      "name": "Get Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        200,
        480
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "WsgMg14OYooIdvn7",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "071b0019-cc7f-4f44-9d33-00ee1a89d110",
      "name": "Sumar gasto por Día",
      "type": "n8n-nodes-base.summarize",
      "position": [
        540,
        400
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "Date",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "Spend ($)",
              "aggregation": "sum"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "82145ab3-6574-40ad-84b7-c9afc90eeb2d",
      "name": "Ordenar Fechas Descendentemente",
      "type": "n8n-nodes-base.code",
      "position": [
        740,
        600
      ],
      "parameters": {
        "jsCode": "// 1. Grab all incoming items\nconst items = $input.all();\n\n// 2. Sort by your date field descending\nitems.sort((a, b) => {\n  const da = new Date(a.json.Date).getTime();\n  const db = new Date(b.json.Date).getTime();\n  return db - da;  // newest first\n});\n\n// 3. Return sorted items\nreturn items;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d199be5a-18e2-4c3c-a72e-dc299a611a19",
      "name": "Mantener solo el Último Día",
      "type": "n8n-nodes-base.set",
      "position": [
        880,
        380
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e98f13e6-20a4-49fc-87cd-5b20f54f010c",
              "name": "Date",
              "type": "string",
              "value": "={{ $json.Date }}"
            },
            {
              "id": "a127b49d-dbfb-4143-a944-10d6e95e4e04",
              "name": "sum_Spend_($)",
              "type": "number",
              "value": "={{ $json['sum_Spend_($)'] }}"
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "4eca8fe3-333d-4383-8a49-4a5da44de415",
      "name": "Verificar si el Gasto supera $100",
      "type": "n8n-nodes-base.if",
      "position": [
        1180,
        580
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6193ed35-58eb-4ca3-a0a2-9f0426ecce5e",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json['sum_Spend_($)'] }}",
              "rightValue": 100
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0e2c1e71-36f1-4c8d-90c9-c25bd7565fd5",
      "name": "Send Slack Message",
      "type": "n8n-nodes-base.slack",
      "position": [
        1420,
        500
      ],
      "webhookId": "8f1ab338-1546-42f8-b6ae-3cd344d5faf3",
      "parameters": {
        "text": "The spend for the most recent day is over  $100",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08T2J84F6C",
          "cachedResultName": "leads"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "keV27N1Uk30CvNXL",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "92a59075-9fdf-42d3-aa35-9ed07c4cdc33",
      "name": "No Hacer Nada. Menos de 100",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1460,
        700
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0697878b-7728-4d5b-a90e-ef30b6869089",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -200
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 1000,
        "content": "#### 1️⃣ Schedule or Manual Trigger\n- **Node**: `Schedule Workflow` or `Test Workflow`\n- **Purpose**: Either run daily via a cron-like rule or manually trigger the flow.\n\n#### 2️⃣ Get Google Sheet Data\n- **Node**: `Get Data`\n- **What it does**: Fetches all rows from your connected sheet.\n- **Setup**:\n  - Go to [Google Cloud Console](https://console.cloud.google.com/)\n  - Create a new project\n  - Enable **Google Sheets API**\n  - Create OAuth2 credentials for a desktop or web application\n  - Connect your Google account in n8n via OAuth2\n  - Grant access to the sheet you want to read (ensure it's shared with your OAuth email)\n  - Use the copied sheet's link when connecting in n8n\n\n📎 **Copy this Sample Google Sheet to Use:**  \n[Marketing Data Sheet - Copy Me](https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit?usp=sharing)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0be15add-86ff-419e-bacb-64984e429429",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -200
      ],
      "parameters": {
        "color": 6,
        "width": 600,
        "height": 1000,
        "content": "#### 3️⃣ Summarize Spend by Day\n- **Node**: `Sum spend by Day`\n- **What it does**: Groups the dataset by `Date` and sums the `Spend ($)` column\n- **Requirements**:\n  - Your sheet must have a header row with `Date` and `Spend ($)` as columns\n\n#### 4️⃣ Sort by Most Recent Date\n- **Node**: `Sort Dates Descending`\n- **What it does**: Sorts all entries by the `Date` field so that the most recent day is first\n- **Custom JavaScript**:\n```js\nconst items = $input.all();\nitems.sort((a, b) => new Date(b.json.Date) - new Date(a.json.Date));\nreturn items;\n```\n\n#### 5️⃣ Select Top Result\n- **Node**: `Keep only Last Day`\n- **What it does**: Captures the top row (most recent day) for evaluation\n- **Fields**: Sets only `Date` and `sum_Spend_($)` to keep things clean"
      },
      "typeVersion": 1
    },
    {
      "id": "1a496e73-eaf8-427b-aee3-c1f8303f0f6d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        -200
      ],
      "parameters": {
        "color": 3,
        "width": 540,
        "height": 1000,
        "content": "#### 6️⃣ Check Spend Threshold\n- **Node**: `Check if Spend over $100`\n- **What it does**: Uses an IF node to compare `sum_Spend_($)` against a 100 threshold\n- **Logic**:\n```json\nsum_Spend_($) > 100\n```\n\n#### 7️⃣ Send Slack Notification\n- **Node**: `Send Slack Message`\n- **What it does**: Sends a message to a Slack channel if the threshold is exceeded\n- **Setup**:\n  - Go to [Slack API](https://api.slack.com/apps)\n  - Create a new app\n  - Enable **chat:write** and **channels:read** scopes under OAuth & Permissions\n  - Install the app to your workspace\n  - Copy the OAuth Token into your Slack credentials in n8n\n  - Select your target channel from the dropdown (must be public or the bot must be invited)\n- **Message**:\n  ```\n  The spend for the most recent day is over $100\n  ```\n\n#### 8️⃣ No Action if Under Budget\n- **Node**: `Do Nothing. Under 100`\n- **Purpose**: This path simply ends the flow with no action if spend is below the threshold\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0c4f9160-7700-4b90-9766-d10ad829947c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -360
      ],
      "parameters": {
        "width": 1780,
        "height": 120,
        "content": "### 👤 Need more help?\n**Robert Breen**  \nAutomation Consultant | AI Workflow Designer | n8n Expert  \n📧 [robert@ynteractive.com](mailto:robert@ynteractive.com)  \n🔗 [LinkedIn](https://www.linkedin.com/in/robert-breen-29429625/)\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "bd446d05-bbcf-43de-8b41-25aa616d2965": {
      "main": [
        [
          {
            "node": "071b0019-cc7f-4f44-9d33-00ee1a89d110",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0ae2c8b2-5526-4254-84e2-9bb038e1ffc0": {
      "main": [
        [
          {
            "node": "bd446d05-bbcf-43de-8b41-25aa616d2965",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "071b0019-cc7f-4f44-9d33-00ee1a89d110": {
      "main": [
        [
          {
            "node": "82145ab3-6574-40ad-84b7-c9afc90eeb2d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7992326c-7084-44b2-b221-25054dce8772": {
      "main": [
        [
          {
            "node": "bd446d05-bbcf-43de-8b41-25aa616d2965",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d199be5a-18e2-4c3c-a72e-dc299a611a19": {
      "main": [
        [
          {
            "node": "4eca8fe3-333d-4383-8a49-4a5da44de415",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "82145ab3-6574-40ad-84b7-c9afc90eeb2d": {
      "main": [
        [
          {
            "node": "d199be5a-18e2-4c3c-a72e-dc299a611a19",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4eca8fe3-333d-4383-8a49-4a5da44de415": {
      "main": [
        [
          {
            "node": "0e2c1e71-36f1-4c8d-90c9-c25bd7565fd5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "92a59075-9fdf-42d3-aa35-9ed07c4cdc33",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio - Creación de contenido, IA Multimodal

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos13
Categoría2
Tipos de nodos10
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34