Find Top-Performing Instagram Reels

    Shared 3/26/2026

    0 views

    Visual Workflow

    JSON Code

    {
      "id": "kKQ6VO7BTmdPrJQp",
      "meta": {
        "instanceId": "8e3adddb80cb919276d19aa7fe4a50a51ae79294fa814d909ccd77e5557b180e",
        "templateCredsSetupCompleted": true
      },
      "name": "Find Top-Performing Instagram Reels",
      "tags": [],
      "nodes": [
        {
          "id": "b2ead21e-7679-492b-9519-3b88475f7958",
          "name": "Sticky Note",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            112,
            560
          ],
          "parameters": {
            "color": 7,
            "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=rdfRNHpHX8o)\n\n\n### πŸ“„ Download Notion Database Structure  \nYou can download the Notion table structure (with all required columns and formats) here:  \nπŸ‘‰ [https://drive.google.com/file/d/1FVaS_-ztp6PDAJbETUb1dkg8IqE4qHqp/view?usp=sharing](https://drive.google.com/file/d/1FVaS_-ztp6PDAJbETUb1dkg8IqE4qHqp/view?usp=sharing)\n\n### β˜• Support the Project  \nIf you'd like to support my work, there's a version with tips available here:\nπŸ‘‰ [Coffee + Sandwich Version](https://gr.egrnkvch.com/l/InstagramReelsTrendWatcher)\n"
          },
          "typeVersion": 1
        },
        {
          "id": "27ddd116-3276-49c7-b590-307d7bba1c26",
          "name": "Sticky Note1",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            688,
            560
          ],
          "parameters": {
            "color": 7,
            "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 template into n8n.**\n\n3. **Add your Credentials:**\n   - **Notion**: Standard Notion integration  \n   - **Apify**: Create and connect your Apify API key\n\n4. **Gemini API is used via HTTP Request node.**  \n   Use the following settings:  \n   - `Authentication`: **Predefined Credential Type**  \n   - `Credential Type`: **Google Gemini (PaLM) API**  \n   - `Host`: `https://generativelanguage.googleapis.com`  \n   - API key: your personal Gemini API key\n\n5. **Assign these credentials** in the corresponding nodes inside the workflow.\n\n6. **Configure the Variables node** to set parsing parameters.  \n   Test the process with 3–5 accounts, each with 3–5 Reels.  \n   Once everything works, update the Variables with your full settings.\n"
          },
          "typeVersion": 1
        },
        {
          "id": "5728900c-4dd7-4051-899a-15801fe95ca6",
          "name": "Sticky Note2",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            112,
            992
          ],
          "parameters": {
            "color": 7,
            "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)"
          },
          "typeVersion": 1
        },
        {
          "id": "23b95d01-7e46-4989-a095-946c42bab576",
          "name": "Get Sources1",
          "type": "n8n-nodes-base.notion",
          "position": [
            1328,
            1488
          ],
          "parameters": {
            "options": {},
            "resource": "databasePage",
            "operation": "getAll",
            "returnAll": true,
            "databaseId": {
              "__rl": true,
              "mode": "list",
              "value": "94adc7af-7cc6-45e2-8932-b51560725447",
              "cachedResultUrl": "https://www.notion.so/94adc7af7cc645e28932b51560725447",
              "cachedResultName": "Sources"
            }
          },
          "credentials": {
            "notionApi": {
              "id": "SQvJwqXUu7kMT7sD",
              "name": "Notion account"
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "6ecd4cd6-1fbb-43bf-9b57-5c5c3a55cf0e",
          "name": "Variables1",
          "type": "n8n-nodes-base.code",
          "position": [
            1136,
            1488
          ],
          "parameters": {
            "jsCode": "const variables = {\n  // https://apify.com/apify/instagram-scraper \n  // Instagram Scraper = apify/instagram-scraper, \n  \"scrapingActorId\" : \"shu8hvrXbJbY3Eb9W\", // ID of Apify scraper\n  \"daysLimit\" : 9, // Date limit \n  \"resultsLimit\" : 7, // Results per account\n  \"maxDays\" : 3, // Sleeping || Active\n  \"translationLang\" : \"English\",\n}\n\n\nreturn [{json : variables}]"
          },
          "typeVersion": 2
        },
        {
          "id": "10f7dd66-bb7f-479e-ad34-916d7a94653e",
          "name": "Apify Payload1",
          "type": "n8n-nodes-base.code",
          "position": [
            1776,
            1472
          ],
          "parameters": {
            "jsCode": "// required Simplify = true\n\nconst query = {\n    \"addParentData\": false,\n    \"directUrls\": [],\n    \"enhanceUserSearchWithFacebookPage\": false,\n    \"isUserReelFeedURL\": false,\n    \"isUserTaggedFeedURL\": false,\n    \"onlyPostsNewerThan\": ($('Variables1').first().json.daysLimit ?? 10) + ' days',\n    \"resultsLimit\": $('Variables1').first().json.resultsLimit ?? 5,\n    \"skipPinnedPosts\": true\n};\n\nconst urls = [];\nconst map = {};\n\nitems.forEach(item => {\n  const username = item.json.property_username || '';\n  if (username) {\n    urls.push('https://www.instagram.com/' + username + '/');\n    map[username.toLowerCase()] = item.json.id;   // Notion pageId\n  }\n});\n\nquery.directUrls = urls;\n\nreturn [\n  {\n    json: {\n      query,\n      urls,\n      map     \n    }\n  }\n];\n"
          },
          "typeVersion": 2
        },
        {
          "id": "541f022f-7f3f-4cf9-96bb-dcc5e124b881",
          "name": "Scrape Instagram Video1",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1568,
            1648
          ],
          "parameters": {
            "url": "https://api.apify.com/v2/acts/shu8hvrXbJbY3Eb9W/run-sync-get-dataset-items",
            "method": "POST",
            "options": {
              "redirect": {
                "redirect": {}
              }
            },
            "jsonBody": "={\n    \"addParentData\": false,\n    \"directUrls\": [\n        \"{{ $json.query.directUrls[0] }}\"\n    ],\n    \"enhanceUserSearchWithFacebookPage\": false,\n    \"isUserReelFeedURL\": false,\n    \"isUserTaggedFeedURL\": false,\n    \"resultsLimit\": 10,\n    \"resultsType\": \"reels\",\n    \"searchLimit\": 20,\n    \"searchType\": \"hashtag\"\n}",
            "sendBody": true,
            "sendQuery": true,
            "sendHeaders": true,
            "specifyBody": "json",
            "queryParameters": {
              "parameters": [
                {
                  "name": "token",
                  "value": "apify_api_W1lIGCuU21mUCp7MYl0aXAki8pcCXM3uvjDA"
                }
              ]
            },
            "headerParameters": {
              "parameters": [
                {
                  "name": "Accept",
                  "value": "application/json"
                }
              ]
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "79c6fa6b-a375-40a7-8f63-43eeb41370e7",
          "name": "Run actor1",
          "type": "n8n-nodes-apify.apify",
          "position": [
            2016,
            1472
          ],
          "parameters": {
            "build": "",
            "memory": null,
            "actorId": {
              "__rl": true,
              "mode": "id",
              "value": "=shu8hvrXbJbY3Eb9W"
            },
            "maxItems": null,
            "resource": "Actors",
            "webhooks": "",
            "operation": "Run actor",
            "customBody": "={{ $json.query.toJsonString() }}",
            "useCustomBody": true,
            "waitForFinish": null,
            "requestOptions": {}
          },
          "credentials": {
            "apifyApi": {
              "id": "laBIopYhUm8natFM",
              "name": "Apify account 2"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "f6703b7a-f471-4c5c-9586-179b80b430a9",
          "name": "Get Status1",
          "type": "n8n-nodes-apify.apify",
          "position": [
            2208,
            1472
          ],
          "parameters": {
            "runId": {
              "__rl": true,
              "mode": "id",
              "value": "={{ $json.data.id }}"
            },
            "actorId": {
              "__rl": true,
              "mode": "id",
              "value": "={{ $json.data.actId }}"
            },
            "resource": "Actors",
            "operation": "Get run",
            "requestOptions": {}
          },
          "credentials": {
            "apifyApi": {
              "id": "laBIopYhUm8natFM",
              "name": "Apify account 2"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "62732c5a-f246-42d4-b6c6-5333b13fd905",
          "name": "Switch1",
          "type": "n8n-nodes-base.switch",
          "position": [
            2432,
            1456
          ],
          "parameters": {
            "rules": {
              "values": [
                {
                  "outputKey": "Done",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "96d0046b-c9ab-429e-b35c-3d7518564c1b",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.data.status }}",
                        "rightValue": "SUCCEEDED"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Running",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "5b1c311d-10cf-4e6f-a55c-f311c75ef444",
                        "operator": {
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Get Status1').item.json.data.status }}",
                        "rightValue": "RUNNING"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Ready",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "8376a12a-87c9-4878-b654-1c91fdfb31a2",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Get Status1').item.json.data.status }}",
                        "rightValue": "READY"
                      }
                    ]
                  },
                  "renameOutput": true
                }
              ]
            },
            "options": {}
          },
          "typeVersion": 3.2
        },
        {
          "id": "574d7fb8-d3a3-44ec-a9d7-706c36240ecf",
          "name": "Wait1",
          "type": "n8n-nodes-base.wait",
          "position": [
            2640,
            1584
          ],
          "webhookId": "6a6311dc-42d5-4329-93a2-ccd76057b31d",
          "parameters": {
            "unit": "minutes",
            "amount": 1
          },
          "typeVersion": 1.1
        },
        {
          "id": "5c2d757f-b420-46d2-94cf-b722085c9af0",
          "name": "Get items1",
          "type": "n8n-nodes-apify.apify",
          "position": [
            2640,
            1440
          ],
          "parameters": {
            "desc": false,
            "omit": "",
            "limit": null,
            "fields": "",
            "offset": null,
            "unwind": "",
            "flatten": "",
            "resource": "Datasets",
            "datasetId": "={{ $json.data.defaultDatasetId }}",
            "operation": "Get items",
            "attachment": false,
            "requestOptions": {}
          },
          "credentials": {
            "apifyApi": {
              "id": "laBIopYhUm8natFM",
              "name": "Apify account 2"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "251f08a7-ffb4-4189-82b0-e3f6d7fa6b89",
          "name": "Map Reels1",
          "type": "n8n-nodes-base.code",
          "position": [
            2864,
            1440
          ],
          "parameters": {
            "jsCode": "const maxDays = $('Variables1').first()?.json?.maxDays ?? 3;  \nconst now     = new Date();\n\n// Extract data array from the first item's json.data\nconst inputData = items[0]?.json?.data || [];\nconst map       = $('Apify Payload1').first().json.map;\n\nconst acctStatus = {};\n\nfor (const itm of inputData) {\n  const owner = itm.ownerUsername?.toLowerCase();\n  if (!owner) continue;\n  \n  const ts    = new Date(itm.timestamp);\n  const diff  = (now - ts) / 86_400_000;    \n  \n  if (!acctStatus[owner] || acctStatus[owner] === 'Sleeping') {\n    acctStatus[owner] = diff <= maxDays ? 'Active' : 'Sleeping';\n  }\n}\n\nfor (const k in inputData) {\n  const item   = inputData[k];\n  const owner  = item.ownerUsername?.toLowerCase();\n  \n  if (owner) {\n    item.notionPageId     = map[owner];\n    item.publishingStatus = acctStatus[owner];\n  }\n  \n  inputData[k] = item;\n}\n\n// Return each item as a separate n8n item (not wrapped in data array)\nreturn inputData.map(item => ({ json: item }));"
          },
          "typeVersion": 2
        },
        {
          "id": "07457b8c-023e-4220-9666-138fdd126247",
          "name": "Owner?1",
          "type": "n8n-nodes-base.if",
          "position": [
            3088,
            1440
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "7b88be8b-60c6-47b1-8a6a-4f5b97d71234",
                  "operator": {
                    "type": "string",
                    "operation": "notEmpty",
                    "singleValue": true
                  },
                  "leftValue": "={{ $json.notionPageId }}",
                  "rightValue": ""
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "ddb8dfbf-48d6-4ccc-ab44-59c5a3a8a873",
          "name": "Update Accounts1",
          "type": "n8n-nodes-base.notion",
          "position": [
            3296,
            1424
          ],
          "parameters": {
            "pageId": {
              "__rl": true,
              "mode": "id",
              "value": "={{ $json.notionPageId }}"
            },
            "options": {},
            "resource": "databasePage",
            "operation": "update",
            "propertiesUi": {
              "propertyValues": [
                {
                  "key": "Status|select",
                  "selectValue": "={{ $json.publishingStatus }}"
                },
                {
                  "key": "Title|title",
                  "title": "={{ $json.ownerFullName }}"
                },
                {
                  "key": "URL|url",
                  "urlValue": "={{ $json.inputUrl }}"
                }
              ]
            }
          },
          "credentials": {
            "notionApi": {
              "id": "SQvJwqXUu7kMT7sD",
              "name": "Notion account"
            }
          },
          "typeVersion": 2
        },
        {
          "id": "643e9414-3985-49d3-9198-61c27295fd1e",
          "name": "Many to One1",
          "type": "n8n-nodes-base.code",
          "position": [
            3520,
            1424
          ],
          "parameters": {
            "jsCode": "const accountsMap = {};\nitems.forEach(item => {\n  const username = item.json.ownerUsername || '';  // Changed from property_username\n  if (username) {\n    accountsMap[username.toLowerCase()] = item.json.notionPageId;   // Changed from id\n  }\n});\n\nreturn [\n  {\n    json: {\n      map: accountsMap,  // Changed key name to 'map' to match your usage in \"Apify Payload1\"\n      items\n    }\n  }\n];"
          },
          "typeVersion": 2
        },
        {
          "id": "2b3cc851-70fd-4cc6-85a5-e347f90efeeb",
          "name": "Get Reels1",
          "type": "n8n-nodes-base.notion",
          "position": [
            3712,
            1424
          ],
          "parameters": {
            "filters": {
              "conditions": [
                {
                  "key": "Date|date",
                  "date": "={{ new Date(Date.now() - $('Variables1').first().json.daysLimit * 24 * 60 * 60 * 1000).toISOString().split('T')[0] }}",
                  "condition": "after"
                }
              ]
            },
            "options": {},
            "resource": "databasePage",
            "operation": "getAll",
            "returnAll": true,
            "databaseId": {
              "__rl": true,
              "mode": "list",
              "value": "09b972cf-a79f-44ed-979e-992081c4176b",
              "cachedResultUrl": "https://www.notion.so/09b972cfa79f44ed979e992081c4176b",
              "cachedResultName": "Reels"
            },
            "filterType": "manual"
          },
          "credentials": {
            "notionApi": {
              "id": "SQvJwqXUu7kMT7sD",
              "name": "Notion account"
            }
          },
          "executeOnce": false,
          "typeVersion": 2.2,
          "alwaysOutputData": true
        },
        {
          "id": "47e1e5b5-9499-4c91-a595-32e1afa1ace7",
          "name": "Code1",
          "type": "n8n-nodes-base.code",
          "position": [
            3888,
            1424
          ],
          "parameters": {
            "jsCode": "const existingPages = {};\nfor (const page of $items('Get Reels1')) {\n  const source = page.json.property_url ?? '';\n  if (source) existingPages[source] = page.json;\n}\n\nconst output = [];\nconst accountsMap = $('Many to One1').first().json.map;  // Changed from accountsMap\n\nfor (const reel of $items('Map Reels1')) {\n  const source = reel.json.url;          \n  const views  = reel.json.videoViewCount;\n  \n  var update = {\n    \"Code\": reel.json.shortCode,\n    \"SignedCode\": reel.json.shortCode + '-' + Math.random(),\n    \"Type\": reel.json.type,\n    \"IsCreated\": false,\n    \"notionAccountPageId\": reel.json.notionPageId,  // Already mapped in previous node\n    \"Views\": views ? views : reel.json.videoPlayCount,\n    \"Likes\": reel.json.likesCount,\n    \"Comments\": reel.json.commentsCount,\n    \"Saves\": reel.json.savesCount ?? 0,\n    \"Shares\": reel.json.sharesCount ?? 0,\n    \"Updated\": new Date().toISOString()\n  };\n  \n  /* ------------------------------------------------- */\n  if (existingPages[source]) {\n    update.notionPageId = existingPages[source].id;\n  } else {\n    update['IsCreated'] = true;\n    update['Caption'] = reel.json.caption;\n    update['URL'] = reel.json.url;\n    update['Hashtags'] = (reel.json.hashtags ?? []).join(', ');\n    update['Duration'] = reel.json.videoDuration;\n    update['Date'] = reel.json.timestamp;\n    update['videoUrl'] = reel.json.videoUrl;\n  }\n  \n  output.push({json: update});\n}\n\nreturn output;   // n8n continues with one array containing both kinds of items"
          },
          "typeVersion": 2
        },
        {
          "id": "b56022b0-d217-4826-9126-094d6d1d9657",
          "name": "Is Created?1",
          "type": "n8n-nodes-base.switch",
          "position": [
            4464,
            1440
          ],
          "parameters": {
            "rules": {
              "values": [
                {
                  "outputKey": "Create",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "bed205cb-cc58-4f99-af5e-7565257ea7c4",
                        "operator": {
                          "type": "boolean",
                          "operation": "true",
                          "singleValue": true
                        },
                        "leftValue": "={{ $json.IsCreated && $json.notionAccountPageId != null }}",
                        "rightValue": ""
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Update",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "042c2e67-6f4d-4909-a73d-eb43864203dd",
                        "operator": {
                          "type": "boolean",
                          "operation": "true",
                          "singleValue": true
                        },
                        "leftValue": "={{ !$json.IsCreated && $json.notionAccountPageId != null }}",
                        "rightValue": ""
                      }
                    ]
                  },
                  "renameOutput": true
                }
              ]
            },
            "options": {}
          },
          "typeVersion": 3.2
        },
        {
          "id": "dcce64de-c6dc-4036-9dc4-9b18ad260097",
          "name": "Stats1",
          "type": "n8n-nodes-base.code",
          "position": [
            4464,
            1280
          ],
          "parameters": {
            "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n}\n\nreturn $input.all();"
          },
          "typeVersion": 2
        },
        {
          "id": "8e1fa26c-b730-4af4-b936-0ef540e172ef",
          "name": "Update1",
          "type": "n8n-nodes-base.notion",
          "position": [
            4720,
            1664
          ],
          "parameters": {
            "pageId": {
              "__rl": true,
              "mode": "id",
              "value": "={{ $json.notionPageId }}"
            },
            "options": {},
            "resource": "databasePage",
            "operation": "update",
            "propertiesUi": {
              "propertyValues": [
                {
                  "key": "# Comments|number",
                  "numberValue": "={{ $json.Comments }}"
                },
                {
                  "key": "# Likes|number",
                  "numberValue": "={{ $json.Likes }}"
                },
                {
                  "key": "# Views|number",
                  "numberValue": "={{ $json.Views }}"
                }
              ]
            }
          },
          "credentials": {
            "notionApi": {
              "id": "SQvJwqXUu7kMT7sD",
              "name": "Notion account"
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "bbf6260e-f188-4e34-85ef-92df7d6a6336",
          "name": "Create1",
          "type": "n8n-nodes-base.notion",
          "onError": "continueRegularOutput",
          "position": [
            5264,
            1424
          ],
          "parameters": {
            "title": "={{ $json.filmTitle }}",
            "options": {},
            "resource": "databasePage",
            "databaseId": {
              "__rl": true,
              "mode": "list",
              "value": "09b972cf-a79f-44ed-979e-992081c4176b",
              "cachedResultUrl": "https://www.notion.so/09b972cfa79f44ed979e992081c4176b",
              "cachedResultName": "Reels"
            },
            "propertiesUi": {
              "propertyValues": [
                {
                  "key": "Date|date",
                  "date": "={{ $('Is Created?1').item.json.Date }}"
                },
                {
                  "key": "Caption|rich_text",
                  "textContent": "={{ $('Is Created?1').item.json.Caption }}"
                },
                {
                  "key": "# Duration|number",
                  "numberValue": "={{ $('Is Created?1').item.json.Duration }}"
                },
                {
                  "key": "# Likes|number",
                  "numberValue": "={{ $('Is Created?1').item.json.Likes }}"
                },
                {
                  "key": "Parsed Date|date",
                  "date": "={{ $now }}"
                },
                {
                  "key": "URL|url",
                  "urlValue": "={{ $('Is Created?1').item.json.URL }}"
                },
                {
                  "key": "# Views|number",
                  "numberValue": "={{ $('Is Created?1').item.json.Views }}"
                },
                {
                  "key": "# Comments|number",
                  "numberValue": "={{ $('Is Created?1').item.json.Comments }}"
                },
                {
                  "key": "Author|relation",
                  "relationValue": [
                    "={{ $('Code1').item.json.notionAccountPageId }}"
                  ]
                },
                {
                  "key": "Type|select",
                  "selectValue": "={{ $('Code1').item.json.Type }}"
                },
                {
                  "key": "Review|status",
                  "statusValue": "Pending"
                },
                {
                  "key": "Download Link|url",
                  "urlValue": "={{ $('Is Created?1').item.json.videoUrl }}"
                }
              ]
            }
          },
          "credentials": {
            "notionApi": {
              "id": "SQvJwqXUu7kMT7sD",
              "name": "Notion account"
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "91da1bcf-93e3-4215-adf7-5c677fe25cb1",
          "name": "Read Title",
          "type": "@n8n/n8n-nodes-langchain.openAi",
          "onError": "continueRegularOutput",
          "position": [
            4704,
            1424
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-5-mini",
              "cachedResultName": "GPT-5-MINI"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "content": "=Based on this caption: {{ $json.Caption }}\n\nList these 3 things: film title, actors from the film, 1 short sentence summary of the original caption. If you can't find the film or don't recognize put all 3 to \"undefined\""
                }
              ]
            }
          },
          "credentials": {
            "openAiApi": {
              "id": "SnUgGOm3sY2PE6i1",
              "name": "OpenAi account 3"
            }
          },
          "typeVersion": 1.8
        },
        {
          "id": "c2c8fcac-8e1e-40ea-a111-e6fd3b598c8e",
          "name": "Code5",
          "type": "n8n-nodes-base.code",
          "position": [
            5056,
            1424
          ],
          "parameters": {
            "jsCode": "function getLine(content, pattern) {\n  const m = content.match(pattern);\n  return m ? m[1].trim() : \"\";\n}\n\nlet content = ($input.first().json.message.content ?? \"\").toString();\n\n// Normalize escaped newlines to real newlines (and CRLF)\ncontent = content.replace(/\\\\r\\\\n|\\\\n|\\\\r/g, \"\\n\").trim();\n\n// Patterns: allow optional bullet/number, and label variants. Capture to end of line.\nconst title = getLine(\n  content,\n  /^\\s*(?:[-*]|\\d+\\))?\\s*Film\\s*title\\s*:\\s*(.+)$/mi\n);\n\nconst actorsRaw = getLine(\n  content,\n  /^\\s*(?:[-*]|\\d+\\))?\\s*Actors?\\s*(?:from|in)?\\s*(?:the\\s*film)?\\s*:\\s*(.+)$/mi\n);\n\nconst summary = getLine(\n  content,\n  /^\\s*(?:[-*]|\\d+\\))?\\s*(?:Short\\s*summary|1-?sentence\\s*summary(?:\\s*of\\s*the\\s*caption)?)\\s*:\\s*(.+)$/mi\n);\n\n// Split actors: commas and β€œand”\nconst actors = actorsRaw\n  .replace(/\\s+and\\s+/gi, \", \")\n  .split(/\\s*,\\s*/)\n  .map(s => s.trim())\n  .filter(Boolean);\n\nconst formatted = [\n  title ? `Title: ${title}` : \"\",\n  actors.length ? `Actors: ${actors.join(\"; \")}` : \"\",\n  summary ? `Summary: ${summary}` : \"\"\n].filter(Boolean).join(\"\\n\");\n\nreturn [\n  {\n    json: {\n      filmTitle: title,\n      actors,\n      summary,\n      formatted\n    }\n  }\n];\n"
          },
          "typeVersion": 2
        },
        {
          "id": "17de04d3-44a1-40da-a8ee-ed8713c0a11a",
          "name": "If",
          "type": "n8n-nodes-base.if",
          "position": [
            1536,
            1488
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "9e4237cb-5f6b-44e9-a2c8-3a4d266fe69a",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json.property_ignore }}",
                  "rightValue": "No"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "3a0b418f-e2c1-4c82-a951-6a1cdc32a916",
          "name": "Loop Over Items1",
          "type": "n8n-nodes-base.splitInBatches",
          "position": [
            4192,
            1424
          ],
          "parameters": {
            "options": {},
            "batchSize": "=1"
          },
          "typeVersion": 3
        },
        {
          "id": "26292cf7-f25a-408e-8dde-9ec5096676f3",
          "name": "Schedule Trigger",
          "type": "n8n-nodes-base.scheduleTrigger",
          "position": [
            896,
            1488
          ],
          "parameters": {
            "rule": {
              "interval": [
                {
                  "daysInterval": 2,
                  "triggerAtHour": 8
                }
              ]
            }
          },
          "typeVersion": 1.3
        }
      ],
      "active": true,
      "pinData": {},
      "settings": {
        "timezone": "Europe/Brussels",
        "binaryMode": "separate",
        "callerPolicy": "workflowsFromSameOwner",
        "timeSavedMode": "fixed",
        "availableInMCP": false,
        "executionOrder": "v1"
      },
      "versionId": "12c77515-201a-405b-9645-8ec93384fc9b",
      "connections": {
        "If": {
          "main": [
            [
              {
                "node": "Apify Payload1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Code1": {
          "main": [
            [
              {
                "node": "Loop Over Items1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Code5": {
          "main": [
            [
              {
                "node": "Create1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Wait1": {
          "main": [
            [
              {
                "node": "Get Status1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Create1": {
          "main": [
            [
              {
                "node": "Loop Over Items1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Owner?1": {
          "main": [
            [
              {
                "node": "Update Accounts1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Switch1": {
          "main": [
            [
              {
                "node": "Get items1",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Wait1",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Wait1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Update1": {
          "main": [
            [
              {
                "node": "Loop Over Items1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get Reels1": {
          "main": [
            [
              {
                "node": "Code1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get items1": {
          "main": [
            [
              {
                "node": "Map Reels1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Map Reels1": {
          "main": [
            [
              {
                "node": "Owner?1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Read Title": {
          "main": [
            [
              {
                "node": "Code5",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Run actor1": {
          "main": [
            [
              {
                "node": "Get Status1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Variables1": {
          "main": [
            [
              {
                "node": "Get Sources1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get Status1": {
          "main": [
            [
              {
                "node": "Switch1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get Sources1": {
          "main": [
            [
              {
                "node": "If",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Is Created?1": {
          "main": [
            [
              {
                "node": "Read Title",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Update1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Many to One1": {
          "main": [
            [
              {
                "node": "Get Reels1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Apify Payload1": {
          "main": [
            [
              {
                "node": "Run actor1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Loop Over Items1": {
          "main": [
            [
              {
                "node": "Stats1",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Is Created?1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Schedule Trigger": {
          "main": [
            [
              {
                "node": "Variables1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Update Accounts1": {
          "main": [
            [
              {
                "node": "Many to One1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Scrape Instagram Video1": {
          "main": [
            []
          ]
        }
      }
    }