recipe-label-and-archive-emails

Applies Gmail labels to matching messages and removes them from the inbox.

Updated Nov 9, 2023
One-click install
npx skills add https://github.com/oresttokovenko/dot-files --skill recipe-label-and-archive-emails-oresttokovenko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: recipe-label-and-archive-emails
Source: https://github.com/oresttokovenko/dot-files/tree/main/chezmoi/dot_agents/skills/recipe-label-and-archive-emails
Command: npx skills add https://github.com/oresttokovenko/dot-files --skill recipe-label-and-archive-emails-oresttokovenko

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually sorting and archiving recurring emails like service notifications clutters your inbox and wastes time. This recipe automates labeling and archiving matching Gmail messages so your inbox stays organized. ## Core Features & Use Cases - Message Search: Find emails matching Gmail search queries such as sender filters via the gws CLI. - Label Application: Add Gmail labels to matched messages using the messages modify endpoint. - Inbox Archiving: Remove the INBOX label to archive messages without deleting them. - Use Case: Automatically label all emails from [email protected] with a "Notifications" label and archive them so they skip your inbox but remain searchable. ## Quick Start Ask the assistant to find all emails from a specific sender, apply a chosen Gmail label, and archive them from the inbox.

Frequently Asked Questions about recipe-label-and-archive-emails

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically label and archive Gmail emails?

Search for matching messages with gws gmail users messages list using a query like from:[email protected], then call messages modify to add your label ID and remove the INBOX label to archive them.

How do I find the Gmail label ID to apply to messages?

Gmail labels are referenced by label IDs in the messages modify call. You can list existing labels through the Gmail API to retrieve the ID, or use system labels like INBOX directly.

Does archiving Gmail messages delete them?

No, archiving only removes the INBOX label so messages leave your inbox view. The emails remain in your account and stay searchable under any applied labels.

What tools are required to run this Gmail labeling recipe?

You need the gws command-line tool installed and the gws-gmail skill loaded as a prerequisite. The recipe uses the Gmail users messages list and modify endpoints through gws.

Can I use Gmail search operators to filter which emails get labeled?

Yes, the q parameter accepts standard Gmail search syntax such as from:, subject:, or has:attachment. Only messages matching the query are returned and subsequently labeled and archived.