Slack Slash Command Instant Translation (JA ⇄ EN) - n8n Workflow

Use this powerful n8n workflow to create a custom Slack slash command for instant Japanese-English translation. It utilizes GPT-4o-mini and an n8n node structure for speed and accuracy.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Teams operating in multinational environments needing real-time communication tools.
Developers looking for advanced examples of Slack slash command integration with n8n.
Users of n8n who need efficient, AI-powered automation solutions.
Anyone seeking reliable n8n templates for generative AI tasks within messaging apps.

Overview

Bridging language gaps in internal communication is crucial. This n8n workflow addresses the challenge of multilingual Slack channels by providing an on-demand, accurate translation tool. When a user executes the slash command, the flow performs two critical actions simultaneously:


  1. Immediate Acknowledgment: It sends an instant 'Translating...' response back to Slack to avoid the mandatory 3-second webhook timeout.

  2. AI Processing: It then detects the source language (Japanese or English), determines the target language, sends the text to the OpenAI (Chat) n8n node (specifically gpt-4o-mini for speed), and posts the finalized translation back to the channel. This efficient use of n8n ensures both a great user experience and reliable processing, making it one of the most useful n8n templates available for Slack automation.

How it Works

This highly specialized n8n workflow utilizes parallel execution and dynamic data manipulation for a smooth user experience:


  1. Trigger & Acknowledge: The process begins with the Webhook (Slash Command) n8n trigger, capturing the user's input and details. Immediately, the signal splits. One path runs the Code (Ack) n8n node, which returns 'Translating...' via the Respond to Webhook node, satisfying Slack's timeout requirement.

  2. Language Detection: The primary execution path hits the Detect Language (Code) n8n node. This code analyzes the input text, uses heuristics to detect Japanese characters, and assigns the target language (JA or EN). It also handles explicit overrides like en: [text].

  3. AI Translation: The data passes to the OpenAI (Chat) - Translate n8n node. It uses a concise system prompt and the detected target language variable to ensure an accurate translation using the gpt-4o-mini model.

  4. Data Combination: A Merge n8n node combines the original user details (like the user ID and original text from the detection step) with the newly generated translation.

  5. Response Preparation: The Prepare Response n8n node formats the combined data into a readable message, citing the user who initiated the command and including both the original and translated text.

  6. Final Post: Finally, an HTTP Request n8n node uses the unique response_url provided by the initial n8n trigger to post the final, formatted translation back into the Slack channel, completing the entire n8n workflow.

Installation Guide

To set up this powerful n8n workflow, follow these steps:


  1. Import: Import this n8n workflow JSON into your n8n instance.

  2. Credentials: Set up or select your OpenAI API Key credentials for the OpenAI (Chat) - Translate n8n node.

  3. Activate Trigger: Locate the Webhook (Slash Command) n8n trigger node and copy its Production Webhook URL.

  4. Slack Setup: In your Slack workspace settings, create a new Slash Command (e.g., /trans). Paste the copied Production Webhook URL into the Request URL field for this command. Ensure the HTTP Method is set to POST.

  5. Activate n8n Workflow: Activate the n8n workflow. The automation is now ready for use by typing /trans [text to translate] in any Slack channel.

Node Details

Webhook (Slash Command): The primary n8n trigger. Listens for incoming POST requests from the Slack /trans slash command on the path /slack/trans. It captures the user's input and the necessary responseurl.
Code (Ack) & Respond to Webhook: These nodes work in parallel with the main translation path. The Code (Ack) n8n node prepares the text 'Translating...' and the Respond to Webhook node sends this immediate response to Slack to prevent the operation from timing out, a vital feature for robust n8n templates.
Detect Language (Code): This complex code n8n node parses the Slack payload. It is responsible for:
Trimming input and handling empty requests.
Heuristically detecting the presence of Japanese characters.
Setting the dynamic target variable (en or ja).
Supporting explicit target overrides (e.g., en: [text] or ja: [text]).
OpenAI (Chat) - Translate: The core translation component. This n8n node uses the gpt-4o-mini model configured with a low temperature (0.2) for stable, non-creative translations, translating into the dynamically provided target language.
Prepare Response (Code): This code n8n node retrieves the translated text and the original metadata (user ID, original text). It formats the final message for public posting in Slack.
HTTP Request: This final n8n node posts the result back to Slack using the response
url provided by the initial n8n trigger. It is configured to post in_channel by default.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

Creative Technologist blending design and automation to make work a little more fun. Exploring how AI and workflow tools like n8n can bring creativity into everyday work.

Featured*