Tired of getting spam in your mailbox? Setting up filters with Gmail webinterface (gmail.com > settings > filters) is quite cumbersome. The amount of effort simply keeps me away from doing so.
This workflow let's you create filters with ease using Alfred.
- Node
v8+
- Alfred
v3
- The Alfred Powerpack.
- A Google account (with Gmail)
- GmailFilters.alfredworkflow.
This workflow requires API access to Google API over Oauth2. Follow these steps to create and configure an access token:
-
Install binary
git clone https://github.com/inlet/alfred-workflow-gmail-filters ~/.alfred-workflow-gmail-filters cd ~/.alfred-workflow-gmail-filters yarn install
-
Authenticate with credentials
Head to Google API Console > Dashboard and create oath2 credentials. Checkout Step 1: Node Quickstart Tutorial for more details.
Once created, download
client_secret.json
to~/.alfred-workflow-gmail-filters
and run:node ~/.alfred-workflow-gmail-filters/index.js --list
Copy and paste the url in your browser and create the access token for your Google account. Then copy and paste the token into the terminal and hit
ENTER
to finish the authentication.This stores the token in
token.json
for future requests.You should see the enabled filters listed now. With this in place, you can now easily manage your Gmail filters.
See
node ~/.alfred-workflow-gmail-filters/index.js --help
for usage. -
Install the workflow
Double click on
GmailFilters.alfredworkflow
. Download here
In Alfred, type: spam example@mail.com
You should see a notification that the filter is added.