Triage Gmail and draft replies with Ollama, Telegram and Google Sheets

Go to Workflow
0 views
Built by Vonn Vonn
Created on August 04, 2026

Description

Quick Overview
This workflow pulls unread Gmail messages, uses a local Ollama Llama 3.1 model to classify and extract action items, drafts a reply, and sends an approval request to Telegram before creating a threaded Gmail draft and logging the decision to Google Sheets.

How it works
Runs manually and fetches up to 10 unread emails from Gmail.
Normalizes each email into a consistent structure (sender, subject, body, message ID, and thread ID) and classifies it with Ollama into urgent, action_needed, fyi, or spam.
Continues only for emails classified as urgent or action_needed and marks all other categories as skipped.
For actionable emails, uses Ollama to extract a task title and deadline and to draft a short professional reply as structured JSON.
Sends the classification, extracted task/deadline, and draft reply to Telegram and waits for you to approve or decline.
If approved, creates a Gmail draft reply in the original thread, adds a Gmail label (STARRED), and logs the approval/rejection plus details to Google Sheets.

Setup
Connect your Gmail OAuth2 credential and ensure it has permission to read messages, create drafts, and add labels.
Install and run Ollama, pull the llama3.1:latest model, and add an Ollama API credential pointing to your Ollama host (for example, http://localhost:11434).
Create a Telegram bot, add the Telegram API credential, and set the workflow’s Telegram chat ID to the chat where approvals should be sent.
Connect a Google Sheets OAuth2 credential and set the target spreadsheet URL/ID and sheet tab used to log decisions.
Optionally adjust the Gmail search query and the label applied on triage to match your inbox process and avoid reprocessing.

Nodes Used (7)

Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Sheets
n8n-nodes-base.googleSheets
Ollama Chat Model
@n8n/n8n-nodes-langchain.lmChatOllama
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured
Telegram
n8n-nodes-base.telegram