- AI
- A
How to connect Telegram Business to OpenClaw and create "long-term memory" on a vector database
After the initial setup of the Telegram Business Bot in OpenClaw, everyone usually enjoys the basic scenario: evening summary of personal conversations.
It works well and is convenient, but soon the next question arises:
What if we need not only yesterday's report, but an analysis of conversations for a month or a year?
Below, I will show how I assembled this: Telegram Business Bot + OpenClaw + memU + local vector database.
Mini-guide: how to give OpenClaw access to messages on the main account
The most basic use case is to receive an evening summary of all personal chats you've interacted with throughout the day.
Create a bot through
@BotFather, and get the token. In Bot Settings, enable Business Mode.
Next, go to the regular Telegram settings: Telegram Business → ChatBots. Add our bot and configure the permissions.
Telegram Premium is required.
Done.
Now send the API key of the business bot to your OpenClaw and say:
“I want to receive summaries of all my dialogues every evening.”
An important nuance: the bot will only see messages that you have received or sent after connecting the business bot.
Why the usual MEMORY.md becomes insufficient over time
I have already explained how to set up a Business bot in Telegram for OpenClaw, which will have access to your account's conversations.
But if we find the usual report on yesterday's dialogues insufficient and we want an analysis over a month or even a year, we need a different memory:
not only the built-in .md memory,
but a vector database with embedding search.
What is vector memory - in simple terms
Imagine a regular database as a huge list.
When you search for “advertising,” it looks specifically for the word “advertising.”
You wrote “promotion” - it won't find it.
A vector database works differently.
Each message is transformed into a set of numbers (vector) that reflects the meaning of the text, rather than the words themselves.
This is called embedding — the semantic imprint of a phrase.
The result:
You write “what did we agree on with the client regarding payment?” — and the bot finds the necessary conversations, even if none of those words were present.
What I assembled
A combination of three tools:
OpenClaw — an AI agent that performs tasks
memU — a library for working with vector memory
Telegram Business Bot — the source of conversations
Every 6 hours, a CRON job automatically retrieves new messages from all chats and saves them to a local vector database.
The data goes nowhere — everything is stored on your machine.
How to replicate
Send this message to your agent in OpenClaw, replacing the variables in brackets:
[TG_BOT_TOKEN] — this is the API key for my business bot in Telegram. With it, you can see my dialogues. Check if everything works and if you receive messages. Save the token so that when the context is reset, you can use it and understand its purpose.
Next, study this repository thoroughly along with the source code; you can clone it: https://github.com/NevaMind-AI/memU
I want to set this up so that you run a CRON job every 6 hours that retrieves all new messages and saves them in memU for further processing.
All documentation for OpenClaw: https://docs.openclaw.ai
Implementation parameters:
- Vector database (PostgreSQL + pgvector)
- LLM embedding via OpenAI API, key: [OPENAI_API_KEY]
- Saves all chats, both sides of the dialogue
- Backfill is not needed
- Brief report after each run
- Database is stored completely locally, without external access
Before starting the implementation, ask clarifying questions if you have any.
The agent will only ask you to install dependencies and initialize the database.
What you can ask the bot after a week of operation
🔍 Analytics
Make a summary for the week: who wrote, what topics, where there were agreements
Find all dialogues where advertising or budgets were discussed — compare the conclusions
✈️ For a specific contact
From the correspondence with @username: what was discussed, what are the next steps?
Create a profile for the contact @username: communication style, interests, what works best
⚡️ Preparing for a dialogue
Prepare me for a conversation with @username: context, important points, what to propose first
What decisions have I already made on [topic] to avoid repetition?
🔑 Control and risks
Who have I not replied to for a long time — is there a risk of losing contact?
Gather recurring client objections and suggest response templates
Conclusion
Telegram Business provides access to new messages,
OpenClaw automates collection and processing,
memU + pgvector add long-term semantic memory.
In the output, you get not just "what happened yesterday," but a working layer of knowledge about your dialogues that really helps in communication and sales.
More OpenClaw use cases in our community https://t.me/openclaw_lab
We will also help you understand OpenClaw and answer all your questions in the chat https://t.me/openclaw_lab_community
Good luck with your research!
Write comment