{ "name": "Translate Random Cocktail Instructions", "nodes": [ { "name": "On clicking 'execute'", "type": "n8n-nodes-base.manualTrigger", "position": [ 250, 300 ], "parameters": {}, "typeVersion": 1, "id": "translate-random-cocktail-instructions-0" }, { "name": "HTTP Request", "type": "n8n-nodes-base.httpRequest", "position": [ 450, 300 ], "parameters": { "method": "GET", "url": "https://www.thecocktaildb.com/api/json/v1/1/random.php", "options": { "timeout": 30000, "response": { "response": { "responseFormat": "json" } } } }, "typeVersion": 4.2, "id": "translate-random-cocktail-instructions-1" }, { "name": "Select the instructions", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForAllItems", "jsCode": "const text=$input.first().json.drinks?.[0]?.strInstructions;if(typeof text!=='string'||!text.trim())throw Error('Missing cocktail instructions');return [{json:{text}}];" }, "id": "translate-random-cocktail-instructions-2" }, { "name": "LingvaNex", "type": "n8n-nodes-base.lingvaNex", "position": [ 650, 300 ], "parameters": { "operation": "translate", "text": "={{ $json.text }}", "translateTo": "it_IT", "options": {} }, "typeVersion": 1, "id": "translate-random-cocktail-instructions-3" }, { "name": "Read the translation", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForAllItems", "jsCode": "const r=$input.first().json;if(typeof r.result!=='string')throw Error('Translation was not returned');return [{json:{sourceInstructions:$('Select the instructions').first().json.text,italianInstructions:r.result}}];" }, "id": "translate-random-cocktail-instructions-4" } ], "active": false, "settings": {}, "connections": { "On clicking 'execute'": { "main": [ [ { "node": "HTTP Request", "type": "main", "index": 0 } ] ] }, "HTTP Request": { "main": [ [ { "node": "Select the instructions", "type": "main", "index": 0 } ] ] }, "Select the instructions": { "main": [ [ { "node": "LingvaNex", "type": "main", "index": 0 } ] ] }, "LingvaNex": { "main": [ [ { "node": "Read the translation", "type": "main", "index": 0 } ] ] } }, "pinData": {} }