Block 1 - Get New Message
- Type / Role
- n8n-nodes-base.telegramTrigger - telegramTrigger
- Config choices
- Version 1.1
This workflow is provided as-is. Please review and test before using in production.
Video Guide I prepared a detailed guide that showed the whole process of building an AI bot, from the simplest version to the most complex in a template. [, allowing the bot to maintain continuity and context in conversations, leading to a more human-like and engaging experience.
This Telegram bot template connects with OpenAI to answer user queries while storing and retrieving user information from a Supabase database. The memory component ensures that the bot can reference past interactions, making it suitable for use cases such as customer support, virtual assistants, or any application where context retention is crucial.
1.Receive New Message: The bot listens for incoming messages from users in Telegram.
2. Check User in Database: The workflow checks if the user is already in the Supabase database using the telegram_id.
3. Create New User (if necessary): If the user does not exist, a new record is created in Supabase with the telegram_id and a unique openai_thread_id.
4. Start or Continue Conversation with OpenAI: Based on the user’s context, the bot either creates a new thread or continues an existing one using the stored openai_thread_id.
5. Merge Data: User-specific data and conversation context are merged.
6. Send and Receive Messages: The message is sent to OpenAI, and the response is received and processed.
7. Reply to User: The bot sends OpenAI’s response back to the user in Telegram.
SUPABASE_URL and SUPABASE_KEY.telegram_users with the following SQL query:create table
public.telegram_users (
id uuid not null default gen_random_uuid (),
date_created timestamp with time zone not null default (now() at time zone 'utc'::text),
telegram_id bigint null,
openai_thread_id text null,
constraint telegram_users_pkey primary key (id)
) tablespace pg_default;
OPENAI_API_KEY.This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.
| Workflow | Telegram bot with Supabase memory and OpenAI assistant integration |
|---|---|
| Complexity | advanced |
| Nodes | 17 |
| Categories | Support Chatbot, AI Chatbot |
| Author | Mark Shcherbakov |
| Published | 06 Oct 2024 |
Use the JSON export at /data/workflows/2453/2453.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.
Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.
Video Guide I prepared a detailed guide that showed the whole process of building an AI bot, from the simplest version to the most complex in a template. [![Youtube thumb 3.png](https://cflobdhpqwn...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot, AI Chatbot use case.