{ "name": "Telegram Documents to Google Drive", "tags": [], "nodes": [ { "id": "0fcb072b-ea4b-43b2-ad7c-46ad62b1e2ad", "name": "On new Telegram Message", "type": "n8n-nodes-base.telegramTrigger", "position": [ 900, 520 ], "parameters": { "updates": [ "message" ], "additionalFields": { "download": true } }, "typeVersion": 1 }, { "id": "08e492f8-b969-4de2-b207-17fcd3cb8787", "name": "If Message contains a File", "type": "n8n-nodes-base.if", "position": [ 1160, 520 ], "parameters": { "options": {}, "conditions": { "options": { "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "9b876834-1a86-48f1-9890-df60c739c91c", "operator": { "type": "object", "operation": "exists", "singleValue": true }, "leftValue": "={{ $json.message.document }}", "rightValue": "" } ] } }, "typeVersion": 2 }, { "id": "f155a855-0eac-44c0-a52a-93446b9b3455", "name": "Upload File to GDrive", "type": "n8n-nodes-base.googleDrive", "position": [ 1500, 500 ], "parameters": { "name": "={{ $json.message.document.file_name }}", "driveId": { "__rl": true, "mode": "list", "value": "My Drive" }, "options": {}, "folderId": { "__rl": true, "mode": "id", "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID" } }, "typeVersion": 3 }, { "id": "telegram-documents-to-google-drive-receipt", "name": "Confirm the uploaded file", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1740, 500 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "return $input.all().map((item,index)=>{if(typeof item.json.id!==\"string\"||!item.json.id)throw new Error(\"Drive did not confirm the file; inspect Drive before replaying.\");return {json:item.json,pairedItem:{item:index}};});" } } ], "active": false, "pinData": {}, "settings": { "executionOrder": "v1" }, "connections": { "On new Telegram Message": { "main": [ [ { "node": "If Message contains a File", "type": "main", "index": 0 } ] ] }, "If Message contains a File": { "main": [ [ { "node": "Upload File to GDrive", "type": "main", "index": 0 } ] ] }, "Upload File to GDrive": { "main": [ [ { "node": "Confirm the uploaded file", "type": "main", "index": 0 } ] ] } } }