AutomationFlowsSocial Media › Automate Youtube Channel Analytics Reports to Telegram Weekly

Automate Youtube Channel Analytics Reports to Telegram Weekly

ByAbdul Aziz Ahwan @abdulazizahwan on n8n.io

Tired of manually checking your YouTube Studio every day just to see how your channel is performing? This workflow is your solution.

Cron / scheduled trigger★★★★☆ complexity17 nodesHTTP RequestTelegram
Social Media Trigger: Cron / scheduled Nodes: 17 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #8554 — we link there as the canonical source.

This workflow follows the HTTP Request → Telegram recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "aPiq5niR5CX4IKG0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "YouTube Analytics Weekly Report",
  "tags": [
    {
      "id": "os3elkx460WptGK8",
      "name": "abdulazizahwan",
      "createdAt": "2025-07-21T03:08:06.372Z",
      "updatedAt": "2025-07-21T03:08:06.372Z"
    }
  ],
  "nodes": [
    {
      "id": "08eb2d97-5306-47ce-8571-3ad837bc6c52",
      "name": "Channel Summary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        -720
      ],
      "parameters": {
        "url": "https://youtubeanalytics.googleapis.com/v2/reports ",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "ids",
              "value": "channel==MINE"
            },
            {
              "name": "startDate",
              "value": "={{ $now.minus({ weeks: 1 }).toISODate() }}"
            },
            {
              "name": "endDate",
              "value": "={{ $now.toISODate() }}"
            },
            {
              "name": "metrics",
              "value": "=views,estimatedMinutesWatched,averageViewDuration,likes,comments,subscribersGained,subscribersLost"
            },
            {
              "name": "dimensions",
              "value": "=day"
            },
            {
              "name": "sort",
              "value": "day"
            }
          ]
        },
        "nodeCredentialType": "googleOAuth2Api"
      },
      "credentials": {
        "googleOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cea3c6b3-f849-420e-9df2-bcd55c9c3ff3",
      "name": "Top Videos Week",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        -496
      ],
      "parameters": {
        "url": "https://youtubeanalytics.googleapis.com/v2/reports ",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "ids",
              "value": "channel==MINE"
            },
            {
              "name": "startDate",
              "value": "={{ $now.minus({ weeks: 1 }).toISODate() }}"
            },
            {
              "name": "endDate",
              "value": "={{ $now.toISODate() }}"
            },
            {
              "name": "metrics",
              "value": "=views,estimatedMinutesWatched,averageViewDuration"
            },
            {
              "name": "dimensions",
              "value": "=video"
            },
            {
              "name": "sort",
              "value": "=-views"
            },
            {
              "name": "maxResults",
              "value": "=5"
            }
          ]
        },
        "nodeCredentialType": "googleOAuth2Api"
      },
      "credentials": {
        "googleOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f87af746-24f4-43a5-82c1-400c5cf70b68",
      "name": "Traffic Source",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        -144
      ],
      "parameters": {
        "url": "https://youtubeanalytics.googleapis.com/v2/reports ",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "ids",
              "value": "channel==MINE"
            },
            {
              "name": "startDate",
              "value": "={{ $now.minus({ weeks: 1 }).toISODate() }}"
            },
            {
              "name": "endDate",
              "value": "={{ $now.toISODate() }}"
            },
            {
              "name": "metrics",
              "value": "=views,estimatedMinutesWatched"
            },
            {
              "name": "dimensions",
              "value": "=insightTrafficSourceType"
            },
            {
              "name": "sort",
              "value": "views"
            }
          ]
        },
        "nodeCredentialType": "googleOAuth2Api"
      },
      "credentials": {
        "googleOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2bf25aae-c867-46a8-8f4f-968553448659",
      "name": "Audience Demographics",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        64
      ],
      "parameters": {
        "url": "https://youtubeanalytics.googleapis.com/v2/reports ",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "ids",
              "value": "channel==MINE"
            },
            {
              "name": "startDate",
              "value": "={{ $now.minus({ weeks: 1 }).toISODate() }}"
            },
            {
              "name": "endDate",
              "value": "={{ $now.toISODate() }}"
            },
            {
              "name": "metrics",
              "value": "=viewerPercentage"
            },
            {
              "name": "dimensions",
              "value": "=ageGroup,gender"
            },
            {
              "name": "sort",
              "value": "=ageGroup,gender"
            }
          ]
        },
        "nodeCredentialType": "googleOAuth2Api"
      },
      "credentials": {
        "googleOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5c0f2672-7568-4db6-897e-665a4cce7382",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2528,
        -272
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "chatId": "123456789",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "227fce63-b178-485b-8f9c-d316820012be",
      "name": "Turn Id to Title",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1136,
        -352
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/videos",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "part",
              "value": "snippet,statistics"
            },
            {
              "name": "id",
              "value": "={{$json.videoIdsCsv}}"
            }
          ]
        },
        "nodeCredentialType": "googleOAuth2Api"
      },
      "credentials": {
        "googleOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a129db52-cddf-43dc-8028-ba6aa00953d8",
      "name": "Audience Demographics Formatter",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        64
      ],
      "parameters": {
        "jsCode": "// Input: 1 item berisi response JSON dari HTTP node di field 'data'\nconst res = items[0].json; // sesuaikan kalau output Anda beda\nconst headers = res.columnHeaders.map(h => h.name);\nconst out = (res.rows || []).map(r => {\n  const obj = {};\n  headers.forEach((h, i) => obj[h] = r[i]);\n  return obj;\n});\nreturn out.map(o => ({ json: o }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d84e6e62-be1f-46d2-9700-d086bfa7e3f9",
      "name": "Traffic Source Formatter",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        -144
      ],
      "parameters": {
        "jsCode": "// Input: 1 item berisi response JSON dari HTTP node di field 'data'\nconst res = items[0].json; // sesuaikan kalau output Anda beda\nconst headers = res.columnHeaders.map(h => h.name);\nconst out = (res.rows || []).map(r => {\n  const obj = {};\n  headers.forEach((h, i) => obj[h] = r[i]);\n  return obj;\n});\nreturn out.map(o => ({ json: o }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "34965865-7bc9-462c-812d-9f27b230dca9",
      "name": "Top Videos Week Formatter",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        -496
      ],
      "parameters": {
        "jsCode": "// Ambil data dari node sebelumnya\nconst res = items[0].json;\n\n// Ambil header kolom\nconst headers = res.columnHeaders.map(h => h.name);\n\n// Ubah rows jadi array of object\nconst parsed = (res.rows || []).map(r => {\n  const obj = {};\n  headers.forEach((h, i) => obj[h] = r[i]);\n\n  // Rename views -> views_weekly\n  if (obj.views !== undefined) {\n    obj.views_weekly = obj.views;\n    delete obj.views;\n  }\n\n  return obj;\n});\n\n// Ambil hanya kolom video (ID)\nconst ids = parsed.map(v => v.video);\n\n// Gabungkan jadi string CSV\nconst csv = ids.join(',');\n\n// Return satu item dengan field videoIdsCsv + juga parsed rows\nreturn [{\n  json: {\n    videoIdsCsv: csv,\n    topVideos: parsed\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "adc07ff7-d09e-41f5-9635-2314d9911f45",
      "name": "Channel Summary Formatter",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        -720
      ],
      "parameters": {
        "jsCode": "// Input: 1 item berisi response JSON dari HTTP node di field 'data'\nconst res = items[0].json; // sesuaikan kalau output Anda beda\nconst headers = res.columnHeaders.map(h => h.name);\nconst out = (res.rows || []).map(r => {\n  const obj = {};\n  headers.forEach((h, i) => obj[h] = r[i]);\n  return obj;\n});\nreturn out.map(o => ({ json: o }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "3d7fa276-77c3-46a1-9841-231d7f49f6cb",
      "name": "Merger Views Weekly and Views All Time",
      "type": "n8n-nodes-base.merge",
      "position": [
        1312,
        -480
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "0e8c5e71-2f95-4db0-947a-3eeaf2636b4c",
      "name": "Merger Node 1 2 3",
      "type": "n8n-nodes-base.merge",
      "position": [
        1728,
        -480
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "2acfbe97-ce35-48e5-8a16-6ddc9331465a",
      "name": "Merger Node 1 2 3 4",
      "type": "n8n-nodes-base.merge",
      "position": [
        1952,
        -272
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "618d7960-3e49-4657-bed9-e71e81df10a1",
      "name": "All Output Formatter",
      "type": "n8n-nodes-base.code",
      "position": [
        2144,
        -272
      ],
      "parameters": {
        "jsCode": "// Ambil semua item hasil merge\nconst arr = items.map(i => i.json);\n\nconst result = {\n  overview: [],\n  topVideos: [],\n  trafficSources: [],\n  audience: []\n};\n\nfor (const item of arr) {\n  // Cek apakah ini Overview (punya key 'day')\n  if (item.day) {\n    result.overview.push(item);\n  }\n  // Cek apakah ini objek gabungan TopVideos (ada 'items' dan 'topVideos')\n  else if (item.items && item.topVideos) {\n    \n    // Ini bagian yang diubah\n    result.topVideos = item.items.map(videoDetail => {\n      // 1. Cari data analitik yang cocok berdasarkan ID video\n      const analyticsData = item.topVideos.find(\n        analyticsVideo => analyticsVideo.video === videoDetail.id\n      );\n\n      // 2. Gabungkan data dalam objek baru\n      return {\n        id: videoDetail.id,\n        title: videoDetail.snippet.title,\n        views_alltime: videoDetail.statistics.viewCount, // Total views seumur hidup\n        views_weekly: analyticsData ? analyticsData.views_weekly : 0, // Views mingguan dari data analitik\n        likes: videoDetail.statistics.likeCount,\n        comments: videoDetail.statistics.commentCount,\n        thumbnail: videoDetail.snippet.thumbnails?.default?.url\n      };\n    });\n  }\n  // Cek apakah ini Traffic Source (ada 'insightTrafficSourceType')\n  else if (item.insightTrafficSourceType) {\n    result.trafficSources.push(item);\n  }\n  // Cek apakah ini Audience (ada 'ageGroup')\n  else if (item.ageGroup) {\n    result.audience.push(item);\n  }\n}\n\nreturn [{ json: result }];"
      },
      "typeVersion": 2
    },
    {
      "id": "fd65cc2a-ed80-4382-814e-da36f3e820e2",
      "name": "Telegram Message Formatter",
      "type": "n8n-nodes-base.code",
      "position": [
        2336,
        -272
      ],
      "parameters": {
        "jsCode": "const data = items[0].json;\n\n// Ambil hanya 7 hari terakhir\nconst last7 = data.overview.slice(-7);\n\n// Hitung total & rata-rata\nconst totalViews = last7.reduce((sum, d) => sum + d.views, 0);\nconst totalLikes = last7.reduce((sum, d) => sum + d.likes, 0);\nconst totalComments = last7.reduce((sum, d) => sum + d.comments, 0);\nconst totalSubsGained = last7.reduce((sum, d) => sum + d.subscribersGained, 0);\nconst totalSubsLost = last7.reduce((sum, d) => sum + d.subscribersLost, 0);\nconst avgDuration = Math.round(\n  last7.reduce((sum, d) => sum + d.averageViewDuration, 0) / last7.length\n);\n\n// Ambil rentang tanggal\nconst start = last7[0].day;\nconst end = last7[last7.length - 1].day;\n\nlet text = `\ud83d\udcca *Channel Summary (Last 7 days)*\\n`;\ntext += `Periode: ${start} \u279d ${end}\\n`;\ntext += `\ud83d\udc41\ufe0f Views: ${totalViews}\\n`;\ntext += `\u23f1\ufe0f Avg. View Duration: ${avgDuration} detik\\n`;\ntext += `\ud83d\udc4d Likes: ${totalLikes} | \ud83d\udcac Comments: ${totalComments}\\n`;\ntext += `\ud83d\udc65 Subs +${totalSubsGained} / -${totalSubsLost}\\n\\n`;\n\n// Top 5 Videos\ntext += `\ud83d\udd25 *Top 5 Videos*\\n`;\nfor (const v of data.topVideos.slice(0, 5)) {\n  // --- BARIS INI YANG DIUBAH ---\n  text += `- ${v.title}\\n  \ud83d\udcc8 ${v.views_weekly} (Last Week) | \ud83d\udc41\ufe0f ${v.views_alltime} (Total) | \ud83d\udc4d ${v.likes} | \ud83d\udcac ${v.comments}\\n`;\n}\n\n// Top 3 Traffic Sources\ntext += `\\n\ud83d\udea6 *Top 3 Sources*\\n`;\nconst sortedSources = data.trafficSources.sort((a,b)=>b.views - a.views);\nfor (const s of sortedSources.slice(0, 3)) {\n  text += `- ${s.insightTrafficSourceType}: ${s.views} views\\n`;\n}\n\n// Audience Demography (top 3)\ntext += `\\n\ud83d\udc65 *Top Audience*\\n`;\nconst sortedAudience = data.audience.sort((a,b)=>b.viewerPercentage - a.viewerPercentage);\nfor (const aud of sortedAudience.slice(0, 3)) {\n  text += `- ${aud.ageGroup} ${aud.gender}: ${aud.viewerPercentage}%\\n`;\n}\n\nreturn [{ json: { text } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "32373234-a574-4aae-a877-2f929952bf8c",
      "name": "Merger Node 1 2",
      "type": "n8n-nodes-base.merge",
      "position": [
        1456,
        -704
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "70a6943e-1f85-4536-a678-96d1106244d3",
      "name": "Run Weekly on Sunday 6am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        96,
        -240
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtHour": 6
            }
          ]
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "94e8065d-cf9b-4a01-8434-3f29cf4ea43b",
  "connections": {
    "Traffic Source": {
      "main": [
        [
          {
            "node": "Traffic Source Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Channel Summary": {
      "main": [
        [
          {
            "node": "Channel Summary Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merger Node 1 2": {
      "main": [
        [
          {
            "node": "Merger Node 1 2 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Top Videos Week": {
      "main": [
        [
          {
            "node": "Top Videos Week Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Turn Id to Title": {
      "main": [
        [
          {
            "node": "Merger Views Weekly and Views All Time",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merger Node 1 2 3": {
      "main": [
        [
          {
            "node": "Merger Node 1 2 3 4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merger Node 1 2 3 4": {
      "main": [
        [
          {
            "node": "All Output Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "All Output Formatter": {
      "main": [
        [
          {
            "node": "Telegram Message Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audience Demographics": {
      "main": [
        [
          {
            "node": "Audience Demographics Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Weekly on Sunday 6am": {
      "main": [
        [
          {
            "node": "Channel Summary",
            "type": "main",
            "index": 0
          },
          {
            "node": "Top Videos Week",
            "type": "main",
            "index": 0
          },
          {
            "node": "Traffic Source",
            "type": "main",
            "index": 0
          },
          {
            "node": "Audience Demographics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Traffic Source Formatter": {
      "main": [
        [
          {
            "node": "Merger Node 1 2 3",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Channel Summary Formatter": {
      "main": [
        [
          {
            "node": "Merger Node 1 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Top Videos Week Formatter": {
      "main": [
        [
          {
            "node": "Turn Id to Title",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merger Views Weekly and Views All Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Message Formatter": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audience Demographics Formatter": {
      "main": [
        [
          {
            "node": "Merger Node 1 2 3 4",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merger Views Weekly and Views All Time": {
      "main": [
        [
          {
            "node": "Merger Node 1 2",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Tired of manually checking your YouTube Studio every day just to see how your channel is performing? This workflow is your solution.

Source: https://n8n.io/workflows/8554/ — original creator credit. Request a take-down →

More Social Media workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Social Media

YouTube Analytics Pull (yt-data-api-pull). Uses youtube, postgres, telegram. Scheduled trigger; 5 nodes.

YouTube, Postgres, Telegram
Social Media

TikTok Analytics Pull (tiktok-pull). Uses httpRequest, postgres. Scheduled trigger; 4 nodes.

HTTP Request, Postgres
Social Media

This n8n workflow is designed for content curators, digital marketers, and social media managers who want to automate the process of discovering, translating, and publishing news content from multiple

Edit Image, Facebook Graph Api, WordPress +9
Social Media

MindFrame Psychology - Daily YouTube Shorts (Complete). Uses httpRequest, googleDrive, youtube, telegram. Scheduled trigger; 26 nodes.

HTTP Request, Google Drive, YouTube +1
Social Media

Save time - Eliminate manual LinkedIn posting and content scheduling tasks Stay consistent - Automated daily posting keeps your LinkedIn profile active and engaging Keep control - Preview every post b

HTTP Request, Telegram, Google Sheets +2