{
  "name": "Track TikTok Ads Library with Apify, Google Sheets & Slack/Telegram Notifications",
  "nodes": [
    {
      "id": "204f29b8-31d7-4c68-bef8-0f46b882376a",
      "name": "Set Parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        -96
      ]
    },
    {
      "id": "1e175c48-7bbd-4b5b-bed4-b7f16a78b6f6",
      "name": "Convert Dates to Unix",
      "type": "n8n-nodes-base.code",
      "position": [
        416,
        -96
      ]
    },
    {
      "id": "ea56c4d8-d916-41f4-92ab-4fa2f92081f7",
      "name": "Build Apify Body",
      "type": "n8n-nodes-base.code",
      "position": [
        624,
        -96
      ]
    },
    {
      "id": "55a900ff-ca28-49a7-b662-d542b5a2e39e",
      "name": "Prepare Data for Sheets",
      "type": "n8n-nodes-base.code",
      "position": [
        1040,
        -96
      ]
    },
    {
      "id": "3804ed9d-b6ea-44d5-af30-ad22998e4e5c",
      "name": "Read existing IDs",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1248,
        144
      ]
    },
    {
      "id": "2df43f3d-b374-4fe4-ac0c-609147c6b566",
      "name": "Collect ID list",
      "type": "n8n-nodes-base.code",
      "position": [
        1456,
        144
      ]
    },
    {
      "id": "7d08dbfc-2d45-4098-92f1-900a6301eb80",
      "name": "Attach existing ids",
      "type": "n8n-nodes-base.merge",
      "position": [
        1664,
        -96
      ]
    },
    {
      "id": "f96de8ba-6796-4772-9100-213a4112568d",
      "name": "Filter new creatives",
      "type": "n8n-nodes-base.code",
      "position": [
        1872,
        -96
      ]
    },
    {
      "id": "4821abfe-854f-41a4-afce-1a4cb09805fb",
      "name": "Count new ads",
      "type": "n8n-nodes-base.code",
      "position": [
        2080,
        64
      ]
    },
    {
      "id": "e352dc0a-0fb9-42a1-8110-aa6ceeda45b0",
      "name": "Any new ads?",
      "type": "n8n-nodes-base.if",
      "position": [
        2288,
        64
      ]
    },
    {
      "id": "25aae637-70ec-4a31-81fd-974b6e47ffcc",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2496,
        -96
      ]
    },
    {
      "id": "3ac92c9f-5416-462a-a0f1-c5efc68217f1",
      "name": "Send a message",
      "type": "n8n-nodes-base.slack",
      "position": [
        2704,
        48
      ]
    },
    {
      "id": "183b249c-fdcc-40ca-a489-1a09f07c608c",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2704,
        208
      ]
    },
    {
      "id": "00ea4eb6-6dbd-401b-a865-de40421a3ca2",
      "name": "Get TT Ads through Apify",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        832,
        -96
      ]
    },
    {
      "id": "7c1b1a25-2ce6-48a4-9226-7d0158b3e98c",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -16,
        -96
      ]
    },
    {
      "id": "6661c32d-8143-4017-ad37-bfc957cd1874",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -720
      ],
      "parameters": {
        "width": 652,
        "height": 592,
        "content": "# TikTok Ads Monitoring Loop\n\n## How it works\n\nAutomatically monitors TikTok Ads creatives from specific advertisers or keyword searches, saves them to Google Sheets, and sends notifications to Telegr"
      }
    },
    {
      "id": "cd97b62a-9015-46ef-8036-9f706f3f2ea3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        80
      ],
      "parameters": {
        "width": 304,
        "height": 288,
        "content": "## Set your parameters\n- Target Country (use ISO 3166 country codes)\n- Date From (by default it is yesterday)\n- Date To (by default it is today)\n- Advertiser name or keyword\n- ID of advertiser (you ca"
      }
    },
    {
      "id": "8eef6a2d-e6a8-4c6e-ba93-d7fa5688e1ea",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        -208
      ],
      "parameters": {
        "width": 176,
        "height": null,
        "content": "Transforms date format from DD/MM/YYYY to Unix timestamp"
      }
    },
    {
      "id": "944f84bd-7431-4436-b050-0010166f1ca8",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -208
      ],
      "parameters": {
        "width": 176,
        "height": null,
        "content": "Creates JSON body for Apify if you set a result limit"
      }
    },
    {
      "id": "23fa9a0f-2c9d-44a7-9652-1d60e66c268d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        -240
      ],
      "parameters": {
        "width": 176,
        "height": null,
        "content": "This node gets data from the Apify scraper. Add your credentials and choose an actor"
      }
    },
    {
      "id": "aa018f2a-45c9-4170-a407-1226bf6d4da1",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -224
      ],
      "parameters": {
        "width": 176,
        "height": null,
        "content": "Safely extract video data and prepare for Google Sheets"
      }
    },
    {
      "id": "783ea6f3-67e2-4c17-910e-eaca4d6f093d",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        224
      ],
      "parameters": {
        "width": 192,
        "height": 208,
        "content": "\n\n\n\n\n\nCheck which creative IDs already exist in Google Sheets so we only send a notification when new ones are found"
      }
    },
    {
      "id": "60532ca5-8981-456d-ae0f-6476f94618a7",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        224
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "\n\n\n\n\n\nCollect IDs for future matching"
      }
    },
    {
      "id": "7ed1f991-e023-44e5-9b9f-10f63a31d7af",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1616,
        -32
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "\n\n\n\n\n\nMatch creatives from the response with those already stored in Google Sheets"
      }
    },
    {
      "id": "ddd65036-e582-44d1-8ddd-08273f02b8e4",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1824,
        -32
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "\n\n\n\n\n\nMatch creatives from the API response with those already stored in Google Sheets"
      }
    },
    {
      "id": "5ac9f0ae-7287-440a-bb73-875ff87ee30d",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2448,
        -240
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "\n\n\n\nAdd creatives to Google Sheets. Be careful to keep the column order and names in sync."
      }
    },
    {
      "id": "8ac753cc-8490-49f5-8adf-0a5d30fba72c",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2032,
        144
      ],
      "parameters": {
        "width": 192,
        "height": 192,
        "content": "\n\n\n\nCount how many new creatives were found for a more compact message. Use {{$json.newCount}} in the Slack or Telegram message."
      }
    },
    {
      "id": "9830260b-1192-4dee-9990-257a5616870f",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2256,
        160
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "\n\n\n\nCheck if there are any new ads before sending notifications"
      }
    },
    {
      "id": "3f751641-e785-4797-9929-8c8dec0a0f44",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2656,
        304
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "\n\n\n\nSend Telegram notification about new creatives"
      }
    },
    {
      "id": "70956887-5b1e-400e-b940-5995bd78d10c",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2704,
        -80
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "\n\n\n\nSend Slack notification about new creatives"
      }
    }
  ],
  "connections": {
    "Any new ads?": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Count new ads": {
      "main": [
        [
          {
            "node": "Any new ads?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Parameters": {
      "main": [
        [
          {
            "node": "Convert Dates to Unix",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect ID list": {
      "main": [
        [
          {
            "node": "Attach existing ids",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Build Apify Body": {
      "main": [
        [
          {
            "node": "Get TT Ads through Apify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read existing IDs": {
      "main": [
        [
          {
            "node": "Collect ID list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Attach existing ids": {
      "main": [
        [
          {
            "node": "Filter new creatives",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter new creatives": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Count new ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Dates to Unix": {
      "main": [
        [
          {
            "node": "Build Apify Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Data for Sheets": {
      "main": [
        [
          {
            "node": "Read existing IDs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Attach existing ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get TT Ads through Apify": {
      "main": [
        [
          {
            "node": "Prepare Data for Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}