Analyze Telegram messages with OpenAI and send notifications via Gmail & Telegram
AI-powered Telegram message analysis with multi-tool notifications (Gmail, Telegram)
This workflow triggers on Telegram updates, analyzes messages with an AI Agent using MCP tools, and sends notifications via Gmail and Telegram.
Detailed Description
Who is this for?
This template is for teams, businesses, or individuals using Telegram for communication who need automated, AI-driven insights and notifications. It’s ideal for customer support teams, project managers, or tech enthusiasts wanting to process Telegram messages intelligently and receive alerts via Gmail and Telegram.
What problem is this workflow solving? Use case
This workflow solves the challenge of manually monitoring Telegram messages by automating message analysis and notifications. For example, a support team can use it to analyze customer queries on Telegram with AI tools (OpenAI, Airbnb, Brave, FireCrawl) and get notified via Gmail and Telegram for quick responses.
What this workflow does
The workflow:
- Triggers on a Telegram update (e.g., a new message) using the Listen for Telegram Updates node.
- Processes the message with the Analyze Message with AI node, an AI Agent using MCP tools like OpenAI Chat, Airbnb search, Brave search, and FireCrawl.
- Sends notifications via the Send Gmail Notification and Send Telegram Alert nodes, including AI-generated insights.
Setup
Prerequisites:
- Telegram bot token for the trigger and notification nodes.
- Gmail API credentials for sending emails.
- API keys for OpenAI, Airbnb, Brave, and FireCrawl (used in the AI Agent).
Steps:
- Configure the Listen for Telegram Updates node with your Telegram bot token.
- Set up the Analyze Message with AI node with your OpenAI API key and other tool credentials.
- Configure the Send Gmail Notification node with your Gmail credentials.
- Set up the Send Telegram Alert node with your Telegram bot token.
- Test by sending a Telegram message to trigger the workflow.
Setup takes ~15-30 minutes. Detailed instructions are in sticky notes within the workflow.
How to customize this workflow to your needs
- Add more AI tools (e.g., sentiment analysis) in the Analyze Message with AI node.
- Modify the notification message in the Send Gmail Notification and Send Telegram Alert nodes to include specific AI outputs.
- Add nodes for other channels like Slack or SMS after the AI Agent.
Disclaimer
This workflow uses Community nodes (e.g., Airbnb, Brave, FireCrawl), which are available only in self-hosted n8n instances. Ensure your n8n setup supports Community nodes before using this template.
Analyze Telegram Messages with OpenAI and Send Notifications via Gmail & Telegram
This n8n workflow automates the process of analyzing incoming Telegram messages using OpenAI's language model and then sending notifications based on the analysis via both Gmail and Telegram. It's designed to provide an intelligent layer of processing for your Telegram interactions, allowing for automated responses or alerts.
What it does
- Listens for new Telegram messages: The workflow is triggered whenever a new message is received in a configured Telegram chat.
- Analyzes message content with OpenAI: It passes the incoming Telegram message to an OpenAI Chat Model, leveraging an AI Agent and a Simple Memory to understand and process the message in context.
- Sends notification via Gmail: Based on the AI's analysis, an email notification is sent through Gmail.
- Sends notification via Telegram: A response or notification is also sent back to Telegram, potentially to the original sender or another designated chat.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running instance of n8n.
- Telegram Bot Token: A Telegram bot configured with a bot token for the Telegram Trigger and Telegram nodes.
- OpenAI API Key: An API key for OpenAI to use the OpenAI Chat Model.
- Gmail Account: A configured Gmail credential in n8n for sending email notifications.
Setup/Usage
- Import the workflow: Download the JSON provided and import it into your n8n instance.
- Configure Credentials:
- Telegram Trigger & Telegram Node: Set up your Telegram Bot API credential.
- OpenAI Chat Model: Configure your OpenAI API Key credential.
- Gmail Node: Set up your Google OAuth2 credential for Gmail.
- Activate the workflow: Once all credentials are set and nodes are configured as desired, activate the workflow.
The workflow will then automatically start listening for new Telegram messages and process them as described. You may need to adjust the specific prompts for the OpenAI Agent and the content of the Gmail and Telegram messages to fit your exact use case.
Related Templates
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
Generate viral Instagram scripts by analyzing trending reels with Apify and GPT-4
This n8n template demonstrates how to leverage AI to analyze trending short-form video content and automatically generate original, high-engagement video scripts inspired by proven viral formats. Use cases are many: Create consistent content calendars for beauty salons and aestheticians, maintain a steady stream of reels without creative burnout, or study viral patterns to understand what drives engagement across Instagram's trending hashtags! Good to know The workflow scrapes real trending reels from Instagram based on your chosen hashtag, ensuring you're always learning from current viral patterns Video transcription happens automatically, extracting the core messaging and pacing strategies from successful content Generated scripts use proven engagement structures—hook, value delivery, and call-to-action timing—without copying original content All data is organized in Google Sheets for easy review, editing, and tracking of script performance The AI model intelligently mirrors the emotional tone and narrative structure while creating entirely new storylines How it works A form trigger collects your hashtag and desired number of reels to analyze The Apify API scrapes trending Instagram reels matching your hashtag, filtering for high engagement (1000+ likes from the last 7 days) Filtered reels are added to your Google Sheet with metadata: captions, engagement metrics, video links, and music information Each reel is automatically transcribed using video-to-text technology, capturing the exact dialogue and timing The AI Agent analyzes each transcript to understand its underlying structure—pacing, tone, curiosity hooks, and CTA placement Using this analysis, Claude generates a completely original script that follows the same proven engagement formula but with a fresh topic or angle Generated scripts are saved back to your Google Sheet alongside the source materials for comparison and refinement A summary email is sent confirming the number of scripts created and ready for production How to use Start by entering a beauty or lifestyle hashtag (e.g., aiautomation, beautysalon, haircare) and specify how many trending reels to analyze Review the scraped content in your Google Sheet to understand what's currently resonating Check the generated scripts and use them as jumping-off points for your own video production Iterate on the process with different hashtags to discover emerging trends in your niche Requirements Apify account and API key for Instagram scraping (free tier available) Google Sheets document set up to store reel data and generated scripts OpenAI API key for the AI script generation Gmail account for the completion notification (optional but recommended) Customising this workflow Adjust the engagement filter thresholds (currently 1000+ likes, 7 days old) to capture micro-trends or evergreen content Modify the AI prompt in the "AI Agent" node to enforce specific brand voice, tone, or content guidelines Add additional Google Sheet columns to track metrics like script-to-video conversion rates or audience response Connect to additional distribution channels—automatically post scripts to team Slack, create video production briefs, or trigger video editing templates Experiment with different video categories by creating multiple instances of this workflow for different hashtags or niches
Monitor & auto-heal AWS EC2 instances with multi-channel alerts
This n8n workflow automates the monitoring, health assessment, and self-healing of AWS EC2 instances in production environments. It runs periodic checks, identifies unhealthy instances based on status and metrics, restarts them automatically, and notifies teams via multi-channel alerts while logging data for auditing and reporting. Key Features Triggers health checks every 5 minutes to proactively monitor EC2 fleet status. Fetches and loops through all production EC2 instances for individualized analysis. Evaluates instance health using AWS metrics and custom thresholds to detect issues like high CPU or stopped states. Performs automatic restarts on unhealthy instances to minimize downtime. Sends instant WhatsApp notifications for urgent alerts, detailed email reports for team review, and logs metrics to Google Sheets for long-term tracking. Includes sticky notes for quick reference on configuration, self-healing logic, and alert setup. Workflow Process The Schedule Trigger node runs the workflow every 5 minutes, ensuring frequent health monitoring without overwhelming AWS APIs. The Get EC2 Instances node fetches all production-tagged EC2 instances from AWS, filtering by environment (e.g., tag: Environment=Production). The Loop Over Instances node iterates through each fetched instance individually, allowing parallel processing for scalability. The Check Instance Status node retrieves detailed health metrics for the current instance via AWS API (e.g., status checks, CPU utilization, and state). The Health Status Check node evaluates the instance's status against predefined thresholds (e.g., failed system checks or high load); if healthy, it skips to logging. The Analyze Health Data node assesses metrics in depth to determine action (e.g., restart if CPU > 90% for 5+ minutes) and prepares alert payloads. The Restart Instance node automatically initiates a reboot on unhealthy instances using AWS EC2 API, with optional dry-run mode for testing. The WhatsApp Notification node (part of Multi-Channel Alerts) sends instant alerts via Twilio WhatsApp API, including instance ID, issue summary, and restart status. The Email Report node generates and sends a detailed HTML report to the team via SMTP, summarizing checked instances, actions taken, and metrics trends. The Google Sheets Logging node appends health data, timestamps, and outcomes to a specified spreadsheet for historical analysis and dashboards. The Sticky Notes nodes provide inline documentation: one for AWS credential setup, one explaining self-healing thresholds, and one for alert channel configurations. Setup Instructions Import the workflow into n8n and activate the Schedule Trigger with a 5-minute cron expression (e.g., /5 *). Configure AWS credentials in the Get EC2 Instances, Check Instance Status, and Restart Instance nodes using IAM roles with EC2 read/restart permissions. Set up Twilio credentials in the WhatsApp Notification node, including your Twilio SID, auth token, and WhatsApp-enabled phone numbers for sender/receiver. Add SMTP credentials (e.g., Gmail or AWS SES) in the Email Report node, and update sender/receiver email addresses in the node parameters. Link Google Sheets in the Google Sheets Logging node by providing the spreadsheet ID, sheet name, and OAuth credentials for write access. Customize health thresholds in Health Status Check and Analyze Health Data (e.g., via expressions for CPU/memory limits). Test the workflow by manually executing it on a small set of instances and verifying alerts/logging before enabling production scheduling. Review sticky notes within n8n for quick tips, and monitor executions in the dashboard to fine-tune intervals or error handling. Prerequisites AWS account with EC2 access and IAM user/role for DescribeInstances, DescribeInstanceStatus, and RebootInstances actions. Twilio account with WhatsApp sandbox or approved number for notifications. SMTP email service (e.g., Gmail, Outlook) with app-specific passwords enabled. Google Workspace or personal Google account for Sheets integration. n8n instance with AWS, Twilio, SMTP, and Google Sheets nodes installed (cloud or self-hosted). Production EC2 instances tagged consistently (e.g., Environment=Production) for filtering. Modification Options Adjust the Schedule Trigger interval to hourly for less frequent checks or integrate with AWS CloudWatch Events for dynamic triggering. Expand Analyze Health Data to include advanced metrics (e.g., disk I/O via CloudWatch) or ML-based anomaly detection. Add more alert channels in Multi-Channel Alerts, such as Slack webhooks or PagerDuty integrations, by duplicating the WhatsApp/Email branches. Enhance Google Sheets Logging with charts or conditional formatting via Google Apps Script for visual dashboards. Implement approval gates in Restart Instance (e.g., via email confirmation) to prevent auto-restarts in sensitive environments. Explore More AI Workflows: Get in touch with us for custom n8n automation!