Bridgecore

Ready-made recipe · ai

Telegram → AI Agent → Telegram

An AI Agent answers each Telegram message, looking things up in Google Sheets when it needs to, and replies on Telegram.

Steps

  1. When when a telegram message comes in — Telegram node only reads
  2. Then answer it using google sheets as a tool — AI Agent node · may use: Google Sheets can be undone
  3. Then reply on telegram — Telegram node can’t be undone

Fields to fill (5)

The file has every node wired up. These are the blanks only you can fill (your form, your sheet, your words).

NodeWhat to do
Telegramfill chatId (Unique identifier for the target chat or username, To fin...)
Telegramfill text (Text of the message to be sent) — the AI step's output: run that node once in n8n and pick its output field
OpenAI Chat Modelcheck model: OpenAI Chat Model chosen by default (most used) — swap for Gemini, Anthropic, Ollama … if you like
OpenAI Chat Modelfill model (The model)
Google Sheets toolpick workflowId: a small workflow that does the Google Sheets part (Execute Workflow Trigger → the Google Sheets action(s) the agent may take); the node list we read (n8n 2.43.2) has no Google Sheets tool node to plug in directly

Accounts to connect (4)

In n8n, pick or add a credential on each node — one of the types below.

Need something slightly different? Same engine, your own words:

Get the n8n file

Download telegram-agent-answers-from-sheets.json

  1. Open a new, empty workflow in n8n.
  2. Open the workflow menu (⋯) and choose Import from File — or copy the JSON below and paste it onto the canvas (Ctrl/Cmd+V).
  3. Connect the accounts, fill the fields above, run one test, then turn the workflow on.
Or copy the JSON
{
  "name": "An AI Agent answers each Telegram message",
  "nodes": [
    {
      "id": "n1",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.5,
      "parameters": {
        "updates": [
          "message"
        ]
      },
      "position": [
        240,
        300
      ],
      "notes": "step: when a telegram message comes in · reversibility: read-only"
    },
    {
      "id": "n2",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "parameters": {
        "promptType": "define",
        "text": "=Answer it:\n\n{{ JSON.stringify($json) }}"
      },
      "position": [
        460,
        300
      ],
      "notes": "step: answer it using google sheets as a tool · reversibility: reversible"
    },
    {
      "id": "n3",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "parameters": {
        "resource": "message",
        "operation": "sendMessage",
        "chatId": "",
        "text": ""
      },
      "position": [
        680,
        300
      ],
      "notes": "step: reply on telegram · reversibility: irreversible"
    },
    {
      "id": "n4",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "position": [
        460,
        500
      ]
    },
    {
      "id": "n5",
      "name": "Google Sheets tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.2,
      "parameters": {
        "description": "Call this to use Google Sheets.",
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "position": [
        640,
        500
      ]
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}