AI-Powered Telegram Trivia Bot with Auto Question Generation & User Management — Flujo de trabajo n8n

Alta complejidad Disparador31 nodos🏷️ Miscellaneous👁 2,658 vistaspor Luka Zivkovic

Descripción general

Complete Telegram Trivia Bot with AI Question Generation

Build a fully-featured Telegram trivia bot that automatically generates fresh questions daily using OpenAI and tracks user progress with NocoDB. Perfect for communities, education, or entertainment!

Get Started with n8n now!

✨ Key Features

🤖 AI Question Generation: Automatically creates 40+ new trivia questions daily across 8 categories 📊 Smart User Management: Tracks scores, prevents question repeats, maintains leaderboards 🎮 Game Mec

Nodos utilizados

TelegramNocoDBCodeOpenAI

Vista previa del flujo de trabajo

📊 NocoDB Database Setup Required
Table 1: Users
- `Id` - Auto Number (Primary Key)
- `telegram_id` - Number (Unique)
- `username` - Single Line Text
- `first_name` - Single Line Text
🤖 AI Question Generation System
Purpose: Automatically generates fresh trivia questions
Schedule: Runs once per day
Output: 5 questions per category (8 categories = 40 que
📨 Message Processing Pipeline
Step 1: Telegram webhook receives message
Step 2: Parse user data and message content
Step 3: Check if user exists in database
Step 4: Create new
🎮 Smart Question System
Features:
✅ No Repeats: Users never see correctly answered questi
✅ History Tracking: Every answer is logged
✅ Dynamic Selection: Always fresh
📊 Leaderboard System
Features:
- Top 10 players by score
- Shows current user's position
- Real-time ranking updates
- Emoji medals for top 3
✅ Answer Processing Engine
Input Validation:
- Only accepts A, B, C, D answers
- Must be in "waiting_answer" state
- Case-insensitive processing
Scoring System:
🔄 Game State Management
States:
- `idle` - Ready for new question
- `waiting_answer` - Question active, awaiting response
Tracking:
- Current question ID
📤 Response System
Features:
- Markdown formatting for rich messages
- Emoji integration for visual appeal
- Consistent message structure
- Error handling and fallbacks
🎲 Question History Tracking
Purpose: Ensures users never see the same correctly ans
Process:
1. Get user's answer history
2. Collect all correctly answered questio
🔄 Data Flow Summary
Input: Telegram message
Processing:
1. Parse & validate user
2. Route command or answer
3. Process business logic
tool
T
Telegram Trigger
Parse Telegram Data
Check Existing User
U
User Exists?
Create New User
Merge User Data
I
Is Command?
C
Command Router
Handle Basic Commands
Format Question
Update User Game State
Get Leaderboard
Format Leaderboard
V
Valid Answer?
Get Current Question
Process Answer
Update User Stats
Handle Unknown Text
Telegram
M
Merge
OpenAI
N
NocoDB
D
Daily Question Generator
Get Possible Categories
Send New Questions Avail…
M
Merge1
A
Aggregate
Get User History
Mark Question As Answered
A
Aggregate1
Get Random Question
31 nodes39 edges

Cómo funciona

  1. 1

    Disparador

    El flujo de trabajo comienza con un disparador disparador.

  2. 2

    Procesamiento

    Los datos fluyen a través de 31 nodos, connecting aggregate, code, if.

  3. 3

    Salida

    El flujo de trabajo completa su automatización y entrega el resultado al destino configurado.

Detalles de nodos (31)

TE

Telegram

telegram

#1
NO

NocoDB

nocoDb

#2
CO

Code

code

#3
OP

OpenAI

n8n-nodes-langchain.openAi

#4

Cómo importar este flujo de trabajo

  1. 1Haz clic en el botón Descargar JSON a la derecha para guardar el archivo del flujo de trabajo.
  2. 2Abre tu instancia de n8n. Ve a Flujos de trabajo → Nuevo → Importar desde archivo.
  3. 3Selecciona el archivo ai-powered-telegram-trivia-bot-with-auto-question-generation-user-management descargado y haz clic en Importar.
  4. 4Configura las credenciales para cada nodo de servicio (claves API, OAuth, etc.).
  5. 5Haz clic en Probar flujo de trabajo para verificar que todo funcione, luego actívalo.

O pega directamente en n8n → Importar desde JSON:

{ "name": "AI-Powered Telegram Trivia Bot with Auto Question Generation & User Management", "nodes": [...], ...}

Integraciones

aggregatecodeifmergenocodbnocodbtoolopenaischeduletriggerswitchtelegramtelegramtrigger

Obtener este flujo de trabajo

Descarga e importa con un solo clic

Descargar JSONVer en n8n.io
Nodos31
Complejidadhigh
Disparadortrigger
Vistas2,658
CategoríaMiscellaneous

Creado por

Luka Zivkovic

Luka Zivkovic

@zivkovic58

Etiquetas

aggregatecodeifmergenocodbnocodbtoolopenaischeduletriggerswitchtelegram

¿Nuevo en n8n?

n8n es una herramienta de automatización de flujos de trabajo gratuita y de código abierto. Alójala tú mismo o usa la versión en la nube.

Obtener n8n gratis →

Related Miscellaneous Workflows