Gmail triage labels via OpenRouter
Applies one of six AI labels to unread Gmail. This n8n template polls Gmail every minute for up to 50 unread inbox messages, normalises sender, subject and body, and sends them to a Gemini model through OpenRouter. The model returns JSON with category, priority, language, confidence and a short summary. The six categories are New lead, Existing client, Pricing, Invoice, Vendor pitch and Spam. The workflow validates the JSON, resolves the label ID, applies the label and removes UNREAD. It never replies to mail, and a run fails if the model output is not valid JSON.
Steps
- Trigger: Polls Gmail every minute for up to 50 unread messagesGmail
- Extracts and normalizes safe fields from each email
- Sends the normalized email content to OpenRouter (Google Gemini)OpenRouter
- Validates the AI response and maps the category
- Loads your existing Gmail labels and resolves the required labelGmail
- Output: Applies the resolved Gmail label to the messageGmail
Limits
- If the AI returns invalid JSON the run fails on purpose.
- Label names are case-sensitive and must match the six listed in Setup exactly.
What it does well
- The workflow never sends or replies to email.
Before you import
Create the six Gmail labels under the AI Triage/ prefix, with names that match the setup list exactly; label names are case-sensitive.
Similar templates
Gmail support replies from Pinecone
Also for customer support, 5 steps.
Gmail replies with HubSpot context
Also for customer support, 7 steps.
Support ticket triage with Claude
Also for customer support, 10 steps.
Gmail and OpenRouter: 6 templates compared
Same two apps, different steps.
Sort incoming requests
Other templates that do this task.