AI Agents

Telegram with multiple sessions

38 nodes 203 116 Automatic trigger
Download

Workflow Description

A multi-session intelligent agent automation that receives Telegram messages and processes them using OpenAI's model while maintaining conversation history in Google Sheets, enabling users to interact with AI in an integrated and fully documented manner.

How it works

  1. 1.Receive messages from Telegram through a dedicated trigger
  2. 2.Process messages using an OpenAI agent while preserving session context
  3. 3.Store conversations and responses in Google Sheets for review and analysis

Use cases

  • Operate automated customer support services on Telegram
  • Build an intelligent assistant handling multiple users with conversation history
  • Document AI interactions for analytical and training purposes

Requirements

  • Active OpenAI account with valid API key
  • Telegram bot token obtained from BotFather
  • Connected Google Sheets spreadsheet in n8n

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 203
Downloads 116

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