Connect Telegram with OpenAI
Workflow Description
An automation template connecting Telegram with an AI agent powered by OpenAI, enabling users to interact with advanced language models through instant messaging. The template maintains conversation context and manages memory for continuous dialogue flow.
How it works
- 1.Receive messages from Telegram via the trigger
- 2.Process the message and send it to the AI agent
- 3.Generate a response using OpenAI or Gemini
- 4.Manage conversation context and memory buffer
- 5.Send the response directly back to the user on Telegram
Use cases
- Build an intelligent chatbot that engages users on Telegram
- Deliver automated customer support with advanced language capabilities
Requirements
- Telegram integration with valid API credentials
- Active subscription to OpenAI or access to Google Gemini
- Configure the AI agent and response parameters
Service Value
Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (22)
AI Agent
Agent
Google Gemini Chat Model
Gemini Model
Recieve Telegram Message
Set
Check For Text or Voice Message
Set
Download Audio File
Set
Transcribe Audio File
OpenAI
If Voice Message
If
Code to remove unwanted characters from LLM response
Code
Code to split output into chunks under 4000 characters
Code
Respond to Telegram Message
Set
Wipe Conversation Memory
Memory Manager
Store Conversation Memory
Memory Buffer Window
Set prompt to start a new speech
Set
Set prompt to generate a speech based on the feedback
Set
Set prompt to provide feedback on speech
Set
Route Flow Based on Message Content
Switch
Sticky Note
Sticky Note
Sticky Note1
Sticky Note
Sticky Note2
Sticky Note
Sticky Note3
Sticky Note
Sticky Note4
Sticky Note
Sticky Note5
Sticky Note