Construire un chatbot Telegram intégrant Gemini Pro AI et Google Docs

Intermédiaire

Ceci est unSupport Chatbot, AI Chatbot, Multimodal AIworkflow d'automatisation du domainecontenant 9 nœuds.Utilise principalement des nœuds comme Wait, Telegram, GoogleDocsTool, SplitInBatches, HttpRequestTool. Construire un chatbot Telegram intégrant le Pro AI Gemini et Google Docs

Prérequis
  • Token Bot Telegram
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "cb9a1e5321767b6316634728341237e564b2587ab15b74ca0a89eb02a53484d6",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
      "name": "Message à un modèle",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        4800,
        1232
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-pro",
          "cachedResultName": "models/gemini-2.5-pro"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "Replay test write user-friendly."
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fbd4e562-fb5a-4e85-9814-75e4a9df2900",
      "name": "Envoyer un message texte",
      "type": "n8n-nodes-base.telegram",
      "position": [
        5216,
        1232
      ],
      "webhookId": "3111e55e-41d3-4e3b-863c-bfda700bba92",
      "parameters": {
        "text": "={{ $json.content.parts[0].text }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "replyMarkup": "replyKeyboard",
        "additionalFields": {},
        "replyKeyboardOptions": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "98b5b120-ab55-47b2-8f0d-0bc29b32bb7f",
      "name": "Obtenir un document dans Google Docs",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        5184,
        1488
      ],
      "parameters": {
        "simple": false,
        "operation": "get",
        "documentURL": "https://docs.google.com/document/d/19vaCViYaFkjFM6azAMf6fH6tDL2cwSsjTE5vX3eK6Ss"
      },
      "typeVersion": 2
    },
    {
      "id": "c3df74b4-6077-4383-9c23-2f7505cea1fe",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        4224,
        1216
      ],
      "webhookId": "05fcff6f-5e32-4599-9b29-c585878352d8",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "41eee1be-dfb9-4e7d-b659-a9de0e740e7a",
      "name": "Attendre 1s",
      "type": "n8n-nodes-base.wait",
      "position": [
        5488,
        1232
      ],
      "webhookId": "8223d68f-b3b2-4c42-a6d2-473a19e2904c",
      "parameters": {
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "3dc90867-9946-4143-aeb9-a096993486c5",
      "name": "Message à un modèle dans Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.googleGeminiTool",
      "position": [
        4992,
        1488
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.0-flash-exp",
          "cachedResultName": "models/gemini-2.0-flash-exp"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "Replay test write user-friendly."
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0049c3fc-f6a2-420f-b0ca-c7330021a405",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        4768,
        1488
      ],
      "parameters": {
        "url": "https://devcodejourney.com/",
        "options": {},
        "toolDescription": "Replay test write user-friendly."
      },
      "typeVersion": 4.2
    },
    {
      "id": "162fb82a-9ced-401a-a67e-6c4d3b84d118",
      "name": "Note autocollante",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2544,
        1184
      ],
      "parameters": {
        "width": 1552,
        "height": 2352,
        "content": "# 🤖 Telegram + Gemini + Google Docs Automation in n8n\n\n## 📌 Overview\n\nThis n8n workflow listens for messages sent to a Telegram bot and replies with AI-generated responses using **Google Gemini (PaLM)**. It optionally interacts with **Google Docs** to fetch documents and makes external API requests using an **HTTP Request** node.\n\nThe flow also includes batching and waiting logic to control the pace of replies, making it scalable and human-friendly.\n\n---\n\n## 🧠 What This Workflow Does\n\n### ✅ 1. Trigger from Telegram\n- **Node**: `Telegram Trigger`\n- **Function**: Starts the workflow when a message is received via your Telegram bot.\n\n### ✅ 2. Loop Through Messages\n- **Node**: `Loop Over Items`\n- **Function**: Allows processing multiple incoming messages if required, using batching logic.\n\n### ✅ 3. AI-Powered Reply with Gemini\n- **Node**: `Message a model` (Google Gemini Pro)\n- **Function**: Sends the message to the Gemini AI (via Google PaLM API) to generate a human-friendly, conversational response.\n\n### ✅ 4. Send AI Response via Telegram\n- **Node**: `Send a text message`\n- **Function**: Sends the generated Gemini response back to the user on Telegram.\n\n### ✅ 5. Delay Between Replies\n- **Node**: `Wait 1s`\n- **Function**: Adds a 1-second delay before proceeding to the next message in the loop (helps avoid Telegram rate limits and creates more natural pacing).\n\n### ✅ 6. Optional: External API Request\n- **Node**: `HTTP Request`\n- **Function**: Makes an external API request to `https://devcodejourney.com/` (placeholder URL).\n- **Note**: Currently not connected to message flow but can be used to fetch or send additional data.\n\n### ✅ 7. Optional: Fetch Document from Google Docs\n- **Node**: `Get a document in Google Docs`\n- **Function**: Retrieves the contents of a Google Docs document from a provided link. Can be used to add static text, FAQs, or templates to the conversation.\n\n### ✅ 8. Optional: Alternate Gemini Tool\n- **Node**: `Message a model in Google Gemini`\n- **Function**: Uses a different version (`gemini-2.0-flash-exp`) of the Gemini AI model for fast responses or testing purposes.\n\n---\n\n## 🔧 Technologies Used\n\n- **Telegram Bot API** – for message triggers and replies  \n- **Google Gemini (PaLM API)** – for AI-generated responses  \n- **Google Docs API** – to fetch document content  \n- **HTTP Request** – to connect to any third-party API  \n- **n8n** – no-code/low-code workflow automation platform  \n\n---\n\n## ⚙️ Use Cases\n\n- AI Chatbot for Telegram using Gemini  \n- Personal Assistant or FAQ bot reading from Google Docs  \n- Customer service bot that replies in natural language  \n- Looping conversations with controlled pacing  \n- External data fetching with AI processing  \n\n---\n\n## 📌 Notes\n\n- Make sure you have the correct credentials configured in n8n for:\n  - Telegram Bot\n  - Google Docs OAuth2\n  - Google Gemini API (PaLM)\n- You can add error-handling nodes or conditionals to expand the logic.\n- This can be extended into a full AI chatbot or customer support bot.\n\n---\n\n## 🧩 Nodes Used\n\n| Node Name                          | Type                       | Purpose                                 |\n|-----------------------------------|----------------------------|-----------------------------------------|\n| Telegram Trigger                  | telegramTrigger            | Listens for incoming Telegram messages  |\n| Loop Over Items                   | splitInBatches             | Handles batching of incoming data       |\n| Message a model                   | langchain.googleGemini     | Sends prompt to Google Gemini (Pro)     |\n| Send a text message               | telegram                   | Sends response back to Telegram user    |\n| Wait 1s                           | wait                        | Adds a delay between responses          |\n| HTTP Request                      | httpRequestTool            | Sends HTTP request to external API      |\n| Get a document in Google Docs     | googleDocsTool             | Fetches content from Google Docs        |\n| Message a model in Google Gemini | googleGeminiTool           | Alternate Gemini model for responses    |\n\n---\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9c16c31f-95db-40ab-aa8d-37750b123d2a",
      "name": "Boucler sur les éléments1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        4480,
        1216
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    }
  ],
  "pinData": {},
  "connections": {
    "41eee1be-dfb9-4e7d-b659-a9de0e740e7a": {
      "main": [
        [
          {
            "node": "9c16c31f-95db-40ab-aa8d-37750b123d2a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0049c3fc-f6a2-420f-b0ca-c7330021a405": {
      "ai_tool": [
        [
          {
            "node": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1": {
      "main": [
        [
          {
            "node": "fbd4e562-fb5a-4e85-9814-75e4a9df2900",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9c16c31f-95db-40ab-aa8d-37750b123d2a": {
      "main": [
        [],
        [
          {
            "node": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c3df74b4-6077-4383-9c23-2f7505cea1fe": {
      "main": [
        [
          {
            "node": "9c16c31f-95db-40ab-aa8d-37750b123d2a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fbd4e562-fb5a-4e85-9814-75e4a9df2900": {
      "main": [
        [
          {
            "node": "41eee1be-dfb9-4e7d-b659-a9de0e740e7a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "98b5b120-ab55-47b2-8f0d-0bc29b32bb7f": {
      "ai_tool": [
        [
          {
            "node": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "3dc90867-9946-4143-aeb9-a096993486c5": {
      "ai_tool": [
        [
          {
            "node": "17ac7115-a306-40bf-8b4a-9ce66ebbe3f1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - Chatbot de support, Chatbot IA, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds9
Catégorie3
Types de nœuds9
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Auteur
DevCode Journey

DevCode Journey

@devcodejourney

I build intelligent systems that automate tasks, streamline workflows, and enhance user experiences using tools like n8n, AI chatbots, and modern automation platforms. With a passion for solving real-world problems through smart technology, I create custom solutions that help individuals and businesses save time, scale faster, and work smarter. Whether it's integrating APIs, building no-code/low-code automations, or developing conversational AI, I'm always exploring the edge of what's possible.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34