{
  "id": "STNUw9tllHviOT2P",
  "name": "Receive Meta Ads webhooks and send alerts to Slack with Google Sheets logging",
  "tags": [
    {
      "id": "3Kr9akgvGQXhCtQJ",
      "name": "ForPublishing",
      "createdAt": "2025-08-13T13:36:55.022Z",
      "updatedAt": "2025-08-13T13:36:55.022Z"
    },
    {
      "id": "tITAFvUSOpVVIBvI",
      "name": "MetaAds",
      "createdAt": "2025-07-05T02:24:26.705Z",
      "updatedAt": "2025-07-05T02:24:26.705Z"
    }
  ],
  "nodes": [
    {
      "id": "89527acd-0683-42a4-ae5e-e6dd74a98662",
      "name": "Webhook: Meta (ad_account)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        624,
        768
      ],
      "parameters": {
        "path": "meta-ads-ad-account-webhook",
        "options": {},
        "responseMode": "responseNode",
        "multipleMethods": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "7564c707-9aa2-48b4-92ff-0f0f1e06b132",
      "name": "Route: verification vs webhook",
      "type": "n8n-nodes-base.switch",
      "position": [
        848,
        768
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Verification",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.query?.['hub.mode'] }}",
                    "rightValue": "subscribe"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "AdAccountData",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body?.object }}",
                    "rightValue": "ad_account"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "b1ac3f80-2e08-45fc-bc99-0fed75d9ea71",
      "name": "Verify: token",
      "type": "n8n-nodes-base.if",
      "position": [
        960,
        528
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a071491e-42be-4f1b-a17e-553fa5d644ea",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.query?.['hub.verify_token'] }}",
              "rightValue": "YOUR_VERIFY_TOKEN"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "37809c0f-4671-4cff-908a-ff33a0b9a1fd",
      "name": "Respond: challenge",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1200,
        464
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={{ $json.query['hub.challenge'] }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "8a310150-ba7a-4b8e-9b94-50606d7229b6",
      "name": "Route: field",
      "type": "n8n-nodes-base.switch",
      "position": [
        1072,
        992
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Creative Fatigue",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.entry[0].changes[0].field }}",
                    "rightValue": "creative_fatigue"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Ad Recommendations",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.entry[0].changes[0].field }}",
                    "rightValue": "ad_recommendations"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Async Creation Request",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.entry[0].changes[0].field }}",
                    "rightValue": "ads_async_creation_request"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "In Process Ad Objects",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.entry[0].changes[0].field }}",
                    "rightValue": "in_process_ad_objects"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Product Set Issue",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.entry[0].changes[0].field }}",
                    "rightValue": "product_set_issue"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "With Issues Ad Objects",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.entry[0].changes[0].field }}",
                    "rightValue": "with_issues_ad_objects"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "0037189f-feb0-451f-a56a-b8426a71de19",
      "name": "Respond Creative Fatigue",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1344,
        576
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"received\", \"field\": $json.body.entry[0].changes[0].field, \"webhook_type\": \"creative_fatigue\" } }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "52b43fd4-8836-43db-9b4e-fff81c279d7a",
      "name": "Respond Ad Recommendations",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1344,
        768
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"received\", \"field\": $json.body.entry[0].changes[0].field, \"webhook_type\": \"ad_recommendations\" } }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "70172dc3-e4c8-41e5-ba20-cfdc19f14d38",
      "name": "Respond Async Creation",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1344,
        960
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"received\", \"field\": $json.body.entry[0].changes[0].field, \"webhook_type\": \"ads_async_creation_request\" } }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "ee906d52-534d-4d7c-a782-ebb4faa79065",
      "name": "Respond In Process",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1344,
        1152
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"received\", \"field\": $json.body.entry[0].changes[0].field, \"webhook_type\": \"in_process_ad_objects\" } }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "2ce97e7e-1ed4-4cea-9950-c16906c34c37",
      "name": "Respond Product Set Issue",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1344,
        1344
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"received\", \"field\": $json.body.entry[0].changes[0].field, \"webhook_type\": \"product_set_issue\" } }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "609155d1-17e5-4f13-a4d3-166e781a15a6",
      "name": "Respond With Issues",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1328,
        1536
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"received\", \"field\": $json.body.entry[0].changes[0].field, \"webhook_type\": \"with_issues_ad_objects\" } }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "17a7b8cc-9a67-4fc0-82d0-2cfd29db738e",
      "name": "Split Out Accounts AdRec",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1920,
        768
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.entry"
      },
      "typeVersion": 1
    },
    {
      "id": "8b0b2421-fb0b-4ec8-9b25-6c0ebf03a324",
      "name": "Split Out Accounts AsCr",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1920,
        960
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.entry"
      },
      "typeVersion": 1
    },
    {
      "id": "0c52522c-7c55-47e8-b115-335afd15ca02",
      "name": "Split Out Accounts Pr",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1920,
        1152
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.entry"
      },
      "typeVersion": 1
    },
    {
      "id": "6470e42c-fb91-48ae-b14f-6771203ea465",
      "name": "Split Out Accounts SetIssue",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1920,
        1344
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.entry"
      },
      "typeVersion": 1
    },
    {
      "id": "28c52db3-05d6-4d33-8ac3-500009119079",
      "name": "Split Out Accounts Issues",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1920,
        1536
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.entry"
      },
      "typeVersion": 1
    },
    {
      "id": "6cc26e3b-02bf-468c-a443-824f471fc4e8",
      "name": "Split Out Accounts CF",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1920,
        576
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "body.entry"
      },
      "typeVersion": 1
    },
    {
      "id": "b65ecf93-2c9c-4358-9526-6258af522c11",
      "name": "Split Out Changes CF",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2128,
        576
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "['body.entry'].changes"
      },
      "typeVersion": 1
    },
    {
      "id": "c192ad61-1343-4821-a553-b9ad7eba68ab",
      "name": "Split Out Changes AdRec",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2128,
        768
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "changes"
      },
      "typeVersion": 1
    },
    {
      "id": "e72f095b-88f8-4a6d-bcec-29b28d707f73",
      "name": "Log Creative Fatigue",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2336,
        576
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json['body.entry'].id }}",
            "date": "={{ $now.toFormat('dd/MM/yyyy') }}",
            "adgroup_id": "={{ $json['[\\'body.entry\\'].changes'].value.adgroup_id }}",
            "ad_account_id": "={{ $json['[\\'body.entry\\'].changes'].value.ad_account_id }}",
            "raw_body_json": "={{ $('Respond Creative Fatigue').item.json.body }}",
            "creative_fatigue_level": "={{ $json['[\\'body.entry\\'].changes'].value.creative_fatigue_level }}",
            "creative_fatigue_message": "={{ $json['[\\'body.entry\\'].changes'].value.creative_fatigue_message }}"
          },
          "schema": [
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_account_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ad_account_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "adgroup_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "adgroup_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "creative_fatigue_level",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "creative_fatigue_level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "creative_fatigue_message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "creative_fatigue_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "raw_body_json",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "raw_body_json",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "creative_fatigue"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1VGlkRBHoRiMgEDpe7MaO0vaA-zQzFC2eG0nx6TZFVI8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VGlkRBHoRiMgEDpe7MaO0vaA-zQzFC2eG0nx6TZFVI8/edit?usp=drivesdk",
          "cachedResultName": "Meta Ads Dispatcher Logs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "90a82793-42ea-4ff1-8cb3-49562042f48e",
      "name": "Log Ad Recommendations",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2336,
        768
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json.id }}",
            "date": "={{ new Date($json.time * 1000).toLocaleString() }}",
            "ad_account_id": "={{ $json.changes.value.ad_account_id }}",
            "raw_body_json": "={{ $('Respond Ad Recommendations').item.json.body }}",
            "ad_objects_ids": "={{ $json.changes.value.ad_object_ids }}",
            "recommendation_type": "={{ $json.changes.value.recommendation_type }}",
            "recommendation_message": "={{ $json.changes.value.recommendation_message }}"
          },
          "schema": [
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_account_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ad_account_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_objects_ids",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ad_objects_ids",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendation_type",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "recommendation_type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendation_message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "recommendation_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "raw_body_json",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "raw_body_json",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "ad_recommendations"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1VGlkRBHoRiMgEDpe7MaO0vaA-zQzFC2eG0nx6TZFVI8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VGlkRBHoRiMgEDpe7MaO0vaA-zQzFC2eG0nx6TZFVI8/edit?usp=drivesdk",
          "cachedResultName": "Meta Ads Dispatcher Logs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "4f7a55dc-e4cb-420d-8050-a0a96a91fcc2",
      "name": "Log Async Creation",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2336,
        960
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json.id }}",
            "date": "={{ new Date($json.time * 1000).toLocaleString() }}",
            "result": "={{ $json.changes.value.result.result_id }}",
            "status": "={{ $json.changes.value.status }}",
            "raw_body_json": "={{ $('Respond Async Creation').item.json.body }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "result",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "result",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "raw_body_json",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "raw_body_json",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "ads_async_creation_request"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1VGlkRBHoRiMgEDpe7MaO0vaA-zQzFC2eG0nx6TZFVI8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VGlkRBHoRiMgEDpe7MaO0vaA-zQzFC2eG0nx6TZFVI8/edit?usp=drivesdk",
          "cachedResultName": "Meta Ads Dispatcher Logs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "f046d10c-7225-40de-864c-0ce191b6d7c6",
      "name": "Split Out Changes AsCr",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2128,
        960
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "changes"
      },
      "typeVersion": 1
    },
    {
      "id": "e28f01fb-ee56-4ee6-92d6-fc729e5e2efd",
      "name": "Split Out Changes Pr",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2128,
        1152
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "changes"
      },
      "typeVersion": 1
    },
    {
      "id": "65ee04ce-545a-4d18-9dac-417c292458ec",
      "name": "Log In-process ad objects",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2336,
        1152
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json.id }}",
            "date": "={{ new Date($json.time * 1000).toLocaleString() }}",
            "level": "={{ $json.changes.value.level }}",
            "element_id": "={{ $json.changes.value.id }}",
            "status_name": "={{ $json.changes.value.status_name }}",
            "raw_body_json": "={{ $('Respond In Process').item.json.body }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "element_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "element_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "level",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "raw_body_json",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "raw_body_json",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "in_process_ad_objects"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_SPREADSHEET_ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "de853e05-9ee0-48cf-beb6-5dbb427f0bd1",
      "name": "Split Out Changes SetIssue",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2128,
        1344
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "changes"
      },
      "typeVersion": 1
    },
    {
      "id": "5e198061-fb10-4c01-a49f-975a5ad49ff7",
      "name": "Log product set issues",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2336,
        1344
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json.id }}",
            "date": "={{ new Date($json.time * 1000).toLocaleString() }}",
            "type": "={{ $json.changes.value.type }}",
            "description": "={{ $json.changes.value.description }}",
            "ad_account_id": "={{ $json.changes.value.ad_account_id }}",
            "raw_body_json": "={{ $('Respond Product Set Issue').item.json.body }}",
            "product_set_id": "={{ $json.changes.value.product_set_id }}",
            "recommended_action": "={{ $json.changes.value.recommended_action }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_account_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ad_account_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "product_set_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "product_set_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "type",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommended_action",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "recommended_action",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "raw_body_json",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "raw_body_json",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "product_set_issue"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_SPREADSHEET_ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "11a16a53-9edc-4b42-9fd4-57b2143a3a06",
      "name": "Split Out Changes SetIssue1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2128,
        1536
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "changes"
      },
      "typeVersion": 1
    },
    {
      "id": "b8965c2c-d6e9-4c9e-9bc3-6c6985cea0c9",
      "name": "Log with-issues ad objects",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2336,
        1536
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json.id }}",
            "date": "={{ new Date($json.time * 1000).toLocaleString() }}",
            "level": "={{ $json.changes.value.level }}",
            "error_code": "={{ $json.changes.value.error_code }}",
            "ad_account_id": "={{ $json.changes.value.id }}",
            "error_message": "={{ $json.changes.value.error_message }}",
            "error_summary": "={{ $json.changes.value.error_summary }}",
            "raw_body_json": "={{ $('Respond With Issues').item.json.body }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ad_account_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ad_account_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "level",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error_code",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error_code",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error_summary",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error_summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error_message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "raw_body_json",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "raw_body_json",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "with_issues_ad_objects"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_SPREADSHEET_ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "16c00b71-a9a2-4e1f-97a3-c3c482aa3445",
      "name": "Set: event field",
      "type": "n8n-nodes-base.set",
      "position": [
        2544,
        960
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "01e51084-9cde-4094-bbf8-9e3e52ce7d9e",
              "name": "field",
              "type": "string",
              "value": "={{ $('Split Out Changes CF').item.json['[\\'body.entry\\'].changes'].field }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "fe7474ef-46e4-44cd-bf5e-2ac28d4a5c83",
      "name": "Summarize",
      "type": "n8n-nodes-base.summarize",
      "position": [
        2752,
        960
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "field",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "id"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "db3f1ce2-62a2-44bd-979a-bfecc0abba65",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        528
      ],
      "parameters": {
        "width": 668,
        "height": 816,
        "content": "# Meta Ads webhook dispatcher (ad_account)\n\n## How it works\n\n- Receives **Meta Ads Webhooks** for the **Ad Account** object\n- Sends the required **acknowledgement** back to Meta (verification + event responses)\n- Routes events by `field`\n- Logs each webhook to **Google Sheets** (one tab per event type)\n- Sends a compact **Slack summary** (count-based)\n\n## Setup steps\n\n1. Configure the **Webhook** node (use the *Production URL* for live traffic)\n2. In Facebook Developers:\n  - Add the **Webhooks** product\n  - Subscribe to the **Ad Account** object\n - Set the Callback URL and Verify Token (must match `YOUR_VERIFY_TOKEN` in the workflow)\n3. Connect credentials:  - **Google Sheets** (for all log nodes)\n  - **Slack** (for the summary notification)\n4. Create the following Google Sheets tabs (sheet names):\n  - `creative_fatigue`\n  - `ad_recommendations`\n  - `ads_async_creation_request`\n  - `in_process_ad_objects`\n  - `product_set_issue`\n  - `with_issues_ad_objects`\n5.**Testing:** To test with realistic payloads (including array cases), use: [meta-ads-webhook-tester](https://github.com/KhatkevichKirill/meta-ads-webhook-tester)\n\n\nBuilt by Kirill Khatkevich  \n[Connect on LinkedIn](https://www.linkedin.com/in/kirill-khatkevich/)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f66ce378-d468-47c9-8fa8-1a63ca4a265b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1568,
        432
      ],
      "parameters": {
        "color": 5,
        "width": 944,
        "height": 1344,
        "content": "##  Log data to flat table\n\n**Split webhook payload**\nMeta can send arrays in the webhook payload.\nSplit them into individual items to make processing and logging easier.\n\n**Save data**\nLog all webhook events to Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "52099702-5e95-4645-b532-aae8a41dcc9a",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2528,
        656
      ],
      "parameters": {
        "color": 5,
        "width": 582,
        "height": 576,
        "content": "## Send data to message\n\n**Set: event field**\nMerge all webhook events before summarizing\n\n**Summarize**\nCount how many events were received to send a compact message.\nUse `{{$json.count}}` in the Slack/Telegram message.\n\n**Slack: send summary**\nSend a Slack notification about new webhook events. Change Slack Channel ID"
      },
      "typeVersion": 1
    },
    {
      "id": "a60fc605-925d-43e9-a407-8abcafe8d01b",
      "name": "Slack: send summary",
      "type": "n8n-nodes-base.slack",
      "position": [
        2928,
        960
      ],
      "parameters": {
        "text": "=*New Meta Webhook*  \n\nEvent type: *{{ $json.field }}* \nCount: *{{ $json.count }}*  \n\nDetails: https://docs.google.com/spreadsheets/d/{{ $env.GOOGLE_SHEETS_ID }}/edit",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "C0122GQH15RTA"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.4
    },
    {
      "id": "1c9a3da9-5b89-46ed-86c3-a3c403625721",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        432
      ],
      "parameters": {
        "color": 5,
        "width": 1232,
        "height": 1248,
        "content": "## Get Webhook\n\n**Webhook: Meta (ad_account)**\n- Set the webhook **path** (Callback URL).\nThis is where Meta will send webhook events and where the workflow starts.\nUse the **Production URL** for live traffic.\n\n\n**Route: verification vs webhook**\nDuring setup, Meta sends a subscription/verification request and expects a response.\nThis node detects that request type.\n\n**Verify the Meta webhook token**\nThe node 'Verify: token' checks your **Verify Token**.\n\n**Respond: challenge**\nSend the verification response back to Meta (app subscription).\n\n**Route: field**\nIf you want to handle and log all webhook types, \nroute them by `field` before the next steps.\n\n**Responses for all webhooks**\nMeta expects an acknowledgement for every webhook delivery.\nThese nodes send that response."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "25d80b0b-f232-4dbf-88de-a83dd25cdea0",
  "connections": {
    "Summarize": {
      "main": [
        [
          {
            "node": "Slack: send summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route: field": {
      "main": [
        [
          {
            "node": "Respond Creative Fatigue",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond Ad Recommendations",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond Async Creation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond In Process",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond Product Set Issue",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond With Issues",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify: token": {
      "main": [
        [
          {
            "node": "Respond: challenge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set: event field": {
      "main": [
        [
          {
            "node": "Summarize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Async Creation": {
      "main": [
        [
          {
            "node": "Set: event field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond In Process": {
      "main": [
        [
          {
            "node": "Split Out Accounts Pr",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond With Issues": {
      "main": [
        [
          {
            "node": "Split Out Accounts Issues",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Creative Fatigue": {
      "main": [
        [
          {
            "node": "Set: event field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Changes CF": {
      "main": [
        [
          {
            "node": "Log Creative Fatigue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Changes Pr": {
      "main": [
        [
          {
            "node": "Log In-process ad objects",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Accounts CF": {
      "main": [
        [
          {
            "node": "Split Out Changes CF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Accounts Pr": {
      "main": [
        [
          {
            "node": "Split Out Changes Pr",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Ad Recommendations": {
      "main": [
        [
          {
            "node": "Set: event field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log product set issues": {
      "main": [
        [
          {
            "node": "Set: event field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond Async Creation": {
      "main": [
        [
          {
            "node": "Split Out Accounts AsCr",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Changes AsCr": {
      "main": [
        [
          {
            "node": "Log Async Creation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Accounts AsCr": {
      "main": [
        [
          {
            "node": "Split Out Changes AsCr",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Changes AdRec": {
      "main": [
        [
          {
            "node": "Log Ad Recommendations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond Creative Fatigue": {
      "main": [
        [
          {
            "node": "Split Out Accounts CF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Accounts AdRec": {
      "main": [
        [
          {
            "node": "Split Out Changes AdRec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log In-process ad objects": {
      "main": [
        [
          {
            "node": "Set: event field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond Product Set Issue": {
      "main": [
        [
          {
            "node": "Split Out Accounts SetIssue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Accounts Issues": {
      "main": [
        [
          {
            "node": "Split Out Changes SetIssue1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log with-issues ad objects": {
      "main": [
        [
          {
            "node": "Set: event field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond Ad Recommendations": {
      "main": [
        [
          {
            "node": "Split Out Accounts AdRec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Changes SetIssue": {
      "main": [
        [
          {
            "node": "Log product set issues",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook: Meta (ad_account)": {
      "main": [
        [
          {
            "node": "Route: verification vs webhook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Route: verification vs webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Accounts SetIssue": {
      "main": [
        [
          {
            "node": "Split Out Changes SetIssue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Changes SetIssue1": {
      "main": [
        [
          {
            "node": "Log with-issues ad objects",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route: verification vs webhook": {
      "main": [
        [
          {
            "node": "Verify: token",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Route: field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}