Stacey – your Telegram AI assistant (powered by MCP, Gemini & Google tools)
> This n8n template builds Stacey, an AI assistant that runs inside Telegram. Stacey listens to your messages, understands what you want using AI, and intelligently routes commands to MCP-connected tools — like Gmail, Google Calendar, a blog writer, and more. > > For optimal performance, we recommend using OpenAI’s GPT-4o model. In this template, Google Gemini is used as a free alternative.
💡 Who is this for?
This workflow is designed for:
- AI tool creators and automation builders
- Entrepreneurs who want an intelligent Telegram assistant
- Support and scheduling teams who use Google tools
- Agencies that build & resell AI automations
- Users looking to automate everyday actions like emails, scheduling, blog writing, and contact lookups
🧠 What this workflow does
-
Listens to Telegram messages (text and voice)
-
Transcribes audio using Whisper (optional)
-
Uses Stacey, an AI agent powered by Gemini (or GPT-4o if you upgrade), to:
- Understand the user's intent
- Choose the correct tool using MCP logic
- Execute tasks using Gmail, Google Calendar, blog writer, and more
-
Responds to the user naturally with confirmations and outputs
⚙️ Prerequisites
Before using this workflow, make sure you have:
-
A self-hosted or cloud-based n8n instance
-
A Telegram Bot Token from @BotFather
-
Google OAuth2 credentials for:
- Gmail
- Google Calendar
-
Optional: OpenAI or Whisper API key for voice transcription
-
Optional: Tavily API key for live web search
-
Gemini (Google AI) is preconfigured in the template but can be swapped
🚀 Step-by-Step Setup
✅ Step 1: Add Required Credentials in n8n
Go to Settings → Credentials and add:
-
Telegram API: Your bot token from BotFather
-
Google OAuth2:
- Gmail: Scope
https://www.googleapis.com/auth/gmail.modify - Calendar: Scope
https://www.googleapis.com/auth/calendar
- Gmail: Scope
-
Gemini / Palm API: Used for the language model
-
(Optional) OpenAI Whisper: For voice transcription
-
(Optional) Tavily: For real-time internet searches
✅ Step 2: Import the Workflow
-
Go to n8n
-
Click Workflows → Import from File
-
Upload
ai_assistant.json -
Connect your saved credentials to the correct nodes:
- Telegram Trigger & Sender
- Gmail, Calendar, Tavily, Gemini, Whisper
✅ Step 2.5: Import the Content Creator Sub-Workflow
The Content Creator is implemented as a modular sub-workflow and invoked through the Map Server as part of the MCP logic.
To set it up:
Go to Workflows → Import from File Upload content_creator_tool.json (provided in your files) Save it with a name like “Content Creator Tool” 🔗 Integration with MCP:
This tool is triggered via the MCP Map Server using an Execute Workflow node The AI agent chooses this tool when the user request involves writing blog posts, emails, product descriptions, etc. Make sure the tool ID or name in the Map Server matches what the AI agent uses in its logic You can customize this sub-workflow to:
Adjust writing prompts (e.g., tone, format, target audience) Add branching for different content types (e.g., blog vs. email) Send outputs directly to Gmail, Google Docs, or Sheets
✅ Step 3: Set Up Your Telegram Bot
-
Talk to @BotFather
-
Use
/newbotto create a bot and get your token -
Paste this token into:
Telegram Triggernode (Telegram Trigger1)Telegram Send Messagenode (Response1)
-
Make sure your bot’s privacy is set correctly (use
/setprivacy)
✅ Step 4: Customize Your Assistant’s Personality
-
Open the “AI Agent” node
-
In the
systemMessagefield, you'll find a prompt that defines Stacey:- Her role is to delegate user requests to the right MCP tool
- Includes examples, tone, rules, and logic
-
You can customize Stacey’s:
- Name
- Behavior
- Supported tools
✅ Step 5: Define Your MCP Tools (if extending)
This template includes:
Send EmailReply to EmailGet EmailsLabel EmailsCreate/Update/Delete EventsContent CreatorSearch Web with TavilyCalculator
To extend:
- Add a new tool node
- Link it to
MCP Server Trigger - Reference it in the prompt in
AI Agentnode
✅ Step 6: Test the Workflow
Open Telegram and message your bot:
- “Send an email to John about the new budget”
- “Schedule a meeting Friday at 3 PM with Alex”
- “Write a blog post about solar energy”
- “What’s in my inbox?”
- “Translate this message” (if extended with translation tools)
The bot will:
- Interpret the intent
- Ask for any missing data
- Trigger the right tool
- Send confirmation via Telegram
✨ Customization Ideas
✏️ Add Voice Transcription
- Enable the
Download FileandTranscribenodes - Requires OpenAI Whisper API key
🧠 Upgrade to GPT-4o
- Replace the Gemini node with an OpenAI Chat node
- Connect GPT-4o for improved reasoning and language understanding
🧩 Add More Tools
- Notion, Slack, Salesforce, Hubspot, WhatsApp, and more can be added
- Just route them via MCP and update the AI prompt
🧪 Troubleshooting
Telegram not responding?
- Ensure correct bot token and webhook connection
- Make sure the bot is not in privacy mode if needed
Gmail actions not working?
- Double-check your OAuth scopes
- Ensure Gmail API is enabled in your Google Cloud project
AI not responding or behaving poorly?
- Consider upgrading to OpenAI GPT-4o for better reasoning
- Revisit and refine your system prompt
🧾 Summary
- Name: Stacey – AI Telegram Assistant
- Built with: n8n + Gemini + Google + MCP Logic
- Telegram acts as the front-end
- Gemini or GPT-4o powers intelligence
- MCP routes user intent to the right tool
- Fully extensible and no-code friendly
🌟 Credits & License
Created by David Olusola Free to use, modify, and resell with attribution. If this helped you, please rate the template or follow me on the n8n Creator Page.
Telegram AI Assistant with Google Gemini and n8n Tools
This n8n workflow creates an intelligent Telegram AI assistant powered by Google Gemini. It allows users to interact with an AI agent through Telegram, which can then leverage various tools like a calculator, an HTTP request tool, and even other n8n workflows to respond to queries and perform actions.
What it does
- Listens for Telegram Messages: The workflow is triggered by incoming messages to a configured Telegram bot.
- Initializes AI Agent: It prepares the conversation context using a "Simple Memory" node to maintain continuity in the chat.
- Routes Messages: A "Switch" node is used to differentiate between the initial setup message (e.g.,
/start) and regular user queries. - Processes AI Queries: For regular messages, the "AI Agent" node takes the user's message and, using the "Google Gemini Chat Model", determines the best course of action.
- Leverages Tools: The AI agent has access to several tools to enhance its capabilities:
- Calculator: Performs mathematical operations.
- HTTP Request Tool: Makes web requests to fetch or send data.
- Call n8n Workflow Tool: Allows the AI to trigger and execute other n8n workflows, extending its functionality significantly.
- MCP Client Tool: Interacts with a Model Context Protocol (MCP) server, likely for more advanced AI interactions or context management.
- Responds via Telegram: Once the AI agent has processed the query and performed any necessary actions, it sends the generated response back to the user through Telegram.
- Handles MCP Server Requests: A separate trigger, "MCP Server Trigger", suggests this workflow can also act as a server for other AI agents or systems using the Model Context Protocol.
Prerequisites/Requirements
- n8n Instance: A running instance of n8n.
- Telegram Bot: A Telegram bot token obtained from BotFather.
- Telegram Credential: An n8n credential configured for your Telegram bot.
- Google Gemini API Key: An API key for the Google Gemini Chat Model.
- OpenAI API Key (Optional): If the "OpenAI" node is intended for use (though not directly connected in this JSON, it's present in the workflow definition).
- Other n8n Workflows (Optional): If utilizing the "Call n8n Workflow Tool", you'll need other n8n workflows configured to be called by the AI.
- Model Context Protocol (MCP) Server (Optional): If utilizing the "MCP Client Tool" or acting as an "MCP Server Trigger", an MCP server/client setup is required.
Setup/Usage
- Import the workflow: Import the provided JSON into your n8n instance.
- Configure Credentials:
- Set up your Telegram Bot API credential with your bot token.
- Configure your Google Gemini Chat Model credential with your API key.
- If using OpenAI, configure your OpenAI API credential.
- Activate the Workflow: Ensure the workflow is active in n8n.
- Start Chatting: Send messages to your Telegram bot. The AI agent will process your requests, use its available tools, and respond accordingly.
- Customize: Modify the "AI Agent" node to add or remove tools, adjust the prompt, or integrate with other services as needed. The "Edit Fields (Set)" and "Code" nodes can be used for pre-processing or post-processing messages and responses.
Related Templates
Automate Dutch Public Procurement Data Collection with TenderNed
TenderNed Public Procurement What This Workflow Does This workflow automates the collection of public procurement data from TenderNed (the official Dutch tender platform). It: Fetches the latest tender publications from the TenderNed API Retrieves detailed information in both XML and JSON formats for each tender Parses and extracts key information like organization names, titles, descriptions, and reference numbers Filters results based on your custom criteria Stores the data in a database for easy querying and analysis Setup Instructions This template comes with sticky notes providing step-by-step instructions in Dutch and various query options you can customize. Prerequisites TenderNed API Access - Register at TenderNed for API credentials Configuration Steps Set up TenderNed credentials: Add HTTP Basic Auth credentials with your TenderNed API username and password Apply these credentials to the three HTTP Request nodes: "Tenderned Publicaties" "Haal XML Details" "Haal JSON Details" Customize filters: Modify the "Filter op ..." node to match your specific requirements Examples: specific organizations, contract values, regions, etc. How It Works Step 1: Trigger The workflow can be triggered either manually for testing or automatically on a daily schedule. Step 2: Fetch Publications Makes an API call to TenderNed to retrieve a list of recent publications (up to 100 per request). Step 3: Process & Split Extracts the tender array from the response and splits it into individual items for processing. Step 4: Fetch Details For each tender, the workflow makes two parallel API calls: XML endpoint - Retrieves the complete tender documentation in XML format JSON endpoint - Fetches metadata including reference numbers and keywords Step 5: Parse & Merge Parses the XML data and merges it with the JSON metadata and batch information into a single data structure. Step 6: Extract Fields Maps the raw API data to clean, structured fields including: Publication ID and date Organization name Tender title and description Reference numbers (kenmerk, TED number) Step 7: Filter Applies your custom filter criteria to focus on relevant tenders only. Step 8: Store Inserts the processed data into your database for storage and future analysis. Customization Tips Modify API Parameters In the "Tenderned Publicaties" node, you can adjust: offset: Starting position for pagination size: Number of results per request (max 100) Add query parameters for date ranges, status filters, etc. Add More Fields Extend the "Splits Alle Velden" node to extract additional fields from the XML/JSON data, such as: Contract value estimates Deadline dates CPV codes (procurement classification) Contact information Integrate Notifications Add a Slack, Email, or Discord node after the filter to get notified about new matching tenders. Incremental Updates Modify the workflow to only fetch new tenders by: Storing the last execution timestamp Adding date filters to the API query Only processing publications newer than the last run Troubleshooting No data returned? Verify your TenderNed API credentials are correct Check that you have setup youre filter proper Need help setting this up or interested in a complete tender analysis solution? Get in touch 🔗 LinkedIn – Wessel Bulte
🎓 How to transform unstructured email data into structured format with AI agent
This workflow automates the process of extracting structured, usable information from unstructured email messages across multiple platforms. It connects directly to Gmail, Outlook, and IMAP accounts, retrieves incoming emails, and sends their content to an AI-powered parsing agent built on OpenAI GPT models. The AI agent analyzes each email, identifies relevant details, and returns a clean JSON structure containing key fields: From – sender’s email address To – recipient’s email address Subject – email subject line Summary – short AI-generated summary of the email body The extracted information is then automatically inserted into an n8n Data Table, creating a structured database of email metadata and summaries ready for indexing, reporting, or integration with other tools. --- Key Benefits ✅ Full Automation: Eliminates manual reading and data entry from incoming emails. ✅ Multi-Source Integration: Handles data from different email providers seamlessly. ✅ AI-Driven Accuracy: Uses advanced language models to interpret complex or unformatted content. ✅ Structured Storage: Creates a standardized, query-ready dataset from previously unstructured text. ✅ Time Efficiency: Processes emails in real time, improving productivity and response speed. *✅ Scalability: Easily extendable to handle additional sources or extract more data fields. --- How it works This workflow automates the transformation of unstructured email data into a structured, queryable format. It operates through a series of connected steps: Email Triggering: The workflow is initiated by one of three different email triggers (Gmail, Microsoft Outlook, or a generic IMAP account), which constantly monitor for new incoming emails. AI-Powered Parsing & Structuring: When a new email is detected, its raw, unstructured content is passed to a central "Parsing Agent." This agent uses a specified OpenAI language model to intelligently analyze the email text. Data Extraction & Standardization: Following a predefined system prompt, the AI agent extracts key information from the email, such as the sender, recipient, subject, and a generated summary. It then forces the output into a strict JSON structure using a "Structured Output Parser" node, ensuring data consistency. Data Storage: Finally, the clean, structured data (the from, to, subject, and summarize fields) is inserted as a new row into a specified n8n Data Table, creating a searchable and reportable database of email information. --- Set up steps To implement this workflow, follow these configuration steps: Prepare the Data Table: Create a new Data Table within n8n. Define the columns with the following names and string type: From, To, Subject, and Summary. Configure Email Credentials: Set up the credential connections for the email services you wish to use (Gmail OAuth2, Microsoft Outlook OAuth2, and/or IMAP). Ensure the accounts have the necessary permissions to read emails. Configure AI Model Credentials: Set up the OpenAI API credential with a valid API key. The workflow is configured to use the model, but this can be changed in the respective nodes if needed. Connect the Nodes: The workflow canvas is already correctly wired. Visually confirm that the email triggers are connected to the "Parsing Agent," which is connected to the "Insert row" (Data Table) node. Also, ensure the "OpenAI Chat Model" and "Structured Output Parser" are connected to the "Parsing Agent" as its AI model and output parser, respectively. Activate the Workflow: Save the workflow and toggle the "Active" switch to ON. The triggers will begin polling for new emails according to their schedule (e.g., every minute), and the automation will start processing incoming messages. --- Need help customizing? Contact me for consulting and support or add me on Linkedin.
Synchronizing WooCommerce inventory and creating products with Google Gemini AI and BrowserAct
Synchronize WooCommerce Inventory & Create Products with Gemini AI & BrowserAct This sophisticated n8n template automates WooCommerce inventory management by scraping supplier data, updating existing products, and intelligently creating new ones with AI-formatted descriptions. This workflow is essential for e-commerce operators, dropshippers, and inventory managers who need to ensure their product pricing and stock levels are synchronized with multiple third-party suppliers, minimizing overselling and maximizing profit. --- Self-Hosted Only This Workflow uses a community contribution and is designed and tested for self-hosted n8n instances only. --- How it works The workflow is typically run by a Schedule Trigger (though a Manual Trigger is also shown) to check stock automatically. It reads a list of suppliers and their inventory page URLs from a central Google Sheet. The workflow loops through each supplier: A BrowserAct node scrapes the current stock and price data from the supplier's inventory page. A Code node parses this bulk data into individual product items. It then loops through each individual product found. The workflow checks WooCommerce to see if the product already exists based on its name. If the product exists: It proceeds to update the existing product's price and stock quantity. If the product DOES NOT exist: An If node checks if the missing product's category matches a predefined type (optional filtering). If it passes the filter, a second BrowserAct workflow scrapes detailed product attributes from a dedicated product page (e.g., DigiKey). An AI Agent (Gemini) transforms these attributes into a specific, styled HTML table for the product description. Finally, the product is created in WooCommerce with all scraped details and the AI-generated description. Error Handling: Multiple Slack nodes are configured to alert your team immediately if any scraping task fails or if the product update/creation process encounters an issue. Note: This workflow does not support image uploads for new products. To enable this functionality, you must modify both the n8n and BrowserAct workflows. --- Requirements BrowserAct API account for web scraping BrowserAct n8n Community Node -> (n8n Nodes BrowserAct) BrowserAct templates named “WooCommerce Inventory & Stock Synchronization” and “WooCommerce Product Data Reconciliation” Google Sheets credentials for the supplier list WooCommerce credentials for product management Google Gemini account for the AI Agent Slack credentials for error alerts --- Need Help? How to Find Your BrowseAct API Key & Workflow ID How to Connect n8n to Browseract How to Use & Customize BrowserAct Templates How to Use the BrowserAct N8N Community Node --- Workflow Guidance and Showcase STOP Overselling! Auto-Sync WooCommerce Inventory from ANY Supplier