AutomationFlowsAI & RAG › Send Ai-generated Emails via Telegram Using Gpt-4o-mini and Gmail

Send Ai-generated Emails via Telegram Using Gpt-4o-mini and Gmail

ByAutomate With Marc @marconi on n8n.io

✉️ Telegram Email Agent with GPT + Gmail Category: Messaging / AI Agent Level: Beginner-Friendly Tags: Telegram, Email Automation, AI Agent, Gmail, GPT Model

Event trigger★★★☆☆ complexityAI-powered10 nodesTelegram TriggerAgentOpenAI ChatMemory Buffer WindowGmail ToolTelegram
AI & RAG Trigger: Event Nodes: 10 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #4265 — we link there as the canonical source.

This workflow follows the Agent → Gmail Tool recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Telegram Email Agent Workflow",
  "tags": [],
  "nodes": [
    {
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -80,
        0
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        220,
        0
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        180,
        160
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        320,
        160
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.chat.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "name": "Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        460,
        160
      ],
      "parameters": {
        "sendTo": "={{  $fromAI('To', ``, 'string') }}",
        "message": "={{  $fromAI('Message', ``, 'string') }}",
        "options": {},
        "subject": "={{  $fromAI('Subject', ``, 'string') }}",
        "emailType": "text"
      },
      "typeVersion": 2.1
    },
    {
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        680,
        0
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -80
      ],
      "parameters": {
        "color": 3,
        "width": 260,
        "height": 380,
        "content": "Telegram Message Received Trigger Node"
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        -80
      ],
      "parameters": {
        "width": 460,
        "height": 380,
        "content": "AI Agent with Email Tool"
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 300,
        "height": 380,
        "content": "Telegram Send Message Action Node"
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -180
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 480,
        "content": "This is a simple workflow for an Email Agent connected to Telegram on message trigger.\n\n- Gmail is connected as an Email Sendng Tool\n- Telegram send message output is enabled to allow AI Agent to interact with user\n\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

✉️ Telegram Email Agent with GPT + Gmail Category: Messaging / AI Agent Level: Beginner-Friendly Tags: Telegram, Email Automation, AI Agent, Gmail, GPT Model

Source: https://n8n.io/workflows/4265/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow turns a Telegram bot into a simple Notion To-Do assistant.

Google Calendar Tool, Memory Buffer Window, Gmail Tool +6
AI & RAG

telegramAssistant. Uses telegramTrigger, agent, lmChatOpenAi, memoryBufferWindow. Event-driven trigger; 17 nodes.

Telegram Trigger, Agent, OpenAI Chat +7
AI & RAG

Jarwis. Uses telegramTrigger, agent, lmChatOpenAi, memoryBufferWindow. Event-driven trigger; 17 nodes.

Telegram Trigger, Agent, OpenAI Chat +7
AI & RAG

Telegram Gmailtool. Uses googleCalendarTool, memoryBufferWindow, gmailTool, lmChatOpenAi. Event-driven trigger; 15 nodes.

Google Calendar Tool, Memory Buffer Window, Gmail Tool +6
AI & RAG

Telegram Gmailtool. Uses googleCalendarTool, memoryBufferWindow, gmailTool, lmChatOpenAi. Event-driven trigger; 15 nodes.

Google Calendar Tool, Memory Buffer Window, Gmail Tool +6