AI Agents

Process Telegram messages with multi-session AI conversations

38 nodes 291 148 Automatic trigger
Download

Workflow Description

Automation that receives messages from multiple Telegram channels, maintains conversation context per session, and sends intelligent replies using OpenAI models while recording data in Google Sheets.

How it works

  1. 1.Receive incoming messages from connected Telegram channels via trigger
  2. 2.Maintain separate memory buffer for each conversation session
  3. 3.Process message through AI agent using OpenAI language model
  4. 4.Route response based on message analysis (reply, store, or execute action)
  5. 5.Log conversation and results automatically to Google Sheets

Use cases

  • Multi-channel customer support bot handling concurrent inquiries across Telegram channels
  • Smart chatbot that remembers conversation history and delivers personalized responses
  • Automated data collection from Telegram conversations for analysis and organization

Requirements

  • Active OpenAI account with valid API key
  • Telegram bot or channel configured for receiving messages
  • Google Sheets spreadsheet for logging conversation data

Service Value

Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.

Apps Used

OpenAI Memory Telegram Google Sheets LLM Chain AI Agent

Details

Trigger Automatic trigger
Nodes 38
Apps 6
Views 291
Downloads 148

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 (38)

/

OpenAI Chat Model

OpenAI

#1

Simple Memory

Memory Buffer Window

#2

Get message

Set

#3

Command or text?

Switch

#4

Get session

Google Sheets

#5

Disable previous session

Google Sheets

#6

Set new session

Google Sheets

#7

Session activated

Set

#8

Send response

Set

#9

Update database

Google Sheets

#10

Sticky Note

Sticky Note

#11

Summarization Chain

Chain Summarization

#12

OpenAI Chat Model1

OpenAI

#13

OpenAI Chat Model2

OpenAI

#14

Basic LLM Chain

LLM Chain

#15

Get message1

Set

#16

Set to expire

Google Sheets

#17

Exist?

If

#18

OK

Set

#19

KO

Set

#20

Trim resume

Code

#21

Get session1

Google Sheets

#22

Prompt + Resume

Code

#23

Send summary

Set

#24

Get message2

Set

#25

Trim question

Code

#26

Set new current session

Google Sheets

#27

Response + Text

Google Sheets

#28

fullText

Code

#29

Send answer

Set

#30

Send current session

Set

#31

Sticky Note1

Sticky Note

#32

Sticky Note2

Sticky Note

#33

Sticky Note3

Sticky Note

#34

Sticky Note4

Sticky Note

#35

Sticky Note5

Sticky Note

#36

Sticky Note6

Sticky Note

#37

Telegram Chatbot

Agent

#38