{ "name": "Daily Translated Chinese Poem to Telegram", "nodes": [ { "name": "Cron", "type": "n8n-nodes-base.cron", "position": [ -250, 400 ], "parameters": { "triggerTimes": { "item": [ { "mode": "everyDay", "hour": 10 } ] } }, "typeVersion": 1, "id": "daily-translated-chinese-poem-to-telegram-0" }, { "name": "HTTP Request", "type": "n8n-nodes-base.httpRequest", "position": [ -50, 400 ], "parameters": { "method": "GET", "url": "https://poetry.palemoky.com/api/poems/random?type=%E4%BA%94%E8%A8%80%E7%BB%9D%E5%8F%A5", "options": { "timeout": 30000, "response": { "response": { "responseFormat": "json" } } } }, "typeVersion": 4.2, "id": "daily-translated-chinese-poem-to-telegram-1" }, { "name": "Read the poem", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForAllItems", "jsCode": "const p=$input.first().json.data;if(typeof p?.title!=='string'||!p.title.trim()||typeof p?.author?.name!=='string'||!p.author.name.trim()||!Array.isArray(p.content)||!p.content.length||p.content.some(x=>typeof x!=='string')||!p.content.join('').trim())throw Error('Poetry response is missing a title, author or content');return [{json:{title:p.title,author:p.author.name,text:p.content.join('\\n')}}];" }, "id": "daily-translated-chinese-poem-to-telegram-2" }, { "name": "LingvaNex", "type": "n8n-nodes-base.lingvaNex", "position": [ 150, 400 ], "parameters": { "operation": "translate", "text": "={{ $json.text }}", "translateTo": "en_GB", "options": {} }, "typeVersion": 1, "id": "daily-translated-chinese-poem-to-telegram-3" }, { "name": "Compose the poem message", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForAllItems", "jsCode": "const translation=$input.first().json.result;const p=$('Read the poem').first().json;if(typeof translation!=='string'||!translation.trim())throw Error('Translation was not returned');const text='✒️ Poem of the day:\\n'+p.title+' by '+p.author+'\\n\\n'+translation+'\\n☁️';if(text.length>4096)throw Error('Telegram message exceeds 4096 characters');return [{json:{text}}];" }, "id": "daily-translated-chinese-poem-to-telegram-4" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram", "position": [ 350, 400 ], "parameters": { "chatId": "YOUR_TELEGRAM_CHAT_ID", "text": "={{ $json.text }}", "additionalFields": {} }, "typeVersion": 1, "id": "daily-translated-chinese-poem-to-telegram-5" } ], "active": false, "settings": { "executionOrder": "v1", "timezone": "UTC" }, "connections": { "Cron": { "main": [ [ { "node": "HTTP Request", "type": "main", "index": 0 } ] ] }, "HTTP Request": { "main": [ [ { "node": "Read the poem", "type": "main", "index": 0 } ] ] }, "Read the poem": { "main": [ [ { "node": "LingvaNex", "type": "main", "index": 0 } ] ] }, "LingvaNex": { "main": [ [ { "node": "Compose the poem message", "type": "main", "index": 0 } ] ] }, "Compose the poem message": { "main": [ [ { "node": "Telegram", "type": "main", "index": 0 } ] ] } }, "pinData": {} }