⚡ Build a multi-functional Telegram bot with Gemini, RAG PDF search & Google Suite

1,590 views · ⚡ Personal Productivity

Description

The Ultimate Beginner’s Guide to an AI-Powered Telegram Assistant (PDF, Brave search & Google Suite)

This comprehensive workflow bundle is designed as a powerful starter kit, enabling you to build a multi-functional AI assistant on Telegram. It seamlessly integrates AI-powered voice interactions, an intelligent PDF document search using a Retrieval-Augmented Generation (RAG) system, and automates various Google Suite tasks like calendar management and document generation. Perfect for beginners looking to explore advanced AI and automation capabilities.

Disclaimer

This template is designed for self-hosted n8n instances.

🚀 Key Features

⚙️ How It Works

The workflow is initiated by messages or commands sent to your Telegram bot. A central Switch node directs the flow based on the input received.

1. Telegram Interaction & Command Routing

2. AI Voice Bot Functionality

3. PDF RAG System with Mistral OCR & Qdrant

4. AI Chat & Task Automation (General Chat & /chat command)

5. Google Automations

6. Web Search (via /brave <query> command or AI Agent)

7. Help Command (/help)

🛠️ Setup Steps & Credentials

To get this workflow bundle up and running, you’ll need to configure several credentials:

  1. Telegram:
    • Create a new bot via @BotFather on Telegram to obtain a Bot Token.
    • Add this token to the Telegram Trigger node and all Telegram (sender) nodes in the workflow.
  2. OpenAI:
    • Obtain an API Key from platform.openai.com.
    • Create an OpenAI credential.
    • Use this credential in the Convert audio to text (OpenAI node for Whisper transcription) and all Embeddings OpenAI nodes (for RAG system).
  3. Replicate API (Text-to-Speech):
    • Sign up at replicate.com and get your API token.
    • Create an HTTP Bearer Auth credential using this token.
    • Assign this credential to the Call Replicate API (HTTP Request) node.
  4. Google Gemini (PaLM API):
    • Get an API key from Google AI Studio or Google Cloud Console.
    • Create a Google Gemini(PaLM) Api credential.
    • Assign it to all Google Gemini Chat Model nodes.
  5. Qdrant (Vector Database):
    • Set up a Qdrant instance (either cloud-hosted or self-managed).
    • Note your Qdrant instance URL and API Key (if security is enabled).
    • Create a QdrantApi credential with these details.
    • Assign it to the Qdrant Vector Store nodes.
    • For the Refresh collection node (an HTTP Request node used to clear the collection for /pdf command demo), create an HTTP Header Auth credential with your Qdrant API key if required by your instance.
  6. Mistral AI (PDF OCR):
    • Obtain an API key from console.mistral.ai.
    • Create a Mistral Cloud API credential.
    • Assign this to the Mistral Upload, Mistral Signed URL, and Mistral DOC OCR (HTTP Request) nodes.
  7. Google Drive & Google Docs:
    • Ensure the Google Drive API and Google Docs API are enabled in your Google Cloud Console project.
    • Set up OAuth 2.0 credentials (Client ID and Client Secret).
    • Create Google Drive OAuth2 Api and Google Docs OAuth2 Api credentials.
    • Assign these to the respective Google Drive and Google Docs nodes throughout the workflow.
    • Important: Configure relevant Folder IDs (for PDF search, invoice template source, invoice output) and the invoice template Document ID in the Google Drive and Google Docs nodes.
  8. Google Calendar:
    • Enable the Google Calendar API in your Google Cloud Console project.
    • Set up OAuth 2.0 credentials.
    • Create a Google Calendar OAuth2 Api credential.
    • Assign it to the Google CalendarTool and Google Calendar nodes.
    • Specify the correct calendar names or IDs in the nodes (e.g., for birthdays, holidays, new event creation).
  9. Brave Search:
    • Get a Brave Search API key from their developer portal.
    • Create a Brave Search API credential.
    • Assign it to the Brave Search nodes and tools.
  10. (Optional) Airbnb MCP Client:
    • The workflow includes example nodes for Airbnb MCP tools. If you intend to use or expand these, set up the corresponding MCP Client API credentials.

💡 Customization & Learning

This “Beginner Bundle” is not just a ready-to-use solution but also a fantastic learning resource:

By setting up and dissecting this workflow, beginners can gain a practical understanding of building complex, AI-driven applications, integrating various services, and managing different data flows.

🔗 Nodes Used

HTTP Request, Telegram, Telegram Trigger, Google Drive, Google Calendar, Google Docs

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup