⚡ Create a multi-model AI chatbot with Telegram, AIMLAPI, and Google Sheets

952 views · ⚡ Personal Productivity

Description

📲 AI Multi-Model Telegram Chatbot (n8n + AIMLAPI)

This n8n workflow enables Telegram users to interact with multiple AI models dynamically using #model_id commands. It also supports a /models command to list all available models. Each user has a daily usage limit, tracked via Google Sheets.


🚀 Key Features


🛠 Setup Guide

1. 📲 Create a Telegram Bot

2. 🔐 Add Telegram Credentials to n8n

3. 📗 Google Sheets Setup

4. 🔌 Connect AIMLAPI

5. ⚙️ Customize Limits & Enhancements


💡 How It Works

➡️ Command Examples:

  1. Start a chat with a specific model:
    #openai/gpt-4o Write a motivational quote.
  2. Request available models list:
    /models

➡️ Workflow Logic:

  1. Receives a Telegram message.

  2. Switch node checks if the message is /models or a prompt.

  3. For /models, it fetches and sends a grouped list of models.

  4. For prompts:

    • Checks usage limits.
    • Parses #model_id and prompt text.
    • Dynamically routes the request to the chosen model.
    • Sends the AI’s response back to the user.
    • Logs the query & result to Google Sheets.
  5. If daily limit exceeded → sends a limit exceeded message.


🧪 Testing & Debugging Tips

🔗 Nodes Used

Google Sheets, HTTP Request, Telegram, Telegram Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup