Files
mstfyldz/n8n_journal_workflow.json
T

753 lines
24 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"name": "mstfyldz Journal - Full Telegram & AI Automation",
"nodes": [
{
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"id": "13ae8c1e-3cd2-4365-a6b2-8f3301a7f9db",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1.1,
"position": [
-304,
320
],
"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 }}",
"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": [
-96,
320
],
"id": "baebb5f0-df5f-4b90-98cb-eaf7fc3f3405",
"name": "Switch"
},
{
"parameters": {
"resource": "file",
"fileId": "={{ $json.message.voice.file_id }}",
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
160,
288
],
"id": "b9f0a086-36db-462b-ae75-460b6ae6bf9a",
"name": "Get a file",
"webhookId": "376048bf-8f95-4841-b048-46bdf3b82dfd",
"credentials": {
"telegramApi": {
"id": "EHAAmsKUkdoY5dGj",
"name": "#1Piksel"
}
}
},
{
"parameters": {
"method": "PUT",
"url": "=https://storage.bunnycdn.net/apexlegal/journal/voice_{{ Date.now() }}.m4a",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "AccessKey",
"value": "1cc9536e-7e5c-480d-8c93ac12ec46-357a-4d81"
},
{
"name": "Content-Type",
"value": "application/octet-stream"
}
]
},
"sendBody": true,
"specifyBody": "key",
"bodyKey": "data"
},
"id": "bunny-upload-voice",
"name": "Upload Voice to Bunny CDN",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
380,
288
]
},
{
"parameters": {
"resource": "audio",
"operation": "transcribe",
"binaryPropertyName": "=data",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 2.1,
"position": [
600,
288
],
"id": "5942e900-db59-4a94-a68b-99f1f0480fce",
"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": "fbecf695-5165-477f-9a1b-2f116572edf5",
"name": "OpenAI Mood & Curator1",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1,
"position": [
820,
288
],
"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 || `Telegram_Voice_Note_${durSec}s.m4a`;\n \n const nowTs = Date.now();\n audioUrl = `https://cdn.ayrislegal.com/journal/voice_${nowTs}.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"
},
"id": "e149107d-0521-4ded-875e-53125a5d406b",
"name": "Format Journal Payload1",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1040,
288
]
},
{
"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": "34b351a4-ca88-4f0e-978a-69fa42b09856",
"name": "HTTP POST to Journal API1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1260,
288
]
},
{
"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": "feac8b5a-3187-4fe7-a7c4-048490674594",
"name": "Telegram Send Confirmation1",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1480,
288
],
"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": [
160,
608
],
"id": "df183b43-0faf-4682-8071-37ac46b0fe01",
"name": "Get a file1",
"webhookId": "376048bf-8f95-4841-b048-46bdf3b82dfd",
"credentials": {
"telegramApi": {
"id": "EHAAmsKUkdoY5dGj",
"name": "#1Piksel"
}
}
},
{
"parameters": {
"method": "PUT",
"url": "=https://storage.bunnycdn.net/apexlegal/journal/photo_{{ Date.now() }}.jpg",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "AccessKey",
"value": "1cc9536e-7e5c-480d-8c93ac12ec46-357a-4d81"
},
{
"name": "Content-Type",
"value": "application/octet-stream"
}
]
},
"sendBody": true,
"specifyBody": "key",
"bodyKey": "data"
},
"id": "bunny-upload-photo",
"name": "Upload Photo to Bunny CDN",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
380,
608
]
},
{
"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": "250514cb-c0f7-47ac-b20e-fd2176e209db",
"name": "OpenAI Mood & Curator2",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1,
"position": [
600,
608
],
"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 nowTs = Date.now();\nconst imageUrl = `https://cdn.ayrislegal.com/journal/photo_${nowTs}.jpg`;\nconst imageCaption = msg.caption || aiParsed.imageCaption || 'Polaroid Anı';\n\nreturn {\n json: {\n id: `post-tg-${nowTs}`,\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": "4ef91a2e-304b-4454-a195-0025daae383a",
"name": "Format Journal Payload2",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
820,
608
]
},
{
"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": "c249c1af-c3ca-4a4f-9540-231e1be109e4",
"name": "HTTP POST to Journal API2",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1040,
608
]
},
{
"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": "8433104f-9bb2-4afd-88e8-cdd9db756d99",
"name": "Telegram Send Confirmation2",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1260,
608
],
"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": "bd9bc72e-1873-4b89-b5ea-23b7d4cf6720",
"name": "OpenAI Mood & Curator",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1,
"position": [
160,
-60
],
"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": "4dddf013-f5e6-4009-b202-d6b17aac525e",
"name": "Format Journal Payload",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
380,
-60
]
},
{
"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": "265e43cc-8c16-451d-8d79-5bfbf27d8687",
"name": "HTTP POST to Journal API",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
600,
-60
]
},
{
"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": "c4afd057-d48f-421d-abd2-ab3a0e56bb02",
"name": "Telegram Send Confirmation",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
820,
-60
],
"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
}
]
]
},
"Upload Voice to Bunny CDN": {
"main": [
[
{
"node": "Transcribe a recording",
"type": "main",
"index": 0
}
]
]
},
"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": []
}