AI Telegram Bot with Supabase memory
Configured with HTTP Request, Supabase, Telegram, Telegram Trigger. Review the connections and setup before adapting this template.
Node categories in this workflow
- Trigger
- Web / API
- Data store
- Transform
- Messaging
- Routing
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| Get New Message | Trigger | Telegram Trigger | See node parameters |
| OPENAI - Create thread | Web / API | HTTP Request | POST |
| Create User | Data store | Supabase | See node parameters |
| Merge | Transform | Merge | See node parameters |
| OPENAI - Send message | Web / API | HTTP Request | POST |
| OPENAI - Run assistant | Web / API | HTTP Request | POST |
| OPENAI - Get messages | Web / API | HTTP Request | See node parameters |
| Send Message to User | Messaging | Telegram | See node parameters |
| If User exists | Routing | If | See node parameters |
| Find User | Data store | Supabase | getAll |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
openAiApisupabaseApitelegramApi
Workflow notes
Sticky Note1
SQL query to create table in Supabase:
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;
Sticky Note2
Create assistant in OpenAI.
Specify own assistant id here
Sticky Note3
Create own Telegram bot in Botfather bot
Sticky Note4
Create table in Supabase with SQL query
Set up steps
Set up steps
- Create a Telegram Bot using the Botfather and obtain the bot token.
- Set up Supabase:
- Create a new project and generate a
SUPABASE_URLandSUPABASE_KEY. - Create a new table named
telegram_userswith the following SQL query:
- Create a new project and generate a
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 Setup:
- Create an OpenAI assistant and obtain the
OPENAI_API_KEY. - Customize your assistant’s personality or use cases according to your requirements.
- Create an OpenAI assistant and obtain the
- Environment Configuration in n8n:
- Configure the Telegram, Supabase, and OpenAI nodes with the appropriate credentials.
- Set up triggers for receiving messages and handling conversation logic.
- Set up OpenAI assistant ID in "++OPENAI - Run assistant++" node.
AI Telegram Bot with Supabase memory
AI Telegram Bot with Supabase memory
Made by Mark Shcherbakov from community 5minAI
Many simple chatbots lack context awareness and user memory. This workflow solves that by integrating Supabase to keep track of user sessions (via telegram_id and openai_thread_id), 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.
AI Telegram Bot with Supabase memory
AI Telegram Bot with Supabase memory
Purpose and structure
This folder contains the AI Telegram Bot with Supabase memory workflow. Its executable nodes use httpRequest, if, merge, supabase, telegram, telegramTrigger. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
Get New Message
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Http/0594_HTTP_Telegram_Create_Webhook.json MIT; preserve source notices.