Informe semanal de análisis de YouTube
Este es unMarket Researchflujo de automatización del dominio deautomatización que contiene 17 nodos.Utiliza principalmente nodos como Code, Merge, Telegram, HttpRequest, ScheduleTrigger. Automatización del envío de informes de análisis de canales de YouTube a Telegram (semanal)
- •Bot Token de Telegram
- •Pueden requerirse credenciales de autenticación para la API de destino
Nodos utilizados (17)
Categoría
{
"id": "aPiq5niR5CX4IKG0",
"meta": {
"instanceId": "f7f67beee184b74727132a2cae80d905bf826da624b8008bfa0c397ee8879752",
"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": "Resumen del Canal",
"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": {
"id": "M5Kja7WVORPz6Bks",
"name": "YouTube Credential"
}
},
"typeVersion": 4.2
},
{
"id": "cea3c6b3-f849-420e-9df2-bcd55c9c3ff3",
"name": "Videos Destacados de la Semana",
"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": {
"id": "M5Kja7WVORPz6Bks",
"name": "YouTube Credential"
}
},
"typeVersion": 4.2
},
{
"id": "f87af746-24f4-43a5-82c1-400c5cf70b68",
"name": "Fuente de Tráfico",
"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": {
"id": "M5Kja7WVORPz6Bks",
"name": "YouTube Credential"
}
},
"typeVersion": 4.2
},
{
"id": "2bf25aae-c867-46a8-8f4f-968553448659",
"name": "Demografía de la Audiencia",
"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": {
"id": "M5Kja7WVORPz6Bks",
"name": "YouTube Credential"
}
},
"typeVersion": 4.2
},
{
"id": "5c0f2672-7568-4db6-897e-665a4cce7382",
"name": "Enviar un mensaje de texto",
"type": "n8n-nodes-base.telegram",
"position": [
2528,
-272
],
"webhookId": "0e7dd1e3-7c40-458e-9cee-c08a44ddb02a",
"parameters": {
"text": "={{ $json.text }}",
"chatId": "-1001415788700",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "qV4GRZZ4v7NAemUj",
"name": "abdulazizahwan_Bot"
}
},
"typeVersion": 1.2
},
{
"id": "227fce63-b178-485b-8f9c-d316820012be",
"name": "Convertir ID a Título",
"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": {
"id": "M5Kja7WVORPz6Bks",
"name": "YouTube Credential"
}
},
"typeVersion": 4.2
},
{
"id": "a129db52-cddf-43dc-8028-ba6aa00953d8",
"name": "Formateador de Demografía de la Audiencia",
"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": "Formateador de Fuente de Tráfico",
"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": "Formateador de Videos Destacados de la Semana",
"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": "Formateador de Resumen del Canal",
"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": "Combinador: Vistas Semanales y Vistas Totales",
"type": "n8n-nodes-base.merge",
"position": [
1312,
-480
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.2
},
{
"id": "0e8c5e71-2f95-4db0-947a-3eeaf2636b4c",
"name": "Combinador Nodo 1 2 3",
"type": "n8n-nodes-base.merge",
"position": [
1728,
-480
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "2acfbe97-ce35-48e5-8a16-6ddc9331465a",
"name": "Combinador Nodo 1 2 3 4",
"type": "n8n-nodes-base.merge",
"position": [
1952,
-272
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "618d7960-3e49-4657-bed9-e71e81df10a1",
"name": "Formateador de Todas las Salidas",
"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 Formateador de Mensaje",
"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 = `📊 *Channel Summary (Last 7 days)*\\n`;\ntext += `Periode: ${start} ➝ ${end}\\n`;\ntext += `👁️ Views: ${totalViews}\\n`;\ntext += `⏱️ Avg. View Duration: ${avgDuration} detik\\n`;\ntext += `👍 Likes: ${totalLikes} | 💬 Comments: ${totalComments}\\n`;\ntext += `👥 Subs +${totalSubsGained} / -${totalSubsLost}\\n\\n`;\n\n// Top 5 Videos\ntext += `🔥 *Top 5 Videos*\\n`;\nfor (const v of data.topVideos.slice(0, 5)) {\n // --- BARIS INI YANG DIUBAH ---\n text += `- ${v.title}\\n 📈 ${v.views_weekly} (Last Week) | 👁️ ${v.views_alltime} (Total) | 👍 ${v.likes} | 💬 ${v.comments}\\n`;\n}\n\n// Top 3 Traffic Sources\ntext += `\\n🚦 *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👥 *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": "Combinador Nodo 1 2",
"type": "n8n-nodes-base.merge",
"position": [
1456,
-704
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "70a6943e-1f85-4536-a678-96d1106244d3",
"name": "Ejecutar Semanalmente el Domingo a las 6 a.m.",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
96,
-240
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtHour": 6
}
]
}
},
"typeVersion": 1.2
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "94e8065d-cf9b-4a01-8434-3f29cf4ea43b",
"connections": {
"f87af746-24f4-43a5-82c1-400c5cf70b68": {
"main": [
[
{
"node": "d84e6e62-be1f-46d2-9700-d086bfa7e3f9",
"type": "main",
"index": 0
}
]
]
},
"08eb2d97-5306-47ce-8571-3ad837bc6c52": {
"main": [
[
{
"node": "adc07ff7-d09e-41f5-9635-2314d9911f45",
"type": "main",
"index": 0
}
]
]
},
"32373234-a574-4aae-a877-2f929952bf8c": {
"main": [
[
{
"node": "0e8c5e71-2f95-4db0-947a-3eeaf2636b4c",
"type": "main",
"index": 0
}
]
]
},
"cea3c6b3-f849-420e-9df2-bcd55c9c3ff3": {
"main": [
[
{
"node": "34965865-7bc9-462c-812d-9f27b230dca9",
"type": "main",
"index": 0
}
]
]
},
"227fce63-b178-485b-8f9c-d316820012be": {
"main": [
[
{
"node": "3d7fa276-77c3-46a1-9841-231d7f49f6cb",
"type": "main",
"index": 1
}
]
]
},
"0e8c5e71-2f95-4db0-947a-3eeaf2636b4c": {
"main": [
[
{
"node": "2acfbe97-ce35-48e5-8a16-6ddc9331465a",
"type": "main",
"index": 0
}
]
]
},
"2acfbe97-ce35-48e5-8a16-6ddc9331465a": {
"main": [
[
{
"node": "618d7960-3e49-4657-bed9-e71e81df10a1",
"type": "main",
"index": 0
}
]
]
},
"618d7960-3e49-4657-bed9-e71e81df10a1": {
"main": [
[
{
"node": "fd65cc2a-ed80-4382-814e-da36f3e820e2",
"type": "main",
"index": 0
}
]
]
},
"2bf25aae-c867-46a8-8f4f-968553448659": {
"main": [
[
{
"node": "a129db52-cddf-43dc-8028-ba6aa00953d8",
"type": "main",
"index": 0
}
]
]
},
"70a6943e-1f85-4536-a678-96d1106244d3": {
"main": [
[
{
"node": "08eb2d97-5306-47ce-8571-3ad837bc6c52",
"type": "main",
"index": 0
},
{
"node": "cea3c6b3-f849-420e-9df2-bcd55c9c3ff3",
"type": "main",
"index": 0
},
{
"node": "f87af746-24f4-43a5-82c1-400c5cf70b68",
"type": "main",
"index": 0
},
{
"node": "2bf25aae-c867-46a8-8f4f-968553448659",
"type": "main",
"index": 0
}
]
]
},
"d84e6e62-be1f-46d2-9700-d086bfa7e3f9": {
"main": [
[
{
"node": "0e8c5e71-2f95-4db0-947a-3eeaf2636b4c",
"type": "main",
"index": 1
}
]
]
},
"adc07ff7-d09e-41f5-9635-2314d9911f45": {
"main": [
[
{
"node": "32373234-a574-4aae-a877-2f929952bf8c",
"type": "main",
"index": 0
}
]
]
},
"34965865-7bc9-462c-812d-9f27b230dca9": {
"main": [
[
{
"node": "227fce63-b178-485b-8f9c-d316820012be",
"type": "main",
"index": 0
},
{
"node": "3d7fa276-77c3-46a1-9841-231d7f49f6cb",
"type": "main",
"index": 0
}
]
]
},
"fd65cc2a-ed80-4382-814e-da36f3e820e2": {
"main": [
[
{
"node": "5c0f2672-7568-4db6-897e-665a4cce7382",
"type": "main",
"index": 0
}
]
]
},
"a129db52-cddf-43dc-8028-ba6aa00953d8": {
"main": [
[
{
"node": "2acfbe97-ce35-48e5-8a16-6ddc9331465a",
"type": "main",
"index": 1
}
]
]
},
"3d7fa276-77c3-46a1-9841-231d7f49f6cb": {
"main": [
[
{
"node": "32373234-a574-4aae-a877-2f929952bf8c",
"type": "main",
"index": 1
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Avanzado - Investigación de mercado
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Abdul Aziz Ahwan
@abdulazizahwanCompartir este flujo de trabajo