Translate Cocktail Instructions with DeepL & API (n8n Workflow Template)
Overview
This n8n workflow template demonstrates how to combine a public REST API with a translation service in a concise, production-ready flow. It performs two core tasks:
- Fetch a random cocktail recipe from TheCocktailDB API.
- Translate the cocktail preparation instructions into French using the DeepL node.
The result is an automated pipeline that retrieves recipe data in English and outputs French instructions, ready to be consumed by your application, frontend, or another workflow.
Workflow Architecture
The workflow is intentionally linear and minimal, which makes it easy to understand and extend. It consists of:
- HTTP Request node – Calls TheCocktailDB random cocktail endpoint and returns the full cocktail object.
- DeepL node – Receives the extracted instructions text and translates it into French.
Data flows from the HTTP Request node into the DeepL node as a single item containing the cocktail instructions. The workflow can be triggered manually or from any trigger node you choose to add, for example a Webhook or Cron trigger.
Prerequisites
- n8n instance – Self-hosted or cloud, with permission to create and execute workflows.
- DeepL API key – Required to configure the DeepL node and authenticate translation requests.
Node-by-Node Breakdown
1. HTTP Request Node – Fetch Random Cocktail
The first node queries TheCocktailDB to retrieve a random cocktail recipe. Configuration is straightforward:
- HTTP Method:
GET - URL:
https://www.thecocktaildb.com/api/json/v1/1/random.php
This endpoint returns a JSON payload with a single cocktail object inside the drinks array. The response includes fields such as:
idDrink– Unique identifier of the cocktail.strDrink– Cocktail name.strInstructions– Preparation instructions in English.- Additional fields like ingredients, measures, and glass type.
Example JSON snippet returned by the endpoint:
{ "drinks": [ { "idDrink": "11007", "strDrink": "Margarita", "strInstructions": "Rub the rim of the glass with the lime slice to make the salt stick to it. Take care to moisten only the outer edge of the glass. Dust the rim of the glass with salt. Shake the other ingredients with ice, then carefully pour into the glass." } ]
}
n8n will typically parse this JSON automatically and make the data available on the node output under items[0].json. The key field for the next step is strInstructions from the first element of the drinks array.
Key Output for Downstream Nodes
The DeepL node will need access to:
json.drinks[0].strInstructions– The English instructions to translate.
If you want to pass additional metadata such as strDrink (cocktail name) to later nodes, you can keep the entire object intact and only reference the specific field for translation in the DeepL node.
2. DeepL Node – Translate Instructions to French
The second node in the workflow is the DeepL translation node. It receives the instructions text from the HTTP Request node and sends it to the DeepL API for translation.
Core Configuration
- Credentials: Configure and select your DeepL API credentials (API key).
- Text to translate: Reference the instructions field from the previous node, for example:
{{ $json["drinks"][0]["strInstructions"] }} - Target language: Set to
FRto produce French output.
Once configured, the DeepL node will automatically:
- Send the English instructions to the DeepL API.
- Receive the translated French text.
- Expose the translated content on its output as part of the node result.
The translated text can then be used in subsequent nodes for storage, display, or further processing.
Data Flow and Execution Logic
The workflow operates as a simple, linear pipeline:
- HTTP Request node executes a GET request to TheCocktailDB random endpoint and returns a cocktail object.
- The node output contains a
drinksarray. The first item,drinks[0], is used as the source of the instructions field. - DeepL node reads
strInstructionsfrom the first drink and sends it to DeepL for translation into French (FR). - The workflow finishes with a translated version of the cocktail instructions available in the DeepL node output.
This architecture makes it easy to plug in additional nodes before or after the translation step, such as database storage, messaging integration, or rendering in a front-end application.
Configuration Notes & Edge Cases
DeepL Credentials
- Ensure the DeepL API key is valid and has sufficient quota.
- If authentication fails, the DeepL node will not return translated text and the workflow execution will stop at that node.
Handling Missing or Unexpected API Data
TheCocktailDB endpoint is expected to return a structure with a drinks array and at least one element. In rare cases or error scenarios, you might encounter:
drinksisnullor missing.drinks[0].strInstructionsis empty or not present.
In such situations, the DeepL node will receive invalid or empty text, which may result in an error or an empty translation. For a production-grade setup, consider adding:
- A check to validate that
drinksexists and contains at least one item. - A conditional node that skips translation if instructions are missing.
Language and Encoding Considerations
- The source text from TheCocktailDB is in English. The DeepL node is configured to translate to French (
FR). - Special characters in instructions are handled by DeepL and should be preserved in the translated output.
Advanced Customization
Extend Language Support
To support more languages, you can:
- Duplicate the DeepL node and set different target languages (for example
DE,ES,IT). - Use workflow parameters or input fields to dynamically select the target language and pass it to the DeepL node.
Store or Display Translated Recipes
Once the translation is complete, common next steps include:
- Persisting the translated instructions, along with the cocktail name and ID, in a database.
- Sending the translated recipe to a front-end application or internal tool via Webhook or HTTP Request.
- Integrating with messaging platforms or email services to share translated recipes with users.
Error Handling Strategies
To increase reliability, you can add:
- Additional nodes that handle HTTP errors from TheCocktailDB (for example retry or fallback logic).
- Error branches or conditional checks after the DeepL node to catch translation failures or empty responses.
- Logging or notification nodes to alert you when an API call or translation step fails.
Summary
This n8n workflow template provides a concise, technical example of how to:
- Fetch structured data from a public REST API (TheCocktailDB).
- Extract a specific field, in this case
strInstructions, from the API response. - Translate that field into French using the DeepL node and your DeepL API key.
It is a practical foundation for building multilingual recipe experiences, integrating translation into your applications, or exploring how n8n connects external APIs and language services in a single automated pipeline.
Try the Template
Deploy this workflow in your n8n instance, connect your DeepL credentials, and start generating French cocktail instructions automatically. From there you can expand the flow with storage, notifications, or multi-language support as needed.
