Multilingual Telegram Bot with User Tracking - n8n Workflow

Deploy a robust, multilingual Telegram bot using this advanced n8n workflow. It tracks new/returning users in NocoDB and delivers localized, dynamic responses for /start and /help commands.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Community Managers who need to support users speaking different languages.

  • Automation Engineers looking for advanced n8n templates demonstrating user state management and localization.

  • Developers interested in integrating databases (like NocoDB) to power dynamic chat applications.

  • Anyone looking to deploy a high-functioning n8n workflow without custom server infrastructure.

Overview

Building scalable bots requires smart handling of localization and user data. This specific n8n workflow template solves the challenge of creating a truly multilingual Telegram bot by centralizing all bot messages in a database (NocoDB) and dynamically switching the response language based on the user's settings. Crucially, the n8n workflow tracks whether a user is new or returning, ensuring a customized welcome or welcome-back message. By using a combination of the Telegram n8n node, database lookups, and flow control logic, this n8n automation provides a resilient, easily maintainable solution for international communication.

How it Works

The entire process is initiated by the Telegram Trigger n8n node.


  1. Trigger and Dictionary Load: The n8n trigger waits for any incoming Telegram message. Simultaneously, the workflow loads the entire multilingual dictionary from the NocoDB 'botmessages' table.

  2. Language and Chat ID Extraction: A Function n8n node (named chatID) extracts the user's chat ID and determines the appropriate language based on the user's Telegram settings (defaulting to English if the language is not supported).

  3. User State Check: The n8n workflow uses the NocoDB CheckUser n8n node to determine if the chatID already exists in the 'TGusers' table.

  4. Routing Commands: The Merge node combines the initial trigger data and the user check result. A subsequent Switch n8n node examines the message text, routing the flow based on commands like /start (Output 0), /help (Output 1), or any other unrecognized command (Fallback Output).

  5. User Onboarding Logic (for /start command): The New user? Function node checks the database result. The IF n8n node then splits the flow: new users are registered via HTTP AddUser and receive the msggreet localization; returning users are updated via HTTP UpdateUser and receive the msgwelcomeback localization.

  6. Localized Response: All response nodes (like msghelp or msg_wrongcommand) use expressions combined with the dictionary data and the language code determined earlier to send the perfectly localized message back to the user via the Telegram n8n node. This ensures every interaction driven by this n8n template is correctly translated.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and import it directly into your n8n instance.

  2. Telegram Credentials: Set up your Telegram API credentials within n8n. These must be linked to both the initial 'Telegram Trigger' n8n node and all outgoing Telegram n8n node actions.

  3. NocoDB Setup: You will need a running NocoDB instance configured with two tables: TG_users (for user tracking) and botmessages (containing your dictionary key-value pairs for localization).

  4. Database Credentials: Configure the NocoDB credentials (API key and URL) required by the CheckUser and LoadDictionary n8n node operations, as well as the HTTP Header Auth credentials required for the HTTP AddUser and HTTP UpdateUser nodes (which replace temporarily broken NocoDB functionality).

  5. Activate the Trigger: Ensure the 'Telegram Trigger' n8n node is set to active (webhook mode) to start listening for incoming messages.

Node Details

Telegram Trigger (n8n trigger): The starting point of this n8n workflow. It listens for incoming messages, essential for any Telegram bot automation.
LoadDictionary & botmessages (NocoDB & Function): Loads all localized bot messages from NocoDB. The subsequent botmessages n8n node restructures this array data into an accessible object, keyed by message name, simplifying lookups.
chatID (Function n8n node): Determines the user's current language preference. Key Configuration: Contains logic to enforce supported languages ('ru', 'en') or default to 'en'.
CheckUser (NocoDB n8n node): Queries the NocoDB TGusers table using the chatID to check for prior activity, central to the user tracking functionality of this n8n workflow.
Switch (n8n node): Routes the flow based on the text of the incoming message, enabling command handling for /start and /help.
IF (n8n node): A critical flow control element. It checks the output of the New user? Function to route traffic either to the Add User path or the Update User path.
HTTP AddUser / HTTP UpdateUser (HTTP Request n8n node): Handles persistence by adding new users or updating returning users in the NocoDB database. These are configured with a POST (Add) or PATCH (Update) method using Header Authentication.
msg
greet, msg_help, etc. (Telegram n8n node): The final action nodes. Key Configuration: Uses complex expressions (e.g., {{$evaluateExpression($node["botmessages"].json["greeting"][$node["chatID"].json["lang"]])}}) to pull the correct language string based on the user's determined language code.

Related n8n Workflows

Free

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

Featured*