Quick overview
Quick overview This workflow polls Gmail for unread messages, uses OpenAI to classify each email into one of six categories based on content and prior sender history, applies the matching Gmail label, and sends a Telegram alert when an email is classified as requiring a reply. How it works Polls Gmail every minute for new unread messages. Retrieves all Gmail labels and builds a lookup list so categories can be matched to label IDs by name. Fetches the full email content, headers, and sender/recipient details for each triggered message. Uses OpenAI (with Gmail search tools) to check prior inbox and sent history with the sender and return a single category, confidence score, and brief reasoning. Maps the returned category to the corresponding Gmail label ID and applies the label when a matching label exists. Sends a Telegram message when the email is classified as “To Respond” and Telegram alerts are enabled, or sends an “unclassified” alert if no matching Gmail label is found. Setup Connect a Gmail OAuth2 account for the Gmail Trigger, Gmail label lookup, message fetch, and label application steps. Add an OpenAI API credential and set the model name in the Configuration (for example, gpt-4o-mini). In Gmail, create six labels with these exact names: To Respond, FYI, Notification, Marketing, Meeting Update, Comment. In the Configuration step, set your owner_email and (if alerts are enabled) your telegram_chat_id. Create a Telegram bot, connect a Telegram API credential, and set the workflow to send messages to your target chat ID. Additional info Classify Gmail messages with AI and alert urgent emails via Telegram 📥 Open full documentation on Notion Need help customizing? Contact me for consulting and support : Linkedin MY NEW YOUTUBE CHANNEL 👉 Subscribe to my new YouTube channel. Here I'll share videos and Shorts with practical tutorials and FREE templates for n8n. An n8n automation workflow template by Dr. Firas.
Dr. Firas
web
free
Others in the same category, ranked by how often they are opened.