High-Performance User Authentication with Telegram, Redis, and Google Sheets - n8n Workflow

Use this robust n8n workflow template to manage user authentication rapidly. Integrate Telegram messages, check Redis cache for speed, and persist data in Google Sheets. Learn how to optimize your n8n node configuration.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Developers building applications who need a reliable, fast, and scalable login system.
Automation engineers looking to implement caching layers using the Redis n8n node.
Users who require an interactive authentication start via a Telegram n8n trigger.
Anyone interested in advanced core logic flow control techniques within an n8n workflow.

Overview

Managing user sessions and authentication often involves repeated database lookups, which can slow down applications. This n8n workflow solves this performance problem by introducing an intelligent caching layer using Redis, ensuring that frequently accessed user data is retrieved instantly, bypassing the slower Google Sheets lookup. The n8n automation starts either via a Telegram message (acting as a primary user interface) or by being called as a sub-workflow via the Execute Workflow n8n trigger. This structure provides a high-performance, robust, and versatile authentication engine, making this one of the most useful n8n templates for handling user data efficiently.

How it Works

This n8n workflow is designed around a dual-entry point system and a caching priority logic:


  1. Initiation: The n8n workflow can start either via the Telegram n8n trigger (receiving a user message) or the Execute Workflow trigger (when called by another n8n workflow).

  2. Data Normalization: Incoming data (user ID) from either source is processed and normalized by Edit Fields or Edit Fields2 set n8n node.

  3. Cache Check: The normalized data is merged and passed to the Find Cached User Redis n8n node, which attempts to retrieve the user ID from Redis.

  4. Is Cached Switch: The Is Cached switch n8n node routes the flow. If the user data is found in Redis, the process is complete, and the data is merged into the final UserId n8n node.

  5. Google Sheets Lookup: If the user is not cached, the workflow executes the Find User Google Sheets n8n node to search the main database.

  6. New User Logic: The Is New User switch n8n node determines if a record was found.

Existing User: If found, the data is immediately sent to the Cache User Redis n8n node to update the cache before proceeding to the final UserId merge.
New User: If not found, the workflow uses the Get UserId Code n8n node (likely generating a unique ID) and then registers the new user using the Create User Google Sheets n8n node. This new user data is then also merged into the final output.

This structured approach ensures minimal latency and efficient resource usage across this complex n8n template.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and import it directly into your n8n instance using the 'New' menu -> 'Import from JSON'.

  2. Telegram Setup: Configure the 'Get Message' Telegram n8n trigger by creating a new Telegram Bot credential and linking it. Ensure the webhook is correctly set up.

  3. Google Sheets Setup: You need a dedicated spreadsheet for user storage. Create a Google Sheets credential and update the 'Get User', 'Find User', and 'Create User' Google Sheets n8n node configurations with your Spreadsheet ID, Sheet Name, and the required columns.

  4. Redis Setup: Configure a Redis credential and apply it to the 'Find Cached User' and 'Cache User' Redis n8n node instances. Ensure connection parameters are correct.

  5. Activation: Once all credentials and configurations are set, activate the n8n workflow. The Telegram n8n trigger will immediately be ready to receive messages.

Node Details

Telegram Trigger (Get Message): This is the primary external n8n trigger. It listens for incoming messages on a configured Telegram bot, initiating the user lookup process.
Execute Workflow Trigger (When Executed by Another Workflow): Allows this authentication logic to be reused and called as a child n8n workflow from other n8n templates.
Google Sheets (Get User / Find User / Create User): These n8n node instances handle the persistent storage. They are used to search for existing users and create new user records if the user is not found in the cache. 'Find User' specifically performs the database query when the Redis lookup fails.
Redis (Find Cached User / Cache User): These key n8n node elements provide the crucial caching mechanism. 'Find Cached User' checks Redis first for performance, and 'Cache User' ensures newly retrieved or created data is stored back in the cache.
Switch (Is Cached / Is New User): These conditional n8n node components manage the flow control. 'Is Cached' branches the flow based on Redis results, and 'Is New User' branches based on whether the Google Sheets search was successful, determining if a user registration is necessary.
Code (Get UserId): A custom n8n node used to execute JavaScript, likely responsible for generating a unique identifier or performing complex data manipulation required for the new user creation step.

Related n8n Workflows

Paid

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

Featured*