# Create a multi-model AI chatbot with Telegram and AIMLAPI: n8n workflow

> Started by an incoming Telegram message, and works across Google Sheets and Telegram. 17 steps, 3 branches: a working afternoon to understand properly.

Source: https://millionrounds.com/workflow/create-a-multi-model-ai-chatbot-with-telegram-and-aimlapi (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Alerts and monitoring](https://millionrounds.com/workflows?category=Alerts+and+monitoring#library)

# Create a multi-model AI chatbot with Telegram and AIMLAPI

Started by an incoming Telegram message, and works across Google Sheets and Telegram. 17 steps, 3 branches: a working afternoon to understand properly.

Medium

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcreate-a-multi-model-ai-chatbot-with-telegram-and-aimlapi)

**17 steps** Medium: a working afternoon

**3** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 1 Logic 7 Service 9

The steps in the order they run, from what starts it.

- 1 **📩 Receive Telegram Message** Telegram trigger *Starts it*
- 2 **Get Models Or Process Message?** Switch *Logic*
- 3 **Get Models List** Http Request *Service*
- 4 **📊 Fetch Usage Logs** Google Sheets *Service*
- 5 **Code** Code *Logic*
- 6 **📈 Count Today’s Requests** Aggregate *Logic*
- 7 **Send a text message** Telegram *Service*
- 8 **🔢 Set Daily Limit** Set *Logic*
- 9 **🚦 Check Limit Exceeded?** If *Logic*
- 10 **Send a chat action** Telegram *Service*
- 11 **🚫 Notify: Limit Exceeded** Telegram *Service*
- 12 **Set Custom Model?** If *Logic*
- 13 **Group Models By Providers** Code *Logic*
- 14 **🧠 Generate Msg (AI/ML API | GPT-4o)** Aiml Api *Service*
- 15 **🧠 Generate Msg (AI/ML API | Custom Model)** Aiml Api *Service*
- 16 **Send a text message1** Telegram *Service*
- 17 **📝 Log Successful Generation1** Google Sheets *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 17, with 3 branches
- **Size:** Medium: a working afternoon
- **Connects to:** Google Sheets, Telegram
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account, plus your own Google Sheets and Telegram accounts. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming Telegram message.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Plan an afternoon. 17 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 17 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcreate-a-multi-model-ai-chatbot-with-telegram-and-aimlapi)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

Also alerts and monitoring, with the same services where possible, closest in size first.

- [**Auto-download Reddit memes to Google Drive with Telegram** 17 steps · Google Drive, Reddit](https://millionrounds.com/workflow/auto-download-reddit-memes-to-google-drive-with-telegram)
- [**Automate Birthday Wishes from Google Contacts with Telegram** 17 steps · Telegram](https://millionrounds.com/workflow/automate-birthday-wishes-from-google-contacts-with-telegram)
- [**Automatic backup of workflows to GitHub with Gmail** 17 steps · Gmail, Telegram](https://millionrounds.com/workflow/automatic-backup-of-workflows-to-github-with-gmail)
- [**BlueOps Auto CVE & IOC feed ingestor with Google Sheets** 17 steps · Email, Google Sheets](https://millionrounds.com/workflow/blueops-auto-cve-and-ioc-feed-ingestor-with-google-sheets)
- [**Capture vendor status updates with Google Sheets** 17 steps · Email, Google Sheets](https://millionrounds.com/workflow/capture-vendor-status-updates-with-google-sheets)
- [**Food menu update notifier with Google Sheets** 17 steps · Email, Google Sheets](https://millionrounds.com/workflow/food-menu-update-notifier-with-google-sheets)
