AI Agents

Connect Telegram with OpenAI

22 nodes 211 131 Automatic trigger
Download

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. 1.Receive messages from Telegram via the trigger
  2. 2.Process the message and send it to the AI agent
  3. 3.Generate a response using OpenAI or Gemini
  4. 4.Manage conversation context and memory buffer
  5. 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

AI Agent Gemini Telegram OpenAI Memory

Details

Trigger Automatic trigger
Nodes 22
Apps 5
Views 211
Downloads 131

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (22)

/

AI Agent

Agent

#1

Google Gemini Chat Model

Gemini Model

#2

Recieve Telegram Message

Set

#3

Check For Text or Voice Message

Set

#4

Download Audio File

Set

#5

Transcribe Audio File

OpenAI

#6

If Voice Message

If

#7

Code to remove unwanted characters from LLM response

Code

#8

Code to split output into chunks under 4000 characters

Code

#9

Respond to Telegram Message

Set

#10

Wipe Conversation Memory

Memory Manager

#11

Store Conversation Memory

Memory Buffer Window

#12

Set prompt to start a new speech

Set

#13

Set prompt to generate a speech based on the feedback

Set

#14

Set prompt to provide feedback on speech

Set

#15

Route Flow Based on Message Content

Switch

#16

Sticky Note

Sticky Note

#17

Sticky Note1

Sticky Note

#18

Sticky Note2

Sticky Note

#19

Sticky Note3

Sticky Note

#20

Sticky Note4

Sticky Note

#21

Sticky Note5

Sticky Note

#22