πŸ“˜ Automating Access to Internal Knowledge and Business Processes Using RAG and a Telegram Bot

Posted on 2024-06-01

🧩 1. Why This Matters: The Problem We Solved

Growing companies with extensive internal documentation often face a common challenge: employees spend too much time searching for information or asking repetitive questions. This reduces productivity and increases the load on support teams.

Typical scenarios:

  • A new employee can’t find the contract template;
  • A manager forgets how to issue an invoice;
  • A developer is unsure who should review their code.

πŸ› οΈ 2. Solution Architecture Overview

Before diving into the details, here's an overview of our architecture, which includes:

  • RAG (Retrieval-Augmented Generation) β€” a hybrid AI approach combining retrieval and generation;
  • Vector storage β€” for semantically meaningful document retrieval;
  • Telegram bot β€” as the user interface for employees;
  • Redmine API β€” to automate task management and time tracking;
  • GitLab β€” as the living documentation source.

πŸ“Œ RAG Explained (Haystack)

Architecture Diagram


🧠 3. Preparing the Knowledge Base and Vectorization

The company’s internal knowledge was stored as .md files in GitLab. We:

  • Automated document extraction;
  • Cleaned and preprocessed the content;
  • Vectorized the content using sentence-transformers (Learn more);
  • Indexed the content in Elasticsearch.

πŸ“Œ Vector Databases Overview


πŸ€– 4. Telegram Bot β€” Employee Interface

Employees interact with the bot by asking questions directly in chats:

  • "How do I log time for Project Alpha?"
  • "Which NDA template should I use?"

If the bot is unsure of the answer, it forwards the question to a support channel.


πŸ” 5. Self-Learning and Answer Quality Management

Every unanswered question signals a documentation gap.

  • We log "unanswered" queries;
  • Manually review and tag them;
  • Create or update documents;
  • Re-index the knowledge base.

πŸ“Œ RAG Quality Evaluation – OpenAI Cookbook


🧱 6. Redmine Integration

With Redmine API integration, employees can:

  • View their assigned tasks;
  • Log time directly via the bot;
  • Generate invoices;
  • Initiate contract preparation.

πŸ“Œ Redmine API Docs


πŸ’¬ 7. Example Queries

Examples:

πŸ§‘: How do I issue an invoice for March?
πŸ€–: Here's the instruction: [link]
πŸ§‘: Who should review my pull request?
πŸ€–: Your team lead or a senior developer. More info: [link]

πŸ“ˆ 8. Outcomes and Scalability

Results:

  • Reduced support load;
  • Faster onboarding for new employees;
  • Routine processes automated.

Scalability options:

  • Integration with Slack, MS Teams;
  • Multi-language support;
  • Integration with other APIs (CRM, ERP, etc.).

🀝 Want Similar Results?

If you'd like to automate your internal knowledge access and streamline business processes, get in touch with us. Let's build it together.


πŸ“Ž Useful Links