← Back to selected work

02 / AI INTEGRATION

AI assistant for a Telegram bot

Anonymised case study · As of 7 October 2026

Deployed for allowlisted testers · User acceptance ongoing

The challenge

An existing community bot needed to answer free-form questions using a curated knowledge base, follow conversation context and apply defined boundaries for personal or sensitive topics.

Role
AI/backend development and integration architecture
Period
September 2026 – present

Implementation

I developed a separate AI service with RAG retrieval and integrated it into the Telegram bot. The solution was deployed on a VPS for a closed test group.

  • Request analysis and FAQ preparation; a FastAPI service with /ask, /health, Bearer authentication, request validation, rate limiting and anonymised logging.
  • Crawler and indexer for curated materials; RAG retrieval with access and topic filters, source checks and protected links.
  • Multi-turn conversations, repetition avoidance, detection of exhausted knowledge, waiting notices, protection against concurrent requests from one user and failure handling.
  • Deployment of separate bot and AI services on an Ubuntu VPS. Additional implementation of a Telegram menu with six job categories.

How the solution works

How the solution works The Python bot passes the question to FastAPI. The AI service retrieves relevant, accessible chunks from ChromaDB and uses OpenAI for the answer. The bot returns the response in the Telegram conversation. Telegram Python bot FastAPI ChromaDB + OpenAI
The Python bot passes the question to FastAPI. The AI service retrieves relevant, accessible chunks from ChromaDB and uses OpenAI for the answer. The bot returns the response in the Telegram conversation. Simplified view of the implemented components.

Confirmed result

20 out of 20 questions in a defined FAQ smoke-test set passed. Conversation continuation, topic-specific source links and selected refusal scenarios were verified.

The bot and AI assistant run as separate services; the health check returns “ok”. The deployed index contains 12 articles and one author note, totalling 67 chunks. The six-second waiting notice and refusal of personal legal questions were verified. The operator checked the six-category jobs menu on the deployed system. These tests do not establish a general accuracy rate.

Project status

Deployed for allowlisted testers · User acceptance ongoing

Next steps

Planned work includes user feedback, forwarding first answers to administrators, a cooldown after limits, persisted update IDs, answer caching, incremental index updates and final user acceptance.

Technologies & tools

  • Python 3.11+
  • Telegram Bot API
  • FastAPI
  • Uvicorn
  • OpenAI API / gpt-4o-mini / embeddings
  • ChromaDB
  • Google Sheets / Apps Script
  • REST API
  • systemd
  • Ubuntu VPS / Infomaniak
  • Git
  • rsync

Have a similar challenge?

Describe your situation and the next step you need help with.

Discuss a project