style: update n8n workflow voice titles from 'Telegram Voice Note' to 'Voice Note'

This commit is contained in:
mstfyldz
2026-08-16 18:33:02 +03:00
parent 48132c192b
commit 42e675fec2
2 changed files with 3 additions and 5 deletions
+1 -1
View File
@@ -233,7 +233,7 @@
},
{
"parameters": {
"jsCode": "const msg = $(\"Telegram Trigger\").first().json.message;\nlet aiParsed = {};\ntry {\n const rawText = $input.first().json.message?.content || $input.first().json.text || '{}';\n aiParsed = JSON.parse(rawText.replace(/```json|```/g, '').trim());\n} catch (e) {\n aiParsed = {};\n}\n\nconst audioObj = msg?.voice || msg?.audio;\nlet audioDuration = undefined;\nlet audioTitle = undefined;\nlet audioUrl = undefined;\n\nif (audioObj) {\n const durSec = audioObj.duration || 0;\n const mins = Math.floor(durSec / 60).toString().padStart(2, '0');\n const secs = (durSec % 60).toString().padStart(2, '0');\n audioDuration = `${mins}:${secs}`;\n audioTitle = msg.audio?.file_name || `Telegram_Voice_Note_${durSec}s.m4a`;\n \n // Telegram voice file_id ile Bunny CDN kalıcı linki 1:1 tam eşleşir!\n const voiceFileId = audioObj.file_id;\n audioUrl = `https://cdn.ayrislegal.com/journal/voice_${voiceFileId}.m4a`;\n}\n\nconst now = new Date();\nconst dateStr = now.toLocaleDateString('tr-TR', { day: '2-digit', month: 'short', year: 'numeric' }).toUpperCase();\nconst timeStr = now.toLocaleTimeString('tr-TR', { hour: '2-digit', minute: '2-digit' });\n\nreturn {\n json: {\n id: `post-tg-${Date.now()}`,\n type: 'audio',\n date: dateStr,\n timestamp: timeStr,\n mood: aiParsed.mood || 'spark',\n moodLabel: aiParsed.moodLabel || 'Fikir Patlaması',\n title: aiParsed.title || 'Telegram Ses Kaydı',\n content: $(\"Transcribe a recording\")?.first()?.json?.text || 'Sesli Not',\n marginNotes: aiParsed.marginNotes || ['← Telegram ses kaydı 🎙️'],\n tags: aiParsed.tags || ['telegram', 'voice'],\n likes: 1,\n stampedText: 'VOICE NOTE',\n audioDuration: audioDuration || '01:00',\n audioTitle: audioTitle || 'Telegram_Voice_Note.m4a',\n audioUrl: audioUrl\n }\n};\n"
"jsCode": "const msg = $(\"Telegram Trigger\").first().json.message;\nlet aiParsed = {};\ntry {\n const rawText = $input.first().json.message?.content || $input.first().json.text || '{}';\n aiParsed = JSON.parse(rawText.replace(/```json|```/g, '').trim());\n} catch (e) {\n aiParsed = {};\n}\n\nconst audioObj = msg?.voice || msg?.audio;\nlet audioDuration = undefined;\nlet audioTitle = undefined;\nlet audioUrl = undefined;\n\nif (audioObj) {\n const durSec = audioObj.duration || 0;\n const mins = Math.floor(durSec / 60).toString().padStart(2, '0');\n const secs = (durSec % 60).toString().padStart(2, '0');\n audioDuration = `${mins}:${secs}`;\n audioTitle = msg.audio?.file_name || `Voice_Note_${durSec}s.m4a`;\n \n // Telegram voice file_id ile Bunny CDN kalıcı linki 1:1 tam eşleşir!\n const voiceFileId = audioObj.file_id;\n audioUrl = `https://cdn.ayrislegal.com/journal/voice_${voiceFileId}.m4a`;\n}\n\nconst now = new Date();\nconst dateStr = now.toLocaleDateString('tr-TR', { day: '2-digit', month: 'short', year: 'numeric' }).toUpperCase();\nconst timeStr = now.toLocaleTimeString('tr-TR', { hour: '2-digit', minute: '2-digit' });\n\nreturn {\n json: {\n id: `post-tg-${Date.now()}`,\n type: 'audio',\n date: dateStr,\n timestamp: timeStr,\n mood: aiParsed.mood || 'spark',\n moodLabel: aiParsed.moodLabel || 'Fikir Patlaması',\n title: aiParsed.title || 'Voice Note',\n content: $(\"Transcribe a recording\")?.first()?.json?.text || 'Sesli Not',\n marginNotes: aiParsed.marginNotes || ['← Voice note 🎙️'],\n tags: aiParsed.tags || ['telegram', 'voice'],\n likes: 1,\n stampedText: 'VOICE NOTE',\n audioDuration: audioDuration || '01:00',\n audioTitle: audioTitle || 'Voice_Note.m4a',\n audioUrl: audioUrl\n }\n};\n"
},
"id": "32fe7f7c-fbae-4f19-8944-b530d4bceb1c",
"name": "Format Journal Payload1",