// BASHEK.DE

N8N_WORKFLOWS

AUTOMATION FLOWS · READ ONLY

// N8N WORKFLOW

AI STREAM INTELLIGENCE SYSTEM

Full Douyin livestream analysis pipeline. Receives audio chunks via webhook, transcribes with Google STT Chirp 2 (Mandarin/Cantonese/English), analyzes sentiment/topics/keywords via Gemini, writes structured rows to Google Sheets, and sends highlights to Telegram.

N8NSTTGEMINIGOOGLE SHEETSTELEGRAMWEBHOOK
4.91.2k

TRIGGER

Webhook (POST /your-webhook-path)

NODES

🌐 Webhook Ingest⚙️ Config & Router🔊 Google STT v2 (Chirp 2)📝 STT Normalizer🤖 Gemini Analysis📊 Row Builder📋 Google Sheets Write📤 Telegram Notify

JSON EXPORT

READ ONLY
{
  "name": "AI Stream Intelligence System",
  "active": true,
  "nodes": [
    {
      "id": "node-001",
      "name": "🌐 Webhook Ingest",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [-560, 128],
      "parameters": {
        "httpMethod": "POST",
        "path": "/your-webhook-path",
        "options": {}
      }
    },
    {
      "id": "node-002",
      "name": "⚙️ Config & Router",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [-304, 128],
      "parameters": {
        "jsCode": "const CONFIG = {\n  GCP_PROJECT_ID: 'YOUR_GCP_PROJECT',\n  GCS_BUCKET: 'YOUR_BUCKET_NAME',\n  GEMINI_API_KEY: 'YOUR_KEY_HERE',\n  GEMINI_MODEL: 'gemini-2.5-flash-lite',\n  SHEET_ID: 'YOUR_SHEET_ID',\n  SHEET_TAB: 'Stream_Analytics',\n  TELEGRAM_BOT_TOKEN: 'YOUR_KEY_HERE',\n  TELEGRAM_CHAT_ID: 'YOUR_CHAT_ID',\n  CHUNK_SECONDS: 30,\n  MAX_RETRIES: 3,\n};\nconst input = $input.first().json.body || $input.first().json;\nconst job = {\n  config: CONFIG,\n  job_id: input.job_id || `job_${Date.now()}`,\n  source_type: input.source_type || 'unknown',\n  gcs_uri: input.gcs_uri || input.audio_gcs_uri || '',\n  language_hint: input.language_hint || 'cmn-Hans-CN',\n  chunk_index: input.chunk_index ?? 0,\n  streamer: input.streamer || '',\n  session_date: input.session_date || new Date().toISOString().slice(0,10),\n  sheet_tab_name: input.sheet_tab_name || input.session_date || new Date().toISOString().slice(0,10),\n};\nreturn [{ json: job }];"
      }
    },
    {
      "id": "node-003",
      "name": "🔊 Google STT v2 (Chirp 2)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [0, 0],
      "parameters": {
        "method": "POST",
        "url": "=https://europe-west4-speech.googleapis.com/v2/projects/YOUR_GCP_PROJECT/locations/europe-west4/recognizers/_:recognize",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"config\": {\n    \"autoDecodingConfig\": {},\n    \"languageCodes\": [\"cmn-Hans-CN\", \"yue-Hant-HK\", \"en-US\"],\n    \"model\": \"chirp_2\"\n  },\n  \"uri\": \"{{ $json.gcs_uri }}\"\n}",
        "options": { "timeout": 120000 }
      },
      "credentials": {
        "googleApi": { "id": "YOUR_CRED_ID", "name": "Google Cloud SA" }
      }
    },
    {
      "id": "node-004",
      "name": "📝 STT Normalizer",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [-16, 464],
      "parameters": {
        "jsCode": "const item = $input.first().json;\nlet raw_transcript = '';\nif (item.results && Array.isArray(item.results)) {\n  for (const r of item.results) {\n    raw_transcript += (r.alternatives?.[0]?.transcript || '') + ' ';\n  }\n}\nreturn [{ json: { ...item, raw_transcript: raw_transcript.trim() || '[NO TRANSCRIPT]' } }];"
      }
    },
    {
      "id": "node-005",
      "name": "🤖 Gemini Analysis",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [240, 304],
      "parameters": {
        "method": "POST",
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent?key=YOUR_KEY_HERE",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={"contents": [{"parts": [{"text": "Analyze this Douyin livestream transcript. Return ONLY valid JSON with keys: language_detected, translation_en, translation_de, keywords (array), topics (array), sentiment, sentiment_score (-1 to 1), flags (array), music_detected (bool), summary_en, summary_de. Transcript: {{ $json.raw_transcript }}"}]}], "generationConfig": {"maxOutputTokens": 4096, "thinkingConfig": {"thinkingBudget": 0}}}"
      }
    },
    {
      "id": "node-006",
      "name": "📊 Row Builder",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [480, 304],
      "parameters": {
        "jsCode": "const gemResp = $input.first().json;\nconst stt = $('📝 STT Normalizer').first().json;\nconst meta = $('⚙️ Config & Router').first().json;\nlet g = {};\ntry {\n  const raw = gemResp?.candidates?.[0]?.content?.parts?.[0]?.text || '{}';\n  g = JSON.parse(raw.replace(/```json|```/g,'').trim());\n} catch(e) {\n  g = { flags: ['PARSE_ERROR'], sentiment: 'neutral', sentiment_score: 0 };\n}\nreturn [{ json: {\n  Timestamp: new Date().toISOString(),\n  Streamer: meta.streamer,\n  Transcript_Original: stt.raw_transcript,\n  Translation_EN: g.translation_en || '',\n  Translation_DE: g.translation_de || '',\n  Keywords: (g.keywords||[]).join('; '),\n  Topics: (g.topics||[]).join('; '),\n  Sentiment: g.sentiment || '',\n  Sentiment_Score: g.sentiment_score ?? 0,\n  Flags: (g.flags||[]).join('; '),\n  Music_Detected: !!g.music_detected,\n  Summary_EN: g.summary_en || '',\n  Summary_DE: g.summary_de || '',\n  Language_Detected: g.language_detected || '',\n  Chunk_Index: meta.chunk_index,\n  Audio_GCS_URI: meta.gcs_uri,\n} }];"
      }
    },
    {
      "id": "node-007",
      "name": "📋 Google Sheets Write",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [720, 304],
      "parameters": {
        "authentication": "serviceAccount",
        "operation": "append",
        "documentId": { "__rl": true, "value": "YOUR_SHEET_ID", "mode": "id" },
        "sheetName": { "__rl": true, "value": "={{ $('⚙️ Config & Router').first().json.sheet_tab_name }}", "mode": "name" },
        "columns": { "mappingMode": "autoMapInputData" }
      },
      "credentials": {
        "googleApi": { "id": "YOUR_CRED_ID", "name": "Google Cloud SA" }
      }
    },
    {
      "id": "node-008",
      "name": "📤 Telegram Notify",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [960, 304],
      "parameters": {
        "chatId": "YOUR_CHAT_ID",
        "text": "={{ '🎙 *' + $json.Streamer + '*\n' + $json.Translation_EN }}",
        "additionalFields": { "parse_mode": "Markdown", "message_thread_id": 5 }
      },
      "credentials": {
        "telegramApi": { "id": "YOUR_CRED_ID", "name": "CloudBro-Telegram" }
      }
    }
  ],
  "connections": {
    "🌐 Webhook Ingest":       { "main": [[{ "node": "⚙️ Config & Router", "type": "main", "index": 0 }]] },
    "⚙️ Config & Router":      { "main": [[{ "node": "🔊 Google STT v2 (Chirp 2)", "type": "main", "index": 0 }]] },
    "🔊 Google STT v2 (Chirp 2)": { "main": [[{ "node": "📝 STT Normalizer", "type": "main", "index": 0 }]] },
    "📝 STT Normalizer":       { "main": [[{ "node": "🤖 Gemini Analysis", "type": "main", "index": 0 }]] },
    "🤖 Gemini Analysis":      { "main": [[{ "node": "📊 Row Builder", "type": "main", "index": 0 }]] },
    "📊 Row Builder":          { "main": [[{ "node": "📋 Google Sheets Write", "type": "main", "index": 0 }]] },
    "📋 Google Sheets Write":  { "main": [[{ "node": "📤 Telegram Notify", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}

// N8N WORKFLOW

DAILY STREAM SUMMARY

Runs nightly at 02:01, reads all stream analytics rows from the previous day's Google Sheet tab, aggregates sentiment/topics/keywords, sends the transcript sample to Gemini for an EN+DE summary, writes to Stream_Summaries sheet, then posts a formatted report to Telegram.

N8NGEMINIGOOGLE SHEETSTELEGRAM
4.8891

TRIGGER

Cron (daily 02:01)

NODES

Schedule TriggerConfig (date calc)Read Date TabAggregateGemini SummaryParse SummaryWrite Stream_SummariesFormat MessageTelegram Post

JSON EXPORT

READ ONLY
{
  "name": "Daily Stream Summary",
  "active": true,
  "nodes": [
    {
      "id": "n1", "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.1, "position": [0, 0],
      "parameters": { "rule": { "interval": [{ "field": "cronExpression", "expression": "1 2 * * *" }] } }
    },
    {
      "id": "n2", "name": "Config",
      "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [224, 0],
      "parameters": { "jsCode": "const y=$now.minus({days:1}).toFormat('yyyy-MM-dd');return [{json:{date:y}}];" }
    },
    {
      "id": "n3", "name": "Read Date Tab",
      "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.5, "position": [448, 0],
      "parameters": {
        "authentication": "serviceAccount", "operation": "readRows",
        "documentId": { "__rl": true, "value": "YOUR_SHEET_ID", "mode": "id" }
      },
      "credentials": { "googleApi": { "id": "YOUR_CRED_ID", "name": "Google Cloud SA" } }
    },
    {
      "id": "n4", "name": "Aggregate",
      "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [672, 0],
      "parameters": { "jsCode": "const rows=$input.all().map(i=>i.json);const date=$('Config').first().json.date;if(!rows.length)return [{json:{skip:true,date}}];const sents=rows.map(r=>parseFloat((r.Sentiment_Score||'0').toString().replace(',','.'))||0);const avg=(sents.reduce((a,b)=>a+b,0)/sents.length).toFixed(3);const tc={},kc={};rows.forEach(r=>{(r.Topics||'').split(/[;,]/).forEach(t=>{t=t.trim();if(t)tc[t]=(tc[t]||0)+1});(r.Keywords||'').split(/[;,]/).forEach(k=>{k=k.trim();if(k)kc[k]=(kc[k]||0)+1})});const tt=Object.entries(tc).sort((a,b)=>b[1]-a[1]).slice(0,5).map(([k])=>k).join('; ');const tk=Object.entries(kc).sort((a,b)=>b[1]-a[1]).slice(0,10).map(([k])=>k).join('; ');const tx=rows.slice(0,30).map(r=>r.Transcript_Original||'').filter(Boolean).join(' ').slice(0,3000);return [{json:{date,chunks:rows.length,avg,tt,tk,tx,skip:false}}];" }
    },
    {
      "id": "n5", "name": "Gemini Summary",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [880, 0],
      "parameters": {
        "method": "POST",
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent?key=YOUR_KEY_HERE",
        "sendBody": true, "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({generationConfig:{thinkingConfig:{thinkingBudget:0},maxOutputTokens:1024},contents:[{parts:[{text:'Stream analyst. Summarize this Douyin livestream. Return ONLY valid JSON with keys summary_en, summary_de, highlights.\nDate:'+$json.date+'\nChunks:'+$json.chunks+'\nSentiment:'+$json.avg+'\nTopics:'+$json.tt+'\nSample:'+$json.tx}]}]}) }}"
      }
    },
    {
      "id": "n6", "name": "Parse Summary",
      "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [1104, 0],
      "parameters": { "jsCode": "const a=$('Aggregate').first().json;if(a.skip)return [{json:{skip:true,date:a.date}}];let en='',de='',hl='';try{const raw=$input.first().json.candidates?.[0]?.content?.parts?.[0]?.text||'{}';const p=JSON.parse(raw.replace(/```json|```/g,'').trim());en=p.summary_en||'';de=p.summary_de||'';hl=p.highlights||'';}catch(e){en='Summary generation failed.';}return [{json:{skip:false,date:a.date,chunks:a.chunks,avg_sentiment:a.avg,top_topics:a.tt,top_keywords:a.tk,summary_en:en,summary_de:de,highlights:hl}}];" }
    },
    {
      "id": "n7", "name": "Write Stream_Summaries",
      "type": "n8n-nodes-base.googleSheets", "typeVersion": 4.5, "position": [1328, 0],
      "parameters": {
        "authentication": "serviceAccount", "operation": "appendOrUpdate",
        "documentId": { "__rl": true, "value": "YOUR_SHEET_ID", "mode": "id" },
        "sheetName": { "__rl": true, "value": "Stream_Summaries", "mode": "name" },
        "columns": { "mappingMode": "autoMapInputData" }
      },
      "credentials": { "googleApi": { "id": "YOUR_CRED_ID", "name": "Google Cloud SA" } }
    },
    {
      "id": "n8", "name": "Format Message",
      "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [1552, 0],
      "parameters": { "jsCode": "const d=$input.first().json;if(d.skip)return [{json:{text:'📭 No stream data for '+d.date}}];const parts=['📺 *Stream Summary — '+d.date+'*','🔑 Topics: '+d.top_topics,'','📝 '+d.summary_en,'','⭐ '+d.highlights];return [{json:{text:parts.join('\n')}}];" }
    },
    {
      "id": "n9", "name": "Telegram Post",
      "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [1776, 0],
      "parameters": {
        "chatId": "YOUR_CHAT_ID",
        "text": "={{ $json.text }}",
        "additionalFields": { "parse_mode": "Markdown" }
      },
      "credentials": { "telegramApi": { "id": "YOUR_CRED_ID", "name": "CloudBro-Telegram" } }
    }
  ],
  "connections": {
    "Schedule Trigger": { "main": [[{ "node": "Config", "type": "main", "index": 0 }]] },
    "Config":           { "main": [[{ "node": "Read Date Tab", "type": "main", "index": 0 }]] },
    "Read Date Tab":    { "main": [[{ "node": "Aggregate", "type": "main", "index": 0 }]] },
    "Aggregate":        { "main": [[{ "node": "Gemini Summary", "type": "main", "index": 0 }]] },
    "Gemini Summary":   { "main": [[{ "node": "Parse Summary", "type": "main", "index": 0 }]] },
    "Parse Summary":    { "main": [[{ "node": "Write Stream_Summaries", "type": "main", "index": 0 }]] },
    "Write Stream_Summaries": { "main": [[{ "node": "Format Message", "type": "main", "index": 0 }]] },
    "Format Message":   { "main": [[{ "node": "Telegram Post", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}

// N8N WORKFLOW

N3 DAILY BRIEFING (PARALLEL)

Morning briefing sent to Telegram at 06:00. Fans out 13 parallel nodes: weather for 4 Ruhr cities (Open-Meteo), RSS news from Tagesschau/Spiegel/Zeit/WDR/Bottrop, a daily quote, joke, SSH server status via Logwatch, and stream-ingest healthcheck. All results merge into one HTML message.

N8NTELEGRAMAPI
4.7743

TRIGGER

Cron (daily 06:00)

NODES

Start 06:00Zitat (ZenQuotes)Witz (JokeAPI)W_Bottrop / W_Oberhausen / W_Essen / W_Duisburg (Open-Meteo)Tagesschau / Spiegel / Zeit / WDR / Bottrop_News (RSS)Logwatch (SSH)Webhook_CheckMerge AllCode LogicTelegram

JSON EXPORT

READ ONLY
{
  "name": "N3_Daily_PARALLEL_V2",
  "active": true,
  "nodes": [
    {
      "id": "sched", "name": "Start 06:00",
      "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.1, "position": [-304, 208],
      "parameters": { "rule": { "interval": [{ "triggerAtHour": 6 }] } }
    },
    {
      "id": "quote", "name": "Zitat",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [0, 0],
      "parameters": { "url": "https://zenquotes.io/api/random", "options": {} },
      "executeOnce": true, "continueOnFail": true
    },
    {
      "id": "joke", "name": "Witz",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.4, "position": [0, 128],
      "parameters": { "url": "https://v2.jokeapi.dev/joke/Programming,Misc,Pun?safe-mode&type=single", "options": {} },
      "executeOnce": true, "continueOnFail": true
    },
    {
      "id": "w1", "name": "W_Bottrop",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [0, 240],
      "parameters": { "url": "https://api.open-meteo.com/v1/forecast?latitude=51.52&longitude=6.93&current=temperature_2m&hourly=temperature_2m&timezone=Europe%2FBerlin&forecast_days=1", "options": {} },
      "executeOnce": true, "continueOnFail": true
    },
    {
      "id": "w2", "name": "W_Essen",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [0, 480],
      "parameters": { "url": "https://api.open-meteo.com/v1/forecast?latitude=51.45&longitude=7.01&current=temperature_2m&hourly=temperature_2m&timezone=Europe%2FBerlin&forecast_days=1", "options": {} },
      "executeOnce": true, "continueOnFail": true
    },
    {
      "id": "rss1", "name": "Tagesschau",
      "type": "n8n-nodes-base.rssFeedRead", "typeVersion": 1, "position": [0, 720],
      "parameters": { "url": "https://www.tagesschau.de/xml/rss2/", "options": {} },
      "executeOnce": true, "continueOnFail": true
    },
    {
      "id": "rss2", "name": "Spiegel",
      "type": "n8n-nodes-base.rssFeedRead", "typeVersion": 1, "position": [0, 848],
      "parameters": { "url": "https://www.spiegel.de/schlagzeilen/index.rss", "options": {} },
      "executeOnce": true, "continueOnFail": true
    },
    {
      "id": "ssh1", "name": "Logwatch",
      "type": "n8n-nodes-base.ssh", "typeVersion": 1, "position": [0, 1328],
      "parameters": { "authentication": "privateKey", "command": "/usr/local/bin/logwatch-report.sh" },
      "credentials": { "sshPrivateKey": { "id": "YOUR_CRED_ID", "name": "SSH Private Key account" } },
      "continueOnFail": true
    },
    {
      "id": "hc1", "name": "Webhook_Check",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.4, "position": [0, 1440],
      "parameters": { "url": "http://host.docker.internal:8765/health", "options": { "timeout": 5000 } },
      "executeOnce": true, "continueOnFail": true
    },
    {
      "id": "merge", "name": "Merge All",
      "type": "n8n-nodes-base.merge", "typeVersion": 3, "position": [400, 720]
    },
    {
      "id": "logic", "name": "Code Logic",
      "type": "n8n-nodes-base.code", "typeVersion": 1, "position": [704, 720],
      "parameters": { "jsCode": "// Aggregates weather, news, quotes, server status into one HTML Telegram message\n// See full implementation for cityWeather(), feedLines(), serverStatus() helpers\nconst msg = ['🌅 <b>Daily Briefing</b>', '...'].join('\\n');\nreturn [{ json: { message: msg } }];" }
    },
    {
      "id": "tg", "name": "Telegram",
      "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [1008, 720],
      "parameters": {
        "chatId": "YOUR_CHAT_ID",
        "text": "={{ $json.message }}",
        "additionalFields": { "appendAttribution": false, "parse_mode": "HTML" }
      },
      "credentials": { "telegramApi": { "id": "YOUR_CRED_ID", "name": "CloudBro-Telegram" } }
    }
  ],
  "connections": {
    "Start 06:00": { "main": [[
      { "node": "Zitat", "type": "main", "index": 0 },
      { "node": "Witz", "type": "main", "index": 0 },
      { "node": "W_Bottrop", "type": "main", "index": 0 },
      { "node": "W_Essen", "type": "main", "index": 0 },
      { "node": "Tagesschau", "type": "main", "index": 0 },
      { "node": "Spiegel", "type": "main", "index": 0 },
      { "node": "Logwatch", "type": "main", "index": 0 },
      { "node": "Webhook_Check", "type": "main", "index": 0 }
    ]] },
    "Zitat":   { "main": [[{ "node": "Merge All", "type": "main", "index": 0 }]] },
    "Witz":    { "main": [[{ "node": "Merge All", "type": "main", "index": 1 }]] },
    "Merge All":   { "main": [[{ "node": "Code Logic", "type": "main", "index": 0 }]] },
    "Code Logic":  { "main": [[{ "node": "Telegram", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}

// N8N WORKFLOW

📡 LIVE SNAPSHOT — 阮小四

Real-time stream transcript delivery. Webhook receives a GCS URI, transcribes with Chirp 2, detects language via Gemini (skips EN/music), sends translated snapshot to Telegram topic. A parallel branch fires a stream-started alert on the first chunk of each session.

N8NSTTGEMINITELEGRAMWEBHOOK
4.8612

TRIGGER

Webhook (POST /your-webhook-path)

NODES

🌐 Webhook Live🔊 STT Chirp 2📝 STT Normalizer🤖 Gemini Quick (lang detect + translate)📡 Live Message Builder✉️ Telegram Live Send🔴 Stream Start Alert (parallel)✉️ Stream Start Send

JSON EXPORT

READ ONLY
{
  "name": "📡 Live Snapshot — 阮小四",
  "active": true,
  "nodes": [
    {
      "id": "c100-0001", "name": "🌐 Webhook Live",
      "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [-496, 304],
      "parameters": { "httpMethod": "POST", "path": "/your-webhook-path", "options": {} }
    },
    {
      "id": "c100-0002", "name": "🔊 STT Chirp 2",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [-240, 304],
      "alwaysOutputData": true, "continueOnFail": true,
      "parameters": {
        "method": "POST",
        "url": "=https://europe-west4-speech.googleapis.com/v2/projects/YOUR_GCP_PROJECT/locations/europe-west4/recognizers/_:recognize",
        "authentication": "predefinedCredentialType", "nodeCredentialType": "googleApi",
        "sendBody": true, "specifyBody": "json",
        "jsonBody": "={\n  \"config\": {\n    \"autoDecodingConfig\": {},\n    \"languageCodes\": [\"cmn-Hans-CN\"],\n    \"model\": \"chirp_2\"\n  },\n  \"uri\": \"{{ $json.body.gcs_uri }}\"\n}",
        "options": { "timeout": 120000 }
      },
      "credentials": { "googleApi": { "id": "YOUR_CRED_ID", "name": "Google Cloud SA" } }
    },
    {
      "id": "c100-0003", "name": "📝 STT Normalizer",
      "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [0, 304],
      "parameters": { "jsCode": "const item=$input.first().json;let raw_transcript='';if(item.results&&Array.isArray(item.results)){for(const r of item.results){raw_transcript+=(r.alternatives?.[0]?.transcript||'')+' ';}}return [{json:{...item,raw_transcript:raw_transcript.trim()||'[NO TRANSCRIPT]'}}];" }
    },
    {
      "id": "c100-0004", "name": "🤖 Gemini Quick",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [240, 304],
      "continueOnFail": true,
      "parameters": {
        "method": "POST",
        "url": "=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent?key=YOUR_KEY_HERE",
        "sendBody": true, "specifyBody": "json",
        "jsonBody": "={"contents":[{"parts":[{"text":"Detect language. If English/music return {\"is_english\":true,\"translation_en\":\"\",\"translation_de\":\"\"}. Otherwise return {\"is_english\":false,\"translation_en\":\"...\",\"translation_de\":\"...\"}. No markdown. Text: {{ $json.raw_transcript }}"}]}],"generationConfig":{"temperature":0.0,"maxOutputTokens":512,"thinkingConfig":{"thinkingBudget":0}}}"
      }
    },
    {
      "id": "c100-0005", "name": "📡 Live Message Builder",
      "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [480, 304],
      "parameters": { "jsCode": "const gemResp=$input.first().json;const stt=$('📝 STT Normalizer').first().json;let isEnglish=false,en='—',de='—';try{const raw=gemResp?.candidates?.[0]?.content?.parts?.[0]?.text||'{}';const g=JSON.parse(raw.replace(/```json|```/g,'').trim());isEnglish=g.is_english===true;en=g.translation_en||'—';de=g.translation_de||'—';}catch(e){}const ts=new Date().toUTCString().slice(17,22);const lines=['📡 *Live Snapshot* — `'+ts+' UTC`','',','🎤 *Original:*',stt.raw_transcript||'[—]'];if(!isEnglish){lines.push('');lines.push('🌐 EN: '+en);lines.push('💬 DE: '+de);}return [{json:{chat_id:'YOUR_CHAT_ID',message_thread_id:5,message:lines.join('\n')}}];" }
    },
    {
      "id": "c100-0006", "name": "✉️ Telegram Live Send",
      "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [720, 304],
      "parameters": {
        "chatId": "={{ $json.chat_id }}",
        "text": "={{ $json.message }}",
        "additionalFields": { "parse_mode": "Markdown", "message_thread_id": "={{ $json.message_thread_id }}" }
      },
      "credentials": { "telegramApi": { "id": "YOUR_CRED_ID", "name": "CloudBro-Telegram" } }
    },
    {
      "id": "c100-0007", "name": "🔴 Stream Start Alert",
      "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [800, 500],
      "parameters": { "jsCode": "const item=$input.first().json;if(item.snapshot_count!==1)return[];const msg=['🔴 *Stream Started* — '+new Date().toUTCString(),'','👤 Streamer: 阮小四'].join('\n');return [{json:{chat_id:'YOUR_CHAT_ID',message_thread_id:2,message:msg}}];" }
    },
    {
      "id": "c100-0008", "name": "✉️ Stream Start Send",
      "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [1000, 500],
      "parameters": {
        "chatId": "={{ $json.chat_id }}",
        "text": "={{ $json.message }}",
        "additionalFields": { "parse_mode": "Markdown", "message_thread_id": "={{ $json.message_thread_id }}" }
      },
      "credentials": { "telegramApi": { "id": "YOUR_CRED_ID", "name": "CloudBro-Telegram" } }
    }
  ],
  "connections": {
    "🌐 Webhook Live":    { "main": [[{ "node": "🔊 STT Chirp 2", "type": "main", "index": 0 }]] },
    "🔊 STT Chirp 2":     { "main": [[{ "node": "📝 STT Normalizer", "type": "main", "index": 0 }]] },
    "📝 STT Normalizer":  { "main": [[{ "node": "🤖 Gemini Quick", "type": "main", "index": 0 }, { "node": "🔴 Stream Start Alert", "type": "main", "index": 0 }]] },
    "🤖 Gemini Quick":    { "main": [[{ "node": "📡 Live Message Builder", "type": "main", "index": 0 }]] },
    "📡 Live Message Builder": { "main": [[{ "node": "✉️ Telegram Live Send", "type": "main", "index": 0 }]] },
    "🔴 Stream Start Alert":   { "main": [[{ "node": "✉️ Stream Start Send", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}

// N8N WORKFLOW

TRANSMISSION HUB V5.1

Hourly TikTok content sync. Fetches own posts, reposts, and liked videos via RapidAPI TikTok API using separate secUid endpoints, merges the ID lists, and POSTs the JSON payload to the website's update endpoint with Bearer auth.

N8NAPIWEBHOOK
4.6534

TRIGGER

Cron (every 1 hour)

NODES

Schedule TriggerHTTP Request — Own PostsHTTP Request — RepostsHTTP Request — LikedFormat JSONSync to Website

JSON EXPORT

READ ONLY
{
  "name": "Transmission Hub V5.1",
  "active": true,
  "nodes": [
    {
      "id": "sched", "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1, "position": [2080, 432],
      "parameters": { "rule": { "interval": [{ "field": "hours" }] } }
    },
    {
      "id": "own", "name": "HTTP Request - Own",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [2288, 432],
      "parameters": {
        "url": "https://tiktok-api23.p.rapidapi.com/api/user/posts?secUid=YOUR_SEC_UID",
        "sendHeaders": true,
        "headerParameters": { "parameters": [
          { "name": "x-rapidapi-host", "value": "tiktok-api23.p.rapidapi.com" },
          { "name": "x-rapidapi-key",  "value": "YOUR_KEY_HERE" }
        ]},
        "options": {}
      }
    },
    {
      "id": "reposts", "name": "HTTP Request - Reposts",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [2480, 432],
      "parameters": {
        "url": "https://tiktok-api23.p.rapidapi.com/api/user/repost?secUid=YOUR_SEC_UID&count=30&cursor=0",
        "sendHeaders": true,
        "headerParameters": { "parameters": [
          { "name": "x-rapidapi-host", "value": "tiktok-api23.p.rapidapi.com" },
          { "name": "x-rapidapi-key",  "value": "YOUR_KEY_HERE" }
        ]},
        "options": {}
      }
    },
    {
      "id": "liked", "name": "HTTP Request - Liked",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [2688, 432],
      "parameters": {
        "url": "https://tiktok-api23.p.rapidapi.com/api/user/liked-posts?secUid=YOUR_SEC_UID&count=30&cursor=0",
        "sendHeaders": true,
        "headerParameters": { "parameters": [
          { "name": "x-rapidapi-host", "value": "tiktok-api23.p.rapidapi.com" },
          { "name": "x-rapidapi-key",  "value": "YOUR_KEY_HERE" }
        ]},
        "options": {}
      }
    },
    {
      "id": "fmt", "name": "Format JSON",
      "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [2880, 432],
      "parameters": { "jsCode": "const getOwn=()=>{try{return $('HTTP Request - Own').first().json.data.itemList.map(i=>i.id.toString());}catch(e){return[];}};const getOther=(name)=>{try{const d=$(name).first().json;const list=d.itemList||d.items||d.data?.itemList||(Array.isArray(d)?d:[]);return list.map(i=>(i.id||i.video_id||i.aweme_id).toString());}catch(e){return[];}};return [{json:{own:getOwn(),reposts:getOther('HTTP Request - Reposts'),liked:getOther('HTTP Request - Liked')}}];" }
    },
    {
      "id": "sync", "name": "Sync to Website",
      "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [3088, 432],
      "parameters": {
        "method": "POST",
        "url": "https://your-domain.com/api/update-hub",
        "sendHeaders": true,
        "headerParameters": { "parameters": [
          { "name": "Authorization", "value": "Bearer YOUR_KEY_HERE" }
        ]},
        "sendBody": true, "specifyBody": "json",
        "jsonBody": "={{ $('Format JSON').first().json }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Schedule Trigger":      { "main": [[{ "node": "HTTP Request - Own",     "type": "main", "index": 0 }]] },
    "HTTP Request - Own":    { "main": [[{ "node": "HTTP Request - Reposts", "type": "main", "index": 0 }]] },
    "HTTP Request - Reposts":{ "main": [[{ "node": "HTTP Request - Liked",   "type": "main", "index": 0 }]] },
    "HTTP Request - Liked":  { "main": [[{ "node": "Format JSON",            "type": "main", "index": 0 }]] },
    "Format JSON":           { "main": [[{ "node": "Sync to Website",        "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}