The problem

Most simple bots treat every message like the first one. That's fine for a single question, but it falls apart the moment someone's having an actual back-and-forth conversation. Context gets lost and the user ends up repeating themselves.

Why existing solutions weren't enough

Stateless bots can answer a question, but they can't hold a conversation. For anything that needed multi-turn context, that limitation showed up fast.

What I built

A Telegram chatbot connected to a PDF knowledge base, with per-user conversation memory so it remembers what was already discussed instead of resetting with every message. I later added a voice note feature so it can reply with actual spoken audio, not just text.

Architecture

Incoming message → user's conversation history retrieved → relevant sections of the PDF knowledge base pulled in → response generated with full context → optionally converted to speech → sent back on Telegram.

Tools used

n8n, PDF knowledge base, per-user memory storage, text-to-speech

Challenges

Managing memory per user without it bloating the context window or mixing up different users' conversations took real care in how the data was structured.

What I'd improve next

Let the memory expire or summarize after a while, so old conversations don't quietly pile up and slow things down.