Inbox Zero API Endpoint

I would like to connect Drafts with Beeminder. The goal is to create some accountability around emptying out my inbox.
I reckon that this would entail creating an API Endpoint for whenever my Inbox count hits zero, and then sending that data over to Beeminder.
Is there such a thing in Drafts? Is there any other way to let an app like Beeminder know whenever I hit Inbox Zero?

Thanks so much.

1 Like

Drafts does not have a way to trigger any sort of event when your inbox goes to zero items.

I’m not sure what Beeminder is, so I’m not much help there. If it is a web service with an API, you could like post to it from an action in Drafts that checks if your inbox is at zero, but that would need to be triggered via some automation, or be part of some other processing action.

Thank you.
What’s the line of code that would return the number of notes in my Inbox?
With that, I suspect that I could cobble something together and get it to work.
Thanks.

This would give you the inbox count in your default workspace:

let ws = new Workspace()
let ct = ws.query("inbox")
1 Like

Assuming ct is the count, I think you would need to also include the length in setting it.

let ws = new Workspace()
let ct = ws.query("inbox").length
alert(ct)
1 Like

Oops, thanks for catching that.

1 Like

You could write a Shortcut to run periodically on your phone to check whether there are zero items in your inbox and then report that out to Beeminder using any of the tools available in Shortcuts…

Thanks. :pray: Are there any Drafts actions you know of that do something similar which I can download and analyze? Thanks.

In Shortcuts, something like:

Get drafts from workspace […set your workspace]
Count [items] in [Drafts from workspace]
If [Count] = 0
(Whatever action pings Beeminder)

Once you’ve got that up and running, set that shortcut as an automation for whatever time(s) or trigger(s) work for your needs. Check permissions to ensure it’s able to run in the background.

1 Like

Thank you! I will try this out and then get back to you!

1 Like