
Recipe Create Gmail Filter
A straightforward recipe for setting up Gmail filters through the command line using Google Workspace tools. You'll create labels, define filter criteria based on sender or subject patterns, and specify actions like auto-labeling or starring messages. The four-step process covers listing existing labels, creating new ones, building the actual filter with JSON criteria, and verifying it worked. Most useful when you need to automate email organization at scale or integrate Gmail filtering into larger workflow scripts. The commands are clean and the JSON structure is simple enough to modify for different filter rules.
- skills.sh installs
- 32K
- GitHub stars
- 32.2K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add googleworkspace/cli --skill recipe-create-gmail-filter --agent claude-codeInstalls into .claude/skills of the current project.
Files
Create a Gmail Filter
PREREQUISITE: Load the following skills to execute this recipe:
gws-gmail
Create a Gmail filter to automatically label, star, or categorize incoming messages.
Steps
- List existing labels:
gws gmail users labels list --params '{"userId": "me"}' --format table - Create a new label:
gws gmail users labels create --params '{"userId": "me"}' --json '{"name": "Receipts"}' - Create a filter:
gws gmail users settings filters create --params '{"userId": "me"}' --json '{"criteria": {"from": "receipts@example.com"}, "action": {"addLabelIds": ["LABEL_ID"], "removeLabelIds": ["INBOX"]}}' - Verify filter:
gws gmail users settings filters list --params '{"userId": "me"}' --format table
Sponsors
Details
- Repository
- github.com/googleworkspace/cli
- Categories
- CLI & Terminal, Office & Documents
More from googleworkspace/cli
All 113- Recipe Save Email Attachments31.8K
- Recipe Backup Sheet As Csv31.7K
- Recipe Organize Drive Folder31.7K
- Persona Exec Assistant31.6K
- Recipe Find Free Time31.5K
- Gws Workflow File Announce31.5K
- Recipe Compare Sheet Tabs31.5K
- Persona Content Creator31.5K
- Gws Events Renew31.5K
- Gws Events Subscribe31.4K
- Recipe Plan Weekly Schedule31.4K
- Recipe Bulk Download Folder31.4K
- Recipe Create Doc From Template31.4K
- Recipe Sync Contacts To Sheet31.3K
- Gws Admin Reports31.3K
- Recipe Generate Report From Sheet31.2K
- Recipe Label And Archive Emails31.1K
- Recipe Reschedule Meeting31.1K
- Recipe Save Email To Doc31.1K
- Recipe Block Focus Time31K
- Recipe Watch Drive Changes31K
- Recipe Create Shared Drive31K
- Persona Team Lead31K
- Recipe Share Doc And Notify30.9K