Skip to main content
Character frontCharacter back
AI · Bot · May 2025

Juanda Bot: a Telegram AI assistant built with Python, n8n, Ollama and Groq

→ CONTEXT: Conversational support companion for the thesis platform (Universidad del Valle)

ROLE: Backend Developer · AI Engineer
TIMELINE: May 2025
STATUS: Live
FOR: Universidad del Valle · Companion to the thesis platform
STACK:
backend
  • Python
  • python-telegram-bot
  • Flask
  • Gunicorn
ai
  • Groq · Llama 3 70B
  • Ollama
  • OpenAI
  • RAG
automation
  • n8n
infra
  • Render
  • Telegram Bot API
FIG. 01 /start: what the bot can do, direct links into the platform and the command list

BLOCK // PROBLEM

Users needed a fast, Telegram-native way to navigate the AI platform, access the right modules, and resolve questions about the thesis without waiting for manual support.

BLOCK // SOLUTION

A Telegram assistant with two builds. The public one (repo linked below) is a Python bot on python-telegram-bot and Flask/Gunicorn, deployed on Render, that answers with Groq's Llama 3 70B and exposes commands for the oratory and critical-thinking modules, a usability survey and a QR code to the web app. A private iteration replaces the direct SDK call with n8n workflows: a RAG step retrieves context from the thesis documentation, Ollama runs inference locally first, and the flow falls back automatically to OpenAI and Groq.

BLOCK // CONSTRAINTS

  • Zero budget: free tiers only, for hosting and inference
  • Had to answer 24/7 for students, with nobody on call
  • Telegram as the only interface: commands and text, no rich UI

ENGINEERING IMPACT REPORT

A resilient, always-on Telegram assistant that eliminated wait times for platform support, providing users with instant contextual guidance through natural conversation.

85%
Students improved speaking confidence
92%
Participants with stronger debate coherence
95%
Positive usability feedback

Results measured on the thesis platform this bot supports, not on the bot itself.

ENGINEERING DECISIONS

DECISION_01

Groq's Llama 3 70B for the public build

Sub-second responses at no cost fit an academic bot that had to stay online for a whole semester.

Instead of: A paid, single-provider setup

DECISION_02

Flask and Gunicorn on Render as the always-on host

A public HTTPS endpoint that Telegram can reach, on a free tier, with no personal machine to keep awake.

Instead of: Running the bot from a local machine

DECISION_03

n8n workflows for the private build

The provider chain, the RAG step and the fallbacks live in a visual workflow that changes without redeploying code. Ollama runs first for privacy and cost; OpenAI and Groq only when it fails.

Instead of: Hard-coding the provider chain in the bot

FIELD NOTES & DEVELOPMENT HIGHLIGHTS

NOTE_01

Instant, contextual answers about the platform directly inside Telegram, 24/7, with no manual support queue: AI speeches by level, random debate topics, YouTube resources, Story-Dice and puzzle games

NOTE_02

Commands for each module (/oratoria, /pensamiento), personal progress reports (/oratoriametricas and /debatemetricas pull your last 10 speeches or debates by email), a usability survey and direct links into the web app

NOTE_03

Public build: python-telegram-bot + Flask on Render, answering with Groq Llama 3 70B for near-zero latency and cost

NOTE_04

Private build: n8n workflows with RAG over the thesis docs, Ollama as primary local inference and automatic fallbacks to OpenAI and Groq

LESSONS LEARNED

  • Fallbacks matter more than the primary model: the bot is judged on the answer it gives when the first provider is down.
  • Keeping inference behind a workflow made it possible to swap models in minutes as free tiers changed.