{
  "id": "vSYWa1hSKAvedWWp",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Youtube Channel Intelligence Collector",
  "tags": [],
  "nodes": [
    {
      "id": "c59d8ffd-f78e-4ac5-ae00-19075db988a8",
      "name": "New Channel Added",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ/edit?usp=drivesdk",
          "cachedResultName": "Youtube Channel Intelligence Collector"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4cd2932b-953c-4ece-af21-6b68e7c7fc7c",
      "name": "Get info about channel",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        0
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/channels?part=statistics,snippet&id=UC_x5XG1OV2P6uZZ5FSM9Ttw&key=YOUR_TOKEN_HERE"
      },
      "typeVersion": 4.2
    },
    {
      "id": "57841966-eedc-4ac5-b699-1c8241409880",
      "name": "Get Channel Stats",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        440,
        0
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/search",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "channelId",
              "value": "={{ $json.items[0].id }}"
            },
            {
              "name": "part",
              "value": "snippet"
            },
            {
              "name": "order",
              "value": "date"
            },
            {
              "name": "maxResults",
              "value": "5"
            },
            {
              "name": "key",
              "value": "YOUR_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "86b1b984-aa03-4aed-b4d8-3eb861408e1b",
      "name": "Get Recent Video Views",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        740,
        0
      ],
      "parameters": {
        "url": "=https://www.googleapis.com/youtube/v3/videos?part=statistics&id={{ $json.items[0].id.videoId }},{{ $json.items[1].id.videoId }},{{ $json.items[2].id.videoId }},{{ $json.items[3].id.videoId }},{{ $json.items[4].id.videoId }},def456,ghi789&key=YOUR_KEY",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "edbac4ab-c0c6-402a-b579-45ddb9ee7a87",
      "name": "Prepare views to sum",
      "type": "n8n-nodes-base.set",
      "position": [
        960,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9aaec402-4a0a-4908-a416-35dbe86f4278",
              "name": "Video 1 views",
              "type": "number",
              "value": "={{ $json.items[0].statistics.viewCount }}"
            },
            {
              "id": "5d5eec14-2ca7-41d7-b447-4784de1d77b5",
              "name": "Video 2 views",
              "type": "number",
              "value": "={{ $json.items[1].statistics.viewCount }}"
            },
            {
              "id": "02b2879b-e0bb-4a1e-a0c0-ce59a03bc2de",
              "name": "Video 3 views",
              "type": "number",
              "value": "={{ $json.items[2].statistics.viewCount }}"
            },
            {
              "id": "75d4f2f3-5b07-48d1-b22a-dda29140426e",
              "name": "Video 4 views",
              "type": "number",
              "value": "={{ $json.items[3].statistics.viewCount }}"
            },
            {
              "id": "83e29b86-bb0e-4661-a1a3-6907d46dbc0d",
              "name": "Video 5 views",
              "type": "number",
              "value": "={{ $json.items[4].statistics.viewCount }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "94c8c406-ab91-44f1-aba4-74df7bf2e347",
      "name": "Sum Video Views",
      "type": "n8n-nodes-base.code",
      "position": [
        1180,
        0
      ],
      "parameters": {
        "jsCode": "// Get the first item (your input object)\nconst data = items[0].json;\n\nlet totalViews = 0;\n\nfor (const key in data) {\n  if (data.hasOwnProperty(key) && key.includes('views')) {\n    totalViews += data[key];\n  }\n}\n\nreturn [\n  {\n    json: {\n      ...data,\n      totalViews\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "58f38623-d210-45da-9eb3-71f7914859da",
      "name": "Get Channel Email (SerpAPI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1460,
        0
      ],
      "parameters": {
        "url": "=https://serpapi.com/search.json?engine=youtube_channel_about&channel_url=https://www.youtube.com/channel/{{ $('New Channel Added').item.json['Channel ID'] }}&api_key=YOUR_SERPAPI_KEY",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "a8f1aab2-ad08-4711-9a2c-2d4e953407af",
      "name": "Prepare Sheet Data",
      "type": "n8n-nodes-base.set",
      "position": [
        1680,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9ab4a9fc-15ed-459a-96b6-22d4b8fb05bd",
              "name": "Recent Views",
              "type": "string",
              "value": "={{ $('Sum Video Views').item.json.totalViews }}"
            },
            {
              "id": "4681d235-d066-4d09-9c79-54f2395a6750",
              "name": "Total Subscribers",
              "type": "string",
              "value": "={{ $('Get info about channel').item.json.items[0].statistics.subscriberCount }}"
            },
            {
              "id": "351ec081-ea7f-4ceb-a1f6-038a4747b754",
              "name": "Email",
              "type": "string",
              "value": "={{ $json.channel_about_page.email }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ac7a8ddc-3347-4860-a080-70efcaded6b6",
      "name": "Update Channel Insights",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1980,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.Email }}",
            "Channel ID": "={{ $('New Channel Added').item.json['Channel ID'] }}",
            "Recent Views": "={{ $json['Recent Views'] }}",
            "Total Subscribers": "={{ $json['Total Subscribers'] }}"
          },
          "schema": [
            {
              "id": "Channel ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Channel ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Recent Views",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Recent Views",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Subscribers",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Total Subscribers",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Channel ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ/edit?usp=drivesdk",
          "cachedResultName": "Youtube Channel Intelligence Collector"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "300c814f-fca0-439e-8b4f-3d7031644b42",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -760
      ],
      "parameters": {
        "color": 3,
        "width": 640,
        "height": 960,
        "content": "### \ud83d\udd39 SECTION 1: **Channel Identification & Stats Fetching**\n\n\ud83d\udd14 It all begins when a new channel URL is added to Google Sheets. The `New Channel Added` trigger detects this input and passes it to the next node.\n\n\ud83d\udd0e The `Get Channel ID from URL` node uses YouTube\u2019s Data API to convert the given channel username or custom URL into a valid `channelId`.\n\n\ud83d\udcca Once the channel ID is resolved, the `Get Channel Stats` node fetches vital metrics like subscriber count, total video count, and overall view count \u2014 giving you an immediate sense of the channel\u2019s reach and authority.\n\nThis section acts as the \"identity and reputation layer\" \u2014 establishing who the channel is and how large its audience might be.\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c4da8233-ca33-4f73-b9dc-034216af6a78",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -720
      ],
      "parameters": {
        "color": 5,
        "width": 640,
        "height": 920,
        "content": "## \ud83d\udd39 SECTION 2: **Recent Video Intelligence**\n\n\ud83c\udd95 The `Get Recent Video IDs` node fetches the 5 most recent uploads by the channel using the `search` endpoint, ordered by date. This helps focus on the freshest content for engagement analysis.\n\n\ud83e\uddf9 Next, the `Prepare Video Views to Sum` node extracts and organizes the returned video IDs into a structured format ready for bulk analysis.\n\n\u2795 The `Sum Video Views` node \u2014 a custom Code block \u2014 takes each video ID, fetches its statistics, and aggregates the `viewCount`. You can either sum or average these views to calculate recent performance.\n\nThis section is your \"engagement tracker,\" offering insight into how actively viewers are interacting with the channel\u2019s newest content \u2014 critical for B2B qualification or influencer assessment.\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7a4f720e-380b-4557-bbcc-8cf864b32117",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        -840
      ],
      "parameters": {
        "color": 6,
        "width": 400,
        "height": 1040,
        "content": "### \ud83d\udd39 SECTION 3: **Contact Intelligence**\n\n\u2709\ufe0f The `Get Channel Email (SerpAPI)` node attempts to retrieve the public email address listed on the channel\u2019s \u201cAbout\u201d page. Since this action requires bypassing CAPTCHA (which APIs like YouTube don't support), we use SerpAPI to simulate and extract the result.\n\n\u26a0\ufe0f If no email is available due to protection or limitations, fallback logic can be added later to log this for manual review.\n\nThis section aims to uncover the **real outreach opportunity**, pulling direct contact information when available \u2014 making it a powerful lead-gen component.\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c3c77b39-7d8b-4f9e-9f4c-d8ea5c990f06",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1880,
        -960
      ],
      "parameters": {
        "color": 4,
        "width": 340,
        "height": 1160,
        "content": "### \ud83d\udd39 SECTION 4: **Data Assembly & Sheet Update**\n\n\ud83e\udde9 The `Prepare Sheet Data` node cleanly formats all collected insights \u2014 channel statistics, recent video performance, and email \u2014 into one tidy object.\n\n\ud83d\udce4 Finally, the `Update Channel Insights` node updates the original Google Sheet row with the newly enriched data. This makes your sheet a live intelligence dashboard, auto-updated every time a new channel is added.\n\nThis last section is the \"insight publishing engine,\" ensuring all collected intelligence is centralized, structured, and ready for decision-making or follow-up.\n\n---\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3d4d8722-e423-4941-8413-4953ec41487c",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1660,
        -760
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "=======================================\n            WORKFLOW ASSISTANCE\n=======================================\nFor any questions or support, please contact:\n    Yaron@nofluff.online\n\nExplore more tips and tutorials here:\n   - YouTube: https://www.youtube.com/@YaronBeen/videos\n   - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n=======================================\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9d04bc2b-eea5-4d93-9b43-044011b99876",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1660,
        -420
      ],
      "parameters": {
        "color": 4,
        "width": 1289,
        "height": 1938,
        "content": "## \ud83c\udfaf **YouTube Channel Intelligence Collector \u2014 Grouped Workflow Overview**\n\n---\n\n### \ud83d\udd39 SECTION 1: **Channel Identification & Stats Fetching**\n\n\ud83d\udd14 It all begins when a new channel URL is added to Google Sheets. The `New Channel Added` trigger detects this input and passes it to the next node.\n\n\ud83d\udd0e The `Get Channel ID from URL` node uses YouTube\u2019s Data API to convert the given channel username or custom URL into a valid `channelId`.\n\n\ud83d\udcca Once the channel ID is resolved, the `Get Channel Stats` node fetches vital metrics like subscriber count, total video count, and overall view count \u2014 giving you an immediate sense of the channel\u2019s reach and authority.\n\nThis section acts as the \"identity and reputation layer\" \u2014 establishing who the channel is and how large its audience might be.\n\n---\n\n### \ud83d\udd39 SECTION 2: **Recent Video Intelligence**\n\n\ud83c\udd95 The `Get Recent Video IDs` node fetches the 5 most recent uploads by the channel using the `search` endpoint, ordered by date. This helps focus on the freshest content for engagement analysis.\n\n\ud83e\uddf9 Next, the `Prepare Video Views to Sum` node extracts and organizes the returned video IDs into a structured format ready for bulk analysis.\n\n\u2795 The `Sum Video Views` node \u2014 a custom Code block \u2014 takes each video ID, fetches its statistics, and aggregates the `viewCount`. You can either sum or average these views to calculate recent performance.\n\nThis section is your \"engagement tracker,\" offering insight into how actively viewers are interacting with the channel\u2019s newest content \u2014 critical for B2B qualification or influencer assessment.\n\n---\n\n### \ud83d\udd39 SECTION 3: **Contact Intelligence**\n\n\u2709\ufe0f The `Get Channel Email (SerpAPI)` node attempts to retrieve the public email address listed on the channel\u2019s \u201cAbout\u201d page. Since this action requires bypassing CAPTCHA (which APIs like YouTube don't support), we use SerpAPI to simulate and extract the result.\n\n\u26a0\ufe0f If no email is available due to protection or limitations, fallback logic can be added later to log this for manual review.\n\nThis section aims to uncover the **real outreach opportunity**, pulling direct contact information when available \u2014 making it a powerful lead-gen component.\n\n---\n\n### \ud83d\udd39 SECTION 4: **Data Assembly & Sheet Update**\n\n\ud83e\udde9 The `Prepare Sheet Data` node cleanly formats all collected insights \u2014 channel statistics, recent video performance, and email \u2014 into one tidy object.\n\n\ud83d\udce4 Finally, the `Update Channel Insights` node updates the original Google Sheet row with the newly enriched data. This makes your sheet a live intelligence dashboard, auto-updated every time a new channel is added.\n\nThis last section is the \"insight publishing engine,\" ensuring all collected intelligence is centralized, structured, and ready for decision-making or follow-up.\n\n---\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7a80e42b-85b9-4bb9-8f43-adea423f228d",
  "connections": {
    "Sum Video Views": {
      "main": [
        [
          {
            "node": "Get Channel Email (SerpAPI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Channel Stats": {
      "main": [
        [
          {
            "node": "Get Recent Video Views",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Channel Added": {
      "main": [
        [
          {
            "node": "Get info about channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Sheet Data": {
      "main": [
        [
          {
            "node": "Update Channel Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare views to sum": {
      "main": [
        [
          {
            "node": "Sum Video Views",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Recent Video Views": {
      "main": [
        [
          {
            "node": "Prepare views to sum",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get info about channel": {
      "main": [
        [
          {
            "node": "Get Channel Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Channel Email (SerpAPI)": {
      "main": [
        [
          {
            "node": "Prepare Sheet Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}