Reads unread inbox mail every hour and applies your own labels to each message using AI.
Uses
Claude
Gmail
Auto-label new Gmail messages with AI
labelRules to blank.Set labelRules to blank.maxEmails to 25.Set maxEmails to 25.inbox.List emails. Save it as inbox.messages to inbox.emails.Set messages to inbox.emails.email in messages:For each email in messages:labelErrorIf a step below fails, save the error as labelErrorTry
subject to email.subject.Set subject to email.subject.sender to email.from.Set sender to email.from.snippet to email.snippet.Set snippet to email.snippet.prompt to You are labelling one email. Reply with EXACTLY one label name from the rules below, and nothing else. If none of them fit, reply with the single word none.Set prompt to You are labelling one email. Reply with EXACTLY one label name from the rules below, and nothing else. If none of them fit, reply with the single word none.
Rules:
labelRules
From: sender
Subject: subject
Preview: snippet.prompt. Save it as verdict.Ask Claude: prompt. Save it as verdict.
Maximum response length: 16verdict.response_text and save it as label.Trim verdict.response_text and save it as label.label isn't empty and label is not noneIf label isn't empty and label is not noneYes
label to email email.Add label label to email email.No
No steps
On error
email.id as text: labelError as text.Show in the output: Could not label message email.id as text: labelError as text.