Recipe Label And Archive Emails

by googleworkspacea3768d0e82adNo license31K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated yesterday

Apply Gmail labels to matching messages and archive them to keep your inbox clean.

AI-generated overview

Applies Gmail labels to matching messages and archives them to keep the inbox clean.

What it does
This recipe describes a three-step Gmail workflow: search for messages matching a query, add a label to a message, and archive it by removing the INBOX label. It produces labeled and archived Gmail threads. It is instructions only and ships no scripts.
When to use it
Use it when you want to triage Gmail messages that match a search query, such as notifications from a particular sender. It suits routine inbox cleanup where messages should be labeled and moved out of the inbox.
Requirements
Requires the gws command-line tool and the gws-gmail skill to be loaded. Gmail account access is needed to list and modify messages. No scripts are included.

Label and Archive Gmail Threads

PREREQUISITE: Load the following skills to execute this recipe: gws-gmail

Apply Gmail labels to matching messages and archive them to keep your inbox clean.

Steps

  1. Search for matching emails: gws gmail users messages list --params '{"userId": "me", "q": "from:[email protected]"}' --format table
  2. Apply a label: gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"addLabelIds": ["LABEL_ID"]}'
  3. Archive (remove from inbox): gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"removeLabelIds": ["INBOX"]}'

Source and attribution

Source:googleworkspace/cliinskills/recipe-label-and-archive-emailsat commita3768d0

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal