{ "name": "mstfyldz Journal - Full Telegram & AI Automation", "nodes": [ { "parameters": { "updates": [ "message" ], "additionalFields": {} }, "id": "ace3e74e-3a67-4918-b080-046b980679fc", "name": "Telegram Trigger", "type": "n8n-nodes-base.telegramTrigger", "typeVersion": 1.1, "position": [ -464, 384 ], "webhookId": "ede016a9-34a3-4fc8-8725-291bd02403a2", "credentials": { "telegramApi": { "id": "EHAAmsKUkdoY5dGj", "name": "#1Piksel" } } }, { "parameters": { "rules": { "values": [ { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "leftValue": "={{ $json.message.voice.file_id }}", "rightValue": "", "operator": { "type": "string", "operation": "notEmpty", "singleValue": true }, "id": "e71bb63b-56de-4030-a1e1-18bc62a5fd57" } ], "combinator": "and" } }, { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "bfacad39-bcd9-447e-bba0-82192573e08f", "leftValue": "={{ $json.message.photo[0].file_id }}", "rightValue": "", "operator": { "type": "string", "operation": "notEmpty", "singleValue": true } } ], "combinator": "and" } }, { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "3e81a46e-cf60-4e2a-95ef-1d946fe7b525", "leftValue": "={{ $json.message.text }}", "rightValue": "", "operator": { "type": "string", "operation": "notEmpty", "singleValue": true } } ], "combinator": "and" } } ] }, "options": {} }, "type": "n8n-nodes-base.switch", "typeVersion": 3.4, "position": [ -256, 384 ], "id": "1f700585-3a40-4bce-b35b-316881232adf", "name": "Switch" }, { "parameters": { "resource": "file", "fileId": "={{ $json.message.voice.file_id }}", "additionalFields": {} }, "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [ 0, 352 ], "id": "f897adad-d5be-4269-a8d3-ff6750c5f207", "name": "Get a file", "webhookId": "376048bf-8f95-4841-b048-46bdf3b82dfd", "credentials": { "telegramApi": { "id": "EHAAmsKUkdoY5dGj", "name": "#1Piksel" } } }, { "parameters": { "method": "PUT", "url": "=https://storage.bunnycdn.com/apexlegal/journal/voice_{{ $('Telegram Trigger').item.json.message.voice.file_id }}.m4a", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/octet-stream" } ] }, "sendBody": true, "contentType": "binaryData", "inputDataFieldName": "data", "options": {} }, "id": "05766cac-456d-4811-aad7-906efd6c910a", "name": "Upload Voice to Bunny CDN", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [ 224, 240 ], "credentials": { "httpBasicAuth": { "id": "3bekMF2M9Kc5EE8i", "name": "Unnamed credential" }, "httpHeaderAuth": { "id": "otPWoy574X5Ur4Q7", "name": "bunnycdn" } } }, { "parameters": { "resource": "audio", "operation": "transcribe", "binaryPropertyName": "=data", "options": {} }, "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 2.1, "position": [ 256, 432 ], "id": "12eda10c-6cd0-4be4-93da-7fa51299a091", "name": "Transcribe a recording", "credentials": { "openAiApi": { "id": "dkfTY90eMiE7rE6q", "name": "OpenAi account 2" } } }, { "parameters": { "modelId": { "__rl": true, "value": "gpt-4o-mini", "mode": "list", "cachedResultName": "GPT-4O-MINI" }, "messages": { "values": [ { "content": "Sen Mustafa Yıldız'ın (mstfyldz) kişisel dijital günlüğünün yapay zeka yayın editörüsün.\nGörevin, Telegram'dan gönderilen ses transkriptini analiz ederek günlüğün tasarım diline uygun biçimlendirmek.\n\nSADECE aşağıdaki JSON formatında yanıt ver:\n{\n \"type\": \"audio\",\n \"mood\": \"spark\" | \"focus\" | \"night\" | \"calm\",\n \"moodLabel\": \"Fikir Patlaması\" | \"Aşırı Odak & Kaos\" | \"Gece Melankolisi\" | \"Sakin & Karalama\",\n \"title\": \"Kısa ilgi çekici başlık\",\n \"stampedText\": \"VOICE NOTE\",\n \"marginNotes\": [\"← samimi el yazısı kenar notu\"],\n \"tags\": [\"ses-kaydı\", \"düşünceler\"]\n}\n", "role": "system" }, { "content": "=Analiz Edilecek Transkript:\n\"{{ $json.text }}\"\n" } ] }, "options": { "temperature": 0.7 } }, "id": "fbfb3922-4588-4d8b-b2cf-a9317ed663e4", "name": "OpenAI Mood & Curator1", "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 1, "position": [ 512, 368 ], "credentials": { "openAiApi": { "id": "dkfTY90eMiE7rE6q", "name": "OpenAi account 2" } } }, { "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 || `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", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 880, 352 ] }, { "parameters": { "method": "POST", "url": "https://mstfyldz.com/api/posts", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": {} }, "id": "40dbc197-77c5-4233-ab4a-057d0aa7da77", "name": "HTTP POST to Journal API1", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [ 1104, 352 ] }, { "parameters": { "chatId": "={{ $(\"Telegram Trigger\").first().json.message.chat.id }}", "text": "=✅ *Sesli Not Bunny CDN & Deftere Kaydedildi!*\n\n📻 *Format:* {{ $(\"Format Journal Payload1\").first().json.type }}\n💡 *Mood:* {{ $(\"Format Journal Payload1\").first().json.moodLabel }}\n📌 *Başlık:* {{ $(\"Format Journal Payload1\").first().json.title }}\n⏱️ *Süre:* {{ $(\"Format Journal Payload1\").first().json.audioDuration }}\n🔗 *Bunny CDN:* {{ $(\"Format Journal Payload1\").first().json.audioUrl }}", "additionalFields": { "parse_mode": "Markdown" } }, "id": "f71c2c26-d64f-4140-af95-4db7875d6290", "name": "Telegram Send Confirmation1", "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [ 1328, 352 ], "webhookId": "656440d2-a136-4926-a700-67a780664c91", "credentials": { "telegramApi": { "id": "EHAAmsKUkdoY5dGj", "name": "#1Piksel" } } }, { "parameters": { "resource": "file", "fileId": "={{ $json.message.photo[$json.message.photo.length - 1].file_id }}", "additionalFields": {} }, "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [ 0, 672 ], "id": "caf93a90-1b0e-4b2e-9e61-67684133e4d2", "name": "Get a file1", "webhookId": "376048bf-8f95-4841-b048-46bdf3b82dfd", "credentials": { "telegramApi": { "id": "EHAAmsKUkdoY5dGj", "name": "#1Piksel" } } }, { "parameters": { "method": "PUT", "url": "=https://storage.bunnycdn.com/apexlegal/journal/photo_{{ $('Telegram Trigger').item.json.message.photo[$('Telegram Trigger').item.json.message.photo.length - 1].file_id }}.jpg", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/octet-stream" } ] }, "sendBody": true, "contentType": "binaryData", "inputDataFieldName": "data", "options": {} }, "id": "2bc19925-c13c-4df7-a7d5-756070d8be75", "name": "Upload Photo to Bunny CDN", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [ 224, 672 ], "credentials": { "httpHeaderAuth": { "id": "otPWoy574X5Ur4Q7", "name": "bunnycdn" } } }, { "parameters": { "modelId": { "__rl": true, "value": "gpt-4o-mini", "mode": "list", "cachedResultName": "GPT-4O-MINI" }, "messages": { "values": [ { "content": "Sen Mustafa Yıldız'ın (mstfyldz) kişisel dijital günlüğünün yapay zeka yayın editörüsün.\nGörevin, Telegram'dan gönderilen fotoğraf yazısını analiz ederek biçimlendirmek.\n\nSADECE aşağıdaki JSON formatında yanıt ver:\n{\n \"type\": \"polaroid\",\n \"mood\": \"visual\",\n \"moodLabel\": \"Polaroid & Kırıntılar\",\n \"title\": \"Polaroid Anı\",\n \"imageCaption\": \"Fotoğraf açıklaması\",\n \"stampedText\": \"POLAROID\",\n \"marginNotes\": [\"← samimi el yazısı kenar notu\"],\n \"tags\": [\"fotoğraf\", \"polaroid\"]\n}\n", "role": "system" }, { "content": "=Analiz Edilecek Fotoğraf Açıklaması:\n\"{{ $('Telegram Trigger').item.json.message.caption || '' }}\"\n" } ] }, "options": { "temperature": 0.7 } }, "id": "7a143f2c-dba3-4267-ad45-b922a0244771", "name": "OpenAI Mood & Curator2", "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 1, "position": [ 448, 672 ], "credentials": { "openAiApi": { "id": "dkfTY90eMiE7rE6q", "name": "OpenAi account 2" } } }, { "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 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\nconst photoObj = msg?.photo ? msg.photo[msg.photo.length - 1] : null;\nconst photoFileId = photoObj?.file_id;\nconst imageUrl = photoFileId \n ? `https://cdn.ayrislegal.com/journal/photo_${photoFileId}.jpg` \n : `https://cdn.ayrislegal.com/journal/photo_${Date.now()}.jpg`;\nconst imageCaption = msg.caption || aiParsed.imageCaption || 'Polaroid Anı';\n\nreturn {\n json: {\n id: `post-tg-${Date.now()}`,\n type: 'polaroid',\n date: dateStr,\n timestamp: timeStr,\n mood: 'visual',\n moodLabel: 'Polaroid & Kırıntılar',\n title: aiParsed.title || imageCaption,\n content: msg.caption || 'Telegram fotoğrafı',\n marginNotes: aiParsed.marginNotes || ['← Telegram fotoğrafı 📸'],\n tags: aiParsed.tags || ['telegram', 'polaroid'],\n likes: 1,\n stampedText: 'POLAROID',\n imageUrl: imageUrl,\n imageCaption: imageCaption\n }\n};\n" }, "id": "ea3e4585-66bf-4dbc-b140-5da6e0b15b2d", "name": "Format Journal Payload2", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 672, 672 ] }, { "parameters": { "method": "POST", "url": "https://mstfyldz.com/api/posts", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": {} }, "id": "8c3341a3-fddd-422d-b3fe-443a95feed00", "name": "HTTP POST to Journal API2", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [ 880, 672 ] }, { "parameters": { "chatId": "={{ $(\"Telegram Trigger\").first().json.message.chat.id }}", "text": "=✅ *Fotoğraf Bunny CDN & Deftere Kaydedildi!*\n\n📸 *Format:* {{ $(\"Format Journal Payload2\").first().json.type }}\n💡 *Mood:* {{ $(\"Format Journal Payload2\").first().json.moodLabel }}\n📌 *Açıklama:* {{ $(\"Format Journal Payload2\").first().json.imageCaption }}\n🔗 *Bunny CDN:* {{ $(\"Format Journal Payload2\").first().json.imageUrl }}", "additionalFields": { "parse_mode": "Markdown" } }, "id": "133f5737-42fb-4c39-b96d-ac599c8046e7", "name": "Telegram Send Confirmation2", "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [ 1104, 672 ], "webhookId": "656440d2-a136-4926-a700-67a780664c91", "credentials": { "telegramApi": { "id": "EHAAmsKUkdoY5dGj", "name": "#1Piksel" } } }, { "parameters": { "modelId": { "__rl": true, "value": "gpt-4o-mini", "mode": "list", "cachedResultName": "GPT-4O-MINI" }, "messages": { "values": [ { "content": "Sen Mustafa Yıldız'ın (mstfyldz) kişisel dijital günlüğünün yapay zeka yayın editörüsün.\nGörevin, Telegram'dan gönderilen metin notunu analiz ederek biçimlendirmek.\n\nSADECE aşağıdaki JSON formatında yanıt ver:\n{\n \"type\": \"sticky\" | \"notebook\" | \"code\",\n \"mood\": \"spark\" | \"focus\" | \"night\" | \"calm\",\n \"moodLabel\": \"Fikir Patlaması\" | \"Aşırı Odak & Kaos\" | \"Gece Melankolisi\" | \"Sakin & Karalama\",\n \"title\": \"Kısa ilgi çekici başlık veya null\",\n \"stampedText\": \"ONAYLANDI\" | \"COMPILED\" | \"DOĞRU TESPİT\",\n \"marginNotes\": [\"← samimi el yazısı kenar notu\"],\n \"tags\": [\"etiket1\", \"etiket2\"]\n}\n", "role": "system" }, { "content": "=Analiz Edilecek Telegram Metni:\n\"{{ $json.message.text || '' }}\"\n" } ] }, "options": { "temperature": 0.7 } }, "id": "8373912b-c5e3-403c-ba50-8fde9a181cc4", "name": "OpenAI Mood & Curator", "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 1, "position": [ 0, 0 ], "credentials": { "openAiApi": { "id": "dkfTY90eMiE7rE6q", "name": "OpenAi account 2" } } }, { "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 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: aiParsed.type || 'sticky',\n date: dateStr,\n timestamp: timeStr,\n mood: aiParsed.mood || 'spark',\n moodLabel: aiParsed.moodLabel || 'Fikir Patlaması',\n title: aiParsed.title || undefined,\n content: msg.text || '',\n marginNotes: aiParsed.marginNotes || ['← Telegram ile atıldı 📱'],\n tags: aiParsed.tags || ['telegram'],\n likes: 1,\n stampedText: aiParsed.stampedText || 'TELEGRAM'\n }\n};\n" }, "id": "3a5d2072-3a5b-4614-9204-380d543889bb", "name": "Format Journal Payload", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 224, 0 ] }, { "parameters": { "method": "POST", "url": "https://mstfyldz.com/api/posts", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": {} }, "id": "eab0b4d1-06a0-46b8-a31d-d674c7d001ee", "name": "HTTP POST to Journal API", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [ 448, 0 ] }, { "parameters": { "chatId": "={{ $(\"Telegram Trigger\").first().json.message.chat.id }}", "text": "=✅ *Not Deftere Karalandı!*\n\n📖 *Format:* {{ $(\"Format Journal Payload\").first().json.type }}\n💡 *Mood:* {{ $(\"Format Journal Payload\").first().json.moodLabel }}\n📌 *Başlık:* {{ $(\"Format Journal Payload\").first().json.title || 'Başlıksız Not' }}\n🏷️ *Etiketler:* #{{ $(\"Format Journal Payload\").first().json.tags.join(' #') }}\n\n✍️ _\"{{ $(\"Format Journal Payload\").first().json.marginNotes[0] || '' }}\"_", "additionalFields": { "parse_mode": "Markdown" } }, "id": "8f693424-c151-40c2-9c38-b327c0ecb5e1", "name": "Telegram Send Confirmation", "type": "n8n-nodes-base.telegram", "typeVersion": 1.2, "position": [ 672, 0 ], "webhookId": "656440d2-a136-4926-a700-67a780664c91", "credentials": { "telegramApi": { "id": "EHAAmsKUkdoY5dGj", "name": "#1Piksel" } } } ], "pinData": {}, "connections": { "Telegram Trigger": { "main": [ [ { "node": "Switch", "type": "main", "index": 0 } ] ] }, "Switch": { "main": [ [ { "node": "Get a file", "type": "main", "index": 0 } ], [ { "node": "Get a file1", "type": "main", "index": 0 } ], [ { "node": "OpenAI Mood & Curator", "type": "main", "index": 0 } ] ] }, "Get a file": { "main": [ [ { "node": "Upload Voice to Bunny CDN", "type": "main", "index": 0 }, { "node": "Transcribe a recording", "type": "main", "index": 0 } ] ] }, "Upload Voice to Bunny CDN": { "main": [] }, "Transcribe a recording": { "main": [ [ { "node": "OpenAI Mood & Curator1", "type": "main", "index": 0 } ] ] }, "OpenAI Mood & Curator1": { "main": [ [ { "node": "Format Journal Payload1", "type": "main", "index": 0 } ] ] }, "Format Journal Payload1": { "main": [ [ { "node": "HTTP POST to Journal API1", "type": "main", "index": 0 } ] ] }, "HTTP POST to Journal API1": { "main": [ [ { "node": "Telegram Send Confirmation1", "type": "main", "index": 0 } ] ] }, "Get a file1": { "main": [ [ { "node": "Upload Photo to Bunny CDN", "type": "main", "index": 0 } ] ] }, "Upload Photo to Bunny CDN": { "main": [ [ { "node": "OpenAI Mood & Curator2", "type": "main", "index": 0 } ] ] }, "OpenAI Mood & Curator2": { "main": [ [ { "node": "Format Journal Payload2", "type": "main", "index": 0 } ] ] }, "Format Journal Payload2": { "main": [ [ { "node": "HTTP POST to Journal API2", "type": "main", "index": 0 } ] ] }, "HTTP POST to Journal API2": { "main": [ [ { "node": "Telegram Send Confirmation2", "type": "main", "index": 0 } ] ] }, "OpenAI Mood & Curator": { "main": [ [ { "node": "Format Journal Payload", "type": "main", "index": 0 } ] ] }, "Format Journal Payload": { "main": [ [ { "node": "HTTP POST to Journal API", "type": "main", "index": 0 } ] ] }, "HTTP POST to Journal API": { "main": [ [ { "node": "Telegram Send Confirmation", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1", "binaryMode": "separate", "availableInMCP": false }, "versionId": "1dc4d58d-38a9-431d-95f6-6e9ba059a401", "meta": { "templateCredsSetupCompleted": true, "instanceId": "79d13d1a6fcae5c2e451a2b02247a15904071a685f973aa3c0464bf9f4cd5f82" }, "id": "DOB8eXjqfTrFN2F1sE5_R", "tags": [] }