Multilingual-Agentic-Chatbot

I had so much fun building my first workflow on n8n - the powerful low code automation tool. Spent a few hours learning self-hosting n8n by leveraging Docker and Docker Compose to containerize the application.
The decision to self-host n8n using a tool like Docker versus using the n8n Cloud is a trade-off between control and convenience. Besides lower long-term cost than cloud model, self hosting offers full customisation and complete control over our data. All sensitive workflow data, API keys, and credentials remain on your private infrastructure.

Multilingual Agentic Chatbot

This n8n workflow, titled “Multilingual Chat Agent,” functions as an intelligent, multi-modal Telegram chatbot capable of handling both text and voice messages.

Telegram Trigger: The workflow starts here, activating upon receiving any new Updates: message from Telegram.

Switch (mode: Rules): This node acts as the traffic controller, checking if the incoming message is a voice message or a plain text message, and routes the flow accordingly.

Get a file (git: file) & Transcribe a recording: For incoming voice messages, the flow is routed through the Get a file node to download the audio, which is then passed to the Transcribe a recording node to convert the speech into text.

AI Agent 🤖(Google Gemini Chat Model): The heart of the workflow. The transcribed text (or the original text message) is fed into the AI Agent, which utilizes the Google Gemini Chat Model for generating responses. It’s equipped with several essential tools:

Simple Memory: To maintain conversation context.

Date & Time: To answer questions about the current time or date.

Calculator: To handle mathematical operations.

OpenWeatherMap & SerpAPI (Current Weather): To answer questions requiring real-time external data, such as weather conditions and up-to-date search results.

Send a text message: Finally, the AI Agent’s response is passed to the last node, which uses the Send a text message node to instantly relay the final, context-aware answer back to the user on Telegram.

Here is a video demo of the chatbot in action!

Image