{
  "name": "Find top-performing Instagram Reels & save insights to Notion with Gemini & Apify",
  "nodes": [
    {
      "id": "e9aad9c8-d2ad-4e17-93cd-a7faa215a06f",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -640,
        660
      ]
    },
    {
      "id": "81d68000-b6bd-42bf-8335-78e753c1f68e",
      "name": "Get Sources",
      "type": "n8n-nodes-base.notion",
      "position": [
        -200,
        660
      ]
    },
    {
      "id": "d59e57be-ae56-4853-aa56-c0839b5fd6c1",
      "name": "Variables",
      "type": "n8n-nodes-base.code",
      "position": [
        -420,
        660
      ]
    },
    {
      "id": "9dc6b692-015d-4749-bd77-a91cace88f73",
      "name": "Apify Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        20,
        660
      ]
    },
    {
      "id": "70cb78f1-bbc9-4dca-91a6-3d54444689ec",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        680,
        600
      ]
    },
    {
      "id": "43b693cd-9c70-4b2c-a30b-9ec3d01fe809",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        900,
        760
      ]
    },
    {
      "id": "8114cefb-bf4e-4ccd-9d27-b5858bfa4ca9",
      "name": "Get dataset items",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        900,
        540
      ]
    },
    {
      "id": "2045d552-7cc9-4670-8729-faec32a2bb49",
      "name": "Get Status",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        460,
        660
      ]
    },
    {
      "id": "e3288a62-aae7-4b7d-9081-63daac01219a",
      "name": "Run an Actor",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        240,
        660
      ]
    },
    {
      "id": "cb8d08e4-d245-4f6f-a5e3-98860dc4e04d",
      "name": "Update Accounts",
      "type": "n8n-nodes-base.notion",
      "position": [
        1560,
        540
      ]
    },
    {
      "id": "950f0ac1-11d9-4673-b751-feea0b623dc9",
      "name": "Get Reels",
      "type": "n8n-nodes-base.notion",
      "position": [
        2000,
        540
      ]
    },
    {
      "id": "52d274fb-3b99-48c7-8338-83ed7537568e",
      "name": "Many to One",
      "type": "n8n-nodes-base.code",
      "position": [
        1780,
        540
      ]
    },
    {
      "id": "6e9b25fe-e3ce-4cd4-91f6-4accd65f532b",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        2220,
        540
      ]
    },
    {
      "id": "242b65f6-a180-4795-b18f-c0b3278dbc3d",
      "name": "Map Reels",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        540
      ]
    },
    {
      "id": "f6ce6734-6bbf-451b-bc8b-e73fcad9eaac",
      "name": "Create",
      "type": "n8n-nodes-base.notion",
      "position": [
        1800,
        1360
      ]
    },
    {
      "id": "4f840157-aa84-4e1d-bc01-743b2846e733",
      "name": "Update",
      "type": "n8n-nodes-base.notion",
      "position": [
        60,
        1620
      ]
    },
    {
      "id": "3cf91952-47b1-4bd9-9b3d-95a0b847a4cc",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        40,
        1220
      ]
    },
    {
      "id": "4afd4b50-bb64-4135-9d7a-b4e2da533370",
      "name": "Upload to Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        260,
        1220
      ]
    },
    {
      "id": "be95f2a7-fd68-472d-b1e9-e7f47e16f61d",
      "name": "Gemini Analyze",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1360,
        1220
      ]
    },
    {
      "id": "d8a3b6c8-dfab-4d12-ac66-dacf23c379f5",
      "name": "Is Uploaded And Active?",
      "type": "n8n-nodes-base.if",
      "position": [
        920,
        1220
      ]
    },
    {
      "id": "849c07c0-c0c9-42bf-94a7-0bb794a8bbdc",
      "name": "Get File State",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        700,
        1160
      ]
    },
    {
      "id": "bd77d983-4f7a-4330-b461-dd0ebc6223e8",
      "name": "Processing Delay",
      "type": "n8n-nodes-base.wait",
      "position": [
        480,
        1220
      ]
    },
    {
      "id": "36dce35b-d983-4a45-9617-ac1254f5c77c",
      "name": "Format Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1580,
        1220
      ]
    },
    {
      "id": "913daa8b-e3c5-48d9-8f1c-16746a847564",
      "name": "Set Prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1160,
        1240
      ]
    },
    {
      "id": "f623358c-c051-4cf6-9922-1cbf1f944d7b",
      "name": "Owner?",
      "type": "n8n-nodes-base.if",
      "position": [
        1340,
        540
      ]
    },
    {
      "id": "6ef695e9-6e2d-4bea-bfb8-ba559e6a803e",
      "name": "Is Created?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -180,
        1300
      ]
    },
    {
      "id": "5b97e7c8-9637-4763-ad8c-53a086ddc8fd",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -400,
        1400
      ]
    },
    {
      "id": "635e329a-dda0-40d6-96d1-e7b384ec841b",
      "name": "Stats",
      "type": "n8n-nodes-base.code",
      "position": [
        -180,
        1100
      ]
    },
    {
      "id": "261dc20e-b593-440b-b002-f6d1cbfbfcc0",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -640,
        440
      ]
    },
    {
      "id": "5d8a6022-16bc-4211-b596-089655921209",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1320,
        -220
      ],
      "parameters": {
        "width": 520,
        "height": 360,
        "content": "### 📺 How It Works – Watch the Video  \nI've recorded a video walkthrough to show you how the system works in detail.\n👉 [https://www.youtube.com/watch?v=rdfRNHpHX8o](https://www.youtube.com/watch?v=rdf"
      }
    },
    {
      "id": "b7c81e9f-5d71-4ce1-b6b0-585245e0eb90",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -740,
        -220
      ],
      "parameters": {
        "width": 520,
        "height": 580,
        "content": "## ⚙️ How to Install the Template\n\n1. **Create the databases in Notion.**  \n   Make sure to use the exact column names and formats as shown in the provided structure.\n\n2. **Import the workflow templat"
      }
    },
    {
      "id": "af4c205f-6a9c-493f-861d-bda18d346cf5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1320,
        200
      ],
      "parameters": {
        "width": 520,
        "height": 140,
        "content": "### 📺 Video Guide\n👉 [https://www.youtube.com/watch?v=rdfRNHpHX8o](https://www.youtube.com/watch?v=rdfRNHpHX8o)\n\n@[youtube](rdfRNHpHX8o)"
      }
    },
    {
      "id": "5acb33a7-5bc2-439f-a648-450fe97073eb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        560
      ],
      "parameters": {
        "width": 180,
        "height": 80,
        "content": "Database = Sources"
      }
    },
    {
      "id": "aa226eb7-84f5-41cc-87dd-a18d163ddf8b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1960,
        420
      ],
      "parameters": {
        "width": 180,
        "height": 80,
        "content": "Database = Reels"
      }
    },
    {
      "id": "4efaf2ee-ef7a-4f72-88cc-12eae7210b1b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1780,
        1260
      ],
      "parameters": {
        "width": 180,
        "height": 80,
        "content": "Database = Reels"
      }
    },
    {
      "id": "c641b324-a620-4cf8-a8ec-1b821b942425",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        1080
      ],
      "parameters": {
        "width": 300,
        "height": 100,
        "content": "This is the prompt used to process video content and classify its category and type. Customize it based on your logic."
      }
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Get Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Owner?": {
      "main": [
        [
          {
            "node": "Update Accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Get dataset items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Reels": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Reels": {
      "main": [
        [
          {
            "node": "Owner?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Variables": {
      "main": [
        [
          {
            "node": "Get Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Status": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Prompt": {
      "main": [
        [
          {
            "node": "Gemini Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Sources": {
      "main": [
        [
          {
            "node": "Apify Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Created?": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Many to One": {
      "main": [
        [
          {
            "node": "Get Reels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run an Actor": {
      "main": [
        [
          {
            "node": "Get Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apify Payload": {
      "main": [
        [
          {
            "node": "Run an Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Upload to Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Analyze": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File State": {
      "main": [
        [
          {
            "node": "Is Uploaded And Active?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Create",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Stats",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Is Created?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Accounts": {
      "main": [
        [
          {
            "node": "Many to One",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Processing Delay": {
      "main": [
        [
          {
            "node": "Get File State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        []
      ]
    },
    "Upload to Gemini": {
      "main": [
        [
          {
            "node": "Processing Delay",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get dataset items": {
      "main": [
        [
          {
            "node": "Map Reels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Uploaded And Active?": {
      "main": [
        [
          {
            "node": "Set Prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Processing Delay",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}