AI Agents

Build a learning Telegram AI agent with memory and external tools

39 nodes 257 122 Automatic trigger
Download

Workflow Description

Automation that transforms Telegram into an intelligent agent platform powered by OpenAI, retains conversation context via Redis, and integrates with Twitter/X for enhanced interactions. The agent learns from user behavior and executes tailored actions with persistent memory across sessions.

How it works

  1. 1.Receive messages from Telegram and classify the request type
  2. 2.Process messages through OpenAI agent with Redis-backed conversation memory
  3. 3.Execute appropriate action: generate intelligent response, query Twitter, or invoke custom tools
  4. 4.Send generated response back to user through Telegram

Use cases

  • Create a conversational assistant that handles complex queries and recalls previous interactions
  • Enforce dynamic rules and agent behavior constraints based on user type or topic
  • Integrate Telegram with Twitter to search topics or publish updates directly from chat

Requirements

  • Telegram bot token and active bot account
  • OpenAI API key with sufficient quota
  • Redis instance for persistent context storage

Service Value

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

Apps Used

Telegram Redis OpenAI Memory Twitter/X AI Agent Tool

Details

Trigger Automatic trigger
Nodes 39
Apps 7
Views 257
Downloads 122

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

/

Human Handoff using Send and Wait

Set

#1

Set Interaction to Bot

Redis

#2

Set Interaction to Human

Redis

#3

Get Interaction State

Redis

#4

Model

OpenAI

#5

Memory

Memory Redis Chat

#6

Handoff Subworkflow

Execute Workflow Trigger

#7

Telegram Trigger

Set

#8

Send Response

Set

#9

Switch Interaction

Switch

#10

Information Extractor

Information Extractor

#11

OpenAI Chat Model

OpenAI

#12

With Defaults

Code

#13

Has All Criteria?

If

#14

Onboarding Agent

Agent

#15

Get Onboarding Chat History

Redis

#16

After Sales Agent

Agent

#17

Memory1

Memory Redis Chat

#18

Model1

OpenAI

#19

Handoff Tool

Tool Workflow

#20

Sticky Note

Sticky Note

#21

Sticky Note1

Sticky Note

#22

Sticky Note2

Sticky Note

#23

Handoff Subworkflow1

Execute Workflow

#24

Sticky Note3

Sticky Note

#25

Sticky Note4

Sticky Note

#26

Sticky Note5

Sticky Note

#27

Sticky Note6

Sticky Note

#28

Sticky Note7

Sticky Note

#29

Send Response2

Set

#30

Memory2

Memory Redis Chat

#31

Update Agent Memory

Memory Manager

#32

Send Response3

Set

#33

Get Canned Response

Set

#34

Notify user

Set

#35

Sticky Note8

Sticky Note

#36

Memory3

Memory Redis Chat

#37

Update Agent Memory1

Memory Manager

#38

Continue Conversation

Set

#39