n8n

How to Automate Gmail Inbox Triage?

Sort new emails in Gmail with AI and add the right labels without manual work. Great for teams that get many messages and need fast routing for partnership requests, inquiries, and routine notifications.

Here is how it runs end to end. A Gmail trigger watches for new messages on a schedule. The message body is pulled and sent to an AI step that chooses labels from a list you define. The AI output is parsed into clean JSON, then mapped to fields. The flow fetches your Gmail label catalog, matches the AI label names to real label IDs, builds one list of IDs, and applies them back to the email. This creates consistent labeling and a clean inbox with reliable rules.

Setup is simple. Create the same labels in Gmail and in the AI prompt and JSON schema so names match exactly. Connect Gmail and OpenAI credentials in n8n Cloud. Adjust the polling interval to fit your volume. Expect faster triage, less context switching, and fewer missed messages from partners or prospects. Teams in sales ops, marketing ops, or shared inbox owners can use it to route work to the right person in minutes.

What are the key features?

  • Gmail trigger checks for new emails at your chosen interval
  • Get message content pulls the email body using the message ID
  • OpenAI Chat selects the best labels from a list you define
  • Structured JSON parsing turns AI output into clean fields
  • Set node maps and normalizes label names for matching
  • Get all labels fetches Gmail label names and IDs
  • Split Out processes each chosen label separately
  • Merge matches AI label names to real Gmail label IDs
  • Aggregate builds a single array of label IDs for the email
  • Add labels to message applies the labels to the Gmail thread

What are the benefits?

  • Reduce manual sorting from 60 minutes to 5 minutes per day
  • Automate up to 90% of repetitive inbox triage
  • Improve label accuracy by using a fixed approved list
  • Handle 10 times more email volume without extra staff
  • Connect Gmail and OpenAI in one reliable flow

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n, click the three dots menu, select 'Import from File', then choose the downloaded JSON file
  2. You'll need accounts with Gmail and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, open the Gmail trigger node, choose Credential to connect with, click Create new credential, and follow the on screen steps to connect your Google account using OAuth2
  4. Open the OpenAI Chat node, choose Credential to connect with, click Create new credential, then paste your OpenAI API key from your OpenAI account API page
  5. In your Gmail account, create or confirm the labels you plan to use such as Partnership, Inquiry, and Notification. Use exact names
  6. Open the Assign labels for message chain and edit the system prompt to include your label names and clear selection rules
  7. Open the JSON Parser node and update the JSON schema so the label names and structure match the prompt output exactly
  8. In the Gmail trigger, set the polling interval to Every minute or adjust to match your email volume and API limits
  9. Check the Get message content node and confirm the messageId expression is {{ $json.id }} so the right email is fetched
  10. Save and run once. Send a test email that should map to a known label. Confirm the Add labels to message node completes without errors
  11. If labels are not applied, verify the Merge corresponding labels node has matches. Label names are case sensitive
  12. If the JSON Parser errors, refine the prompt so the AI returns valid JSON that follows the schema

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.