anaksor-ocr
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
An n8n workflow that gives a Telegram bot a memory for each person. It opens an OpenAI conversation for each new person, saves its id in a Supabase table and continues that conversation on every later message.
Telegram bot with a Supabase memory for each person is an n8n workflow in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.
A Telegram message
It starts each time someone sends a message to your bot, and there is no form:
A Telegram reply that continues the person’s own conversation, and one table row for each person
What you need before you start.
Chat app
Delivers each message to the workflow and sends the reply back.
NeedsA bot token from BotFather, as a Telegram credential
Memory table
Keeps each person’s chat number and conversation id.
NeedsThe project address and its secret key, and a table named telegram_users
AI model
Holds each conversation and writes the replies.
NeedsAn OpenAI API key and some credit
Checked by Mindket on 13 Nov 2026
This n8n workflow lets a Telegram bot remember each person who writes to it. A Supabase table holds one row for each person, with their chat number and the id of their OpenAI conversation. A new person gets a new conversation, and a known person continues the old one. OpenAI’s Responses API writes each answer, and Telegram sends it back. Ten nodes do the work, beside five sticky notes.
Builders and small teams who want a Telegram bot that keeps the thread of each chat for days or weeks. You need a Supabase project and an OpenAI key. Skip it if one shared memory for everyone is enough, because a simple chat bot is easier to run.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Support | Small shops | Answer returning customers without asking the same things again | A customer comes back a week later, and the bot still knows which order they asked about. |
| Education | Tutors | Keep a study chat going with each student | A student asks for more practice on the topic from last Tuesday, and the bot continues from there. |
| Health and wellness | Coaches | Follow up with each client in their own thread | The bot remembers that a client wanted to walk more and asks how the week went. |
| Community | Club organizers | Help each member with their own questions | A member asks a follow-up about an event, and the bot knows which event they mean. |
You need some n8n: import a file, add four credentials, run two short queries and edit one text.
Any n8n with a public HTTPS address can run it, because Telegram sends each message to that address.
Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. You need a Telegram bot token, a Supabase project and an OpenAI API key.
| Need | Detail |
|---|---|
| n8n | On n8n Cloud or on a server with a public HTTPS address |
| Telegram | A bot and its token, which you get from BotFather inside Telegram |
| Supabase | A project, its address and its secret key |
| OpenAI | An API key and some credit |
workflow.json.telegram_users: an id that is a uuid, a telegram_id, an openai_conversation_id and a creation time.Get New Message, add a Telegram credential with your bot token. Select the same credential in Send Message to User.Find User and Create User, add a Supabase credential with your project address and secret key.Create conversation and Ask OpenAI, add an OpenAI credential with your API key.Bot settings and rewrite the rules in instructions.telegram_users, and a second message continues the chat with no new row.Once the workflow is on, it answers by itself. Each message that someone sends to the bot starts a run, and one reply goes back. A person who writes for the first time adds one row to the table.
| To change | Where |
|---|---|
| The rules the bot follows | instructions in Bot settings |
| The model | model in Bot settings |
| The apology when there is no answer | The end of the expression in Pick the answer |
| A fresh start for one person | Delete their row in telegram_users |
| Who may use the bot | Restrict to User IDs in Get New Message |
A tutor runs a small English class on Telegram.
A student writes “Can we practise the past tense again?”. The workflow finds no row for her number, opens a conversation and saves its id. The bot answers with three short exercises. Two days later she writes “I finished the last ones”. The row is there now, so the bot continues the same conversation and knows which exercises she means. Check what the bot teaches before you rely on it, because the answers come from a model.
If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. Supabase is an online database, a bit like a spreadsheet that programs can read. This workflow keeps a list of who wrote to your bot and which conversation belongs to each person. Press Test workflow and write to the bot before you turn it on.
For experts. The memory lives at OpenAI, and the table only maps a chat number to a conversation id, so the workflow never stores the chat text itself.
| Node | What it does | What to know |
|---|---|---|
Find User | Looks up the chat number in telegram_users | Always Output Data is on, so a new person still reaches the If node |
If User exists | Sends a known person to Merge and a new one to Create conversation | It checks that id is text, so the id column is a uuid |
Create conversation | Opens a conversation with POST /v1/conversations | The answer holds its id |
Create User | Saves the number and the conversation id | Supabase returns the saved row |
Merge | Passes on the row that arrived | One input is always empty on a given run |
Ask OpenAI | Posts to /v1/responses with the text and the conversation id | The body is built with JSON.stringify, and OpenAI adds the earlier items of the conversation |
Pick the answer | Reads the text of the message item in output | It skips reasoning items and writes a short apology when there is no text |
The original copy ran on the Assistants API, which OpenAI has shut down, so this copy moves it to the Responses and Conversations API.
Bot settingsopenai_thread_id is now openai_conversation_id, and the table query is rewritten with a uuid idgpt-6-luna costs 0.10 US dollars per million input tokens and 0.50 per million output tokens.Get New Message limits it, and works on node version 1.2 and later, which this file usesAn n8n workflow that gives a Telegram bot a memory for each person. When someone writes to the bot for the first time, the
workflow opens an OpenAI conversation for them and saves its id in a Supabase table, next to their chat number. Every
later message continues the same conversation, so the bot remembers the chat after a restart or a new day.
workflow.json: the workflow as n8n exports it, ten nodes and five sticky notes. It holds no credential.README.md: these notes.Create conversation replaces the call that made a thread. Ask OpenAI replaces the three calls that sent the message,/v1/responses returns the answer, and the new nodePick the answer reads it.Bot settings, together with the model name, which is gpt-6-luna.openai_thread_id is now openai_conversation_id, and the table query is rewritten. The id columnIf User exists checks that id is text.Get New Message is now on node version 1.2, which can limit who may use the bot. See the first item under Good to know.workflow.json.create table public.telegram_users (
id uuid primary key default gen_random_uuid(),
telegram_id bigint not null unique,
openai_conversation_id text not null,
created_at timestamptz not null default now()
)
alter table public.telegram_users enable row level security. The table is then closed to the publicGet New Message, add a Telegram credential with your bot token. Select the same credential in Send Message to User.Find User and Create User, add a Supabase credential with the address of your project and its secret key.Create conversation and Ask OpenAI, add an OpenAI credential with your API key.Bot settings and rewrite the rules in instructions. You can also change the model there.telegram_users. Send a second message and the botGet New Message starts the run when someone sends a message to your bot.Find User looks for the person's chat number in telegram_users. It outputs an empty item when there is no row.If User exists sends a known person straight to Merge.Create conversation opens a conversation at OpenAI, and Create User saves its id with their chat number.Merge.Merge passes on whichever row arrived, with the conversation id in openai_conversation_id.Bot settings adds the model name and the rules.Ask OpenAI sends the message text with the conversation id. OpenAI adds the earlier items of that conversation to the input.Pick the answer takes the text of the model's reply. If there is none, it writes a short apology.Send Message to User sends it to the chat the message came from.Bot settings.Pick the answer.telegram_users. Their next message opens a new conversation.Get New Message, add the fieldgpt-6-luna costs 0.10 US dollars per million input tokens and 0.50 per million output tokens.instructions carry over inside a conversation, so this copy sends them with_ or * in an answer can make TelegramNOTICE.md 659 B README.md 6 KB workflow.json 11 KB
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Qwen · Kit
Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…
ACE-Step · Kit
Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…
alirezarezvani · Skill
Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…
block · Kit
Self-hostable workspace where people and AI agents share the same rooms, built on a Nostr relay that logs every action as a signed event. For teams that want t…
backnotprop · Kit
Opens your AI coding agent's plans, specs and code changes in a browser so you can annotate or comment on them and send the feedback straight back to the agent.