{
  "id": "q6efK3tLFrshFP2S",
  "name": "Automate Telegram Chat Responses Using Google Gemini",
  "tags": [],
  "nodes": [
    {
      "id": "33ef7486-add2-4217-839a-49d5de484c0a",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        860,
        160
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-1.5-pro"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cbb7c2ab-15fa-4ccb-8950-c7a82176ed12",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 1040,
        "height": 380,
        "content": "## Automate Telegram Chat Responses Using Google Gemini"
      },
      "typeVersion": 1
    },
    {
      "id": "c8d5f87a-a0d6-4db1-9d3e-8fb6590974c7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        320
      ],
      "parameters": {
        "color": 5,
        "width": 1040,
        "content": "## Description :\nThis n8n workflow is built by WeblineIndia's AI Team and it automates real-time chat responses in Telegram using Google's Gemini Chat Model. When a user sends a message on Telegram, the Google Gemini AI model processes it and generates a response, which is then sent back to the user via Telegram.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "138b1659-155e-4154-b875-683661be1837",
      "name": "Receive Telegram Message",
      "type": "n8n-nodes-base.telegramTrigger",
      "notes": "This node captures incoming messages from Telegram.",
      "position": [
        480,
        0
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "notesInFlow": true,
      "typeVersion": 1.1
    },
    {
      "id": "4b4fc565-981d-4cfe-b22b-6d9deb0df14a",
      "name": "Generate AI Response",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "notes": "This node processes the message using Google Gemini AI and generates a response.",
      "position": [
        740,
        0
      ],
      "parameters": {
        "text": "how can you help me?",
        "messages": {
          "messageValues": [
            {
              "message": "={{ $json.message.text }}"
            }
          ]
        },
        "promptType": "define"
      },
      "notesInFlow": true,
      "typeVersion": 1.5
    },
    {
      "id": "8b022acb-e9f6-499c-a71e-e1675899ff05",
      "name": "Send Telegram Reply",
      "type": "n8n-nodes-base.telegram",
      "notes": "This node sends the AI-generated response back to the user on Telegram.",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "chatId": "={{ $('Receive Telegram Message').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "41f949d4-e316-40eb-82bf-2398d96a440e",
  "connections": {
    "Generate AI Response": {
      "main": [
        [
          {
            "node": "Send Telegram Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate AI Response",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Receive Telegram Message": {
      "main": [
        [
          {
            "node": "Generate AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}