We all know the feeling: you open your inbox and see 47 unread emails, and the important one is buried under a pile of newsletters and automated notifications. You could spend 20 minutes sorting it all, but that’s time you could be building your product or talking to customers. A few months ago, I hit my limit and wrote a script to do the triage for me. It’s saved me countless hours since, and I’m sharing the approach so you can do the same.
The core idea is simple: instead of checking email manually, have a script pull new messages, analyze the sender and subject, and then flag high-priority ones with a label or a forward to your Slack. The script uses Gmail’s API and a few heuristics. For example, if the sender is in your contacts or the subject contains keywords like ‘invoice’ or ‘urgent’, it gets flagged. Everything else gets archived or moved to a ‘Read Later’ label.
Here’s the actual logic in Python. You’ll need to set up a Google Cloud project and enable the Gmail API, but the README covers that step-by-step. The script itself is about 150 lines, and it runs on a cron job every 15 minutes. The first time you run it, it processes your last 100 emails to train the filters, and then it only looks at new ones.
One thing I learned: don’t try to be too clever with natural language processing. Keyword matching and sender reputation got me 90% of the way there. The remaining 10% is handled by a ‘maybe’ category that I review once a day. If a particular sender starts getting flagged as important but isn’t, you just add them to a blocklist in the config file.
Since implementing this, my inbox has gone from an always-on firehose to something I check twice a day. The script also forwards anything that looks like a lead or a support request to the right Slack channel, so I never miss a genuine inquiry. It’s made me feel more in control and less anxious about email.
If you’re an indie hacker or a founder with a similar email load, I’d recommend giving this a shot. It’s not a silver bullet—you still have to reply to the important ones—but it clears the noise so you can focus on what matters. And the best part: you can get the script from Kintly and have it running in under an hour.
