💬 Telegram AI Assistant - n8n workflow
Transform your Telegram interactions with this intelligent AI-powered n8n workflow.
Telegram AI Assistant is an intelligent conversational bot that handles both text and voice messages from Telegram users. It provides natural voice-to-voice and text-to-voice conversations using advanced AI models for understanding, speech transcription, contextual memory, and text-to-speech synthesis, automating responses and providing information directly within your Telegram chats.
🚀 Key Features
- Seamless Telegram Integration: Receives text and voice messages directly within Telegram and sends back AI-generated responses.
- Accurate Voice Transcription: Utilizes OpenAI's Whisper model to convert spoken voice messages into text for processing.
- Advanced AI Understanding: Leverages Google's Gemini AI model to comprehend user queries and generate intelligent, context-aware responses.
- Persistent Conversation Memory: Maintains conversation history using a PostgreSQL database, enabling coherent and contextual dialogue over multiple interactions.
- Natural Voice Output: Employs ElevenLabs technology to convert the AI's text responses into natural-sounding speech, delivering voice replies.
- Versatile Interaction Modes: Supports full voice-to-voice conversations as well as text-based queries with voice or text responses.
💡 Use Cases
- Personal AI Assistants: Get quick answers, information, or assistance with tasks directly through Telegram using voice or text.
- Automated Customer Support: Deploy as a first-line support bot on Telegram to answer frequently asked questions.
- Interactive Learning Tools: Practice language skills or learn new topics through conversational interaction.
- Information Retrieval Bots: Quickly fetch and relay information from configured knowledge sources in response to user queries.
- Accessibility Solutions: Enable users to interact with AI capabilities using voice commands for easier access.
⚙️ Requirements
- n8n instance (cloud or self-hosted)
- Telegram Bot Token (Free)
- OpenAI API key (for Whisper voice transcription)
- Google AI API key (for the Google Gemini Chat Model)
- PostgreSQL database credentials (for conversation memory via Postgres Chat Memory node)
- ElevenLabs API key and Voice ID (for text-to-speech synthesis)
🔧 Easy Setup
The workflow is designed for straightforward implementation:
- Deploy n8n: Ensure you have a running n8n instance.
- Create Telegram Bot: Use @BotFather on Telegram to create a new bot and get its API token.
- Configure Credentials:
- Add your Telegram bot token to the "Telegram Trigger", "Telegram (File)", and "Telegram1 (Send)" nodes.
- Input your OpenAI API key into the "OpenAI" node for transcription.
- Set up your Google AI API key in the "Google Gemini Chat Model" node.
- Provide your PostgreSQL connection details to the "Postgres Chat Memory" node.
- Enter your ElevenLabs API key and chosen Voice ID in the "HTTP Request" node.
- Customize AI Behavior: Adjust the system prompt in the "AI Agent" node to define the assistant's personality and response style.
- Test Thoroughly: Send text and voice messages to your Telegram bot to ensure all components are working correctly.
💬 FAQ
Q: How does the Telegram AI Assistant understand voice messages?
A: It uses OpenAI's Whisper ASR (Automatic Speech Recognition) model, integrated via the OpenAI node, to accurately transcribe your spoken audio into text.
Q: What AI model powers the conversational responses?
A: The assistant's core conversational logic is powered by Google's Gemini AI model, accessed through the Google Gemini Chat Model node.
Q: How does the assistant remember previous parts of our conversation?
A: It utilizes the Postgres Chat Memory node to store and retrieve conversation history from a PostgreSQL database, enabling the AI Agent to maintain context.
Q: Can I change the AI's voice or its personality?
A: Yes. The voice can be changed by specifying a different Voice ID in the ElevenLabs HTTP Request node configuration. The AI's personality, tone, and specific instructions can be customized by modifying the system message prompt within the "AI Agent" node.
Q: How long does it take for the assistant to respond?
A: Response times typically range from a few seconds for text-based interactions to slightly longer for voice-to-voice interactions, depending on the length of the audio, transcription, AI processing, and speech synthesis times.
Q: What are the main components I need to configure?
A: You'll need to configure credentials for: Telegram (bot token), OpenAI (API key), Google Gemini (API key), PostgreSQL (database details), and ElevenLabs (API key and Voice ID).
📞 Support
Need assistance? Connect with me on X/Twitter @Victor_explore and send a DM for:
* Personalized setup assistance with this Telegram AI Assistant workflow.
* Custom n8n workflow development for your specific automation needs.
Enhance your Telegram experience with intelligent, voice-enabled conversations using the Telegram AI Assistant today!