Skip to main content

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

Workflow preview

Workflow preview
100%
Create a multi-model AI chatbot with Telegram, AIMLAPI, and Google Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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 comm...

Best for

  • Personal Productivity automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.telegramtrigger, n8n-nodes-base.googlesheets, n8n-nodes-base.aggregate, n8n-nodes-base.set, n8n-nodes-base.if, n8n-nodes-base.telegram, n8n-nodes-base.stickynote, n8n-nodes-base.httprequest

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by AI/ML API | D1m7asis.

Original n8n.io source

1.1 Workflow description

Title
Create a multi-model AI chatbot with Telegram, AIMLAPI, and Google Sheets
Workflow name
Create a multi-model AI chatbot with Telegram, AIMLAPI, and Google Sheets

πŸ“² 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

  • Dynamic Model Selection: Users choose models on-the-fly via #model_id (e.g., #openai/gpt-4o).
  • /models Command: Lists all available models grouped by provider.
  • Daily Limit Per User: Enforced using Google Sheets.
  • Prompt Parsing: Extracts model and message from user input.
  • Logging: Logs every request & result into Google Sheets for usage tracking.
  • Seamless Telegram Delivery: Responses are sent directly back to the chat.

πŸ›  Setup Guide

1. πŸ“² Create a Telegram Bot

  • Go to @BotFather
  • Use /newbot β†’ Set name & username.
  • Copy the generated API token.

2. πŸ” Add Telegram Credentials to n8n

  • Go to n8n > Credentials > Telegram API.
  • Create a new credential with the BotFather token.

3. πŸ“— Google Sheets Setup

  • Create a Google Sheet named Sheet1.
  • Add columns:
    user_id | date | query | result
    
  • Share the sheet with your Service Account or OAuth Email (depending on auth method).

4. πŸ”Œ Connect AIMLAPI

  • Get your API key from AIMLAPI.
  • In n8n > Credentials, add AI/ML API:
    • API Key: your_key_here.

5. βš™οΈ Customize Limits & Enhancements

  • Adjust daily limits in the Set Daily Limit node.
  • Optional:
    • Add NSFW content filtering.
    • Implement alias commands.
    • Extend with /help, /usage, /history.
    • Add inline button UX (advanced).

πŸ’‘ 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

  • Test via a separate Telegram chat.
  • Use Console/Set nodes to debug payloads.
  • Always test commands by messaging the bot (not via "Execute Node").
  • Validate cases:
    • Missing #model_id.
    • Invalid model_id.
    • Limit exceeded handling.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - πŸ“© Receive Telegram Message

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.2

Block 2 - πŸ“Š Fetch Usage Logs

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 3 - πŸ“ˆ Count Today’s Requests

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 4 - πŸ”’ Set Daily Limit

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 5 - 🚦 Check Limit Exceeded?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 6 - 🚫 Notify: Limit Exceeded

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note10

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note11

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Send a chat action

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 15 - Get Models List

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 16 - Send a text message

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 17 - Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 18 - Send a text message1

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 19 - πŸ“ Log Successful Generation1

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 20 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Get Models Or Process Message?

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 22 - 🧠 Generate Msg (AI/ML API | GPT-4o)

Type / Role
n8n-nodes-aimlapi.aimlApi - aimlApi
Config choices
Version 1

Block 23 - 🧠 Generate Msg (AI/ML API | Custom Model)

Type / Role
n8n-nodes-aimlapi.aimlApi - aimlApi
Config choices
Version 1

Block 24 - Group Models By Providers

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Showing the first 24 of 25 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Create a multi-model AI chatbot with Telegram, AIMLAPI, and Google Sheets
Complexity advanced
Nodes 25
Categories Personal Productivity, AI Chatbot
Author AI/ML API | D1m7asis
Published 06 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7045/7045.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Create a multi-model AI chatbot with Telegram, AIMLAPI, and Google Sheets do?

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 comm...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Personal Productivity, AI Chatbot use case.