Blog Post

Automatically Marking Cards as Completed via Trello Webhooks

Automatically Marking Cards as Completed via Trello Webhooks

I’ve got a webhook for my main Trello board that’s so simple that I don’t really even think of it anymore.  Today, though, I was working in the board my wife and I use for our household stuff and it annoyed me that it wasn’t there, so I set it up and figured it was probably worth documenting.

The webhook takes cards that are moved into the board’s “Done” column and marks the due date as “Completed.”  This just saves me a step, as I don’t have to mark it as done and also move it.

The code for the webhook is relatively simple.  It uses my TrelloApi wrapper class and the model it’s applied to is the board itself.

From the above, we can see that the script is mostly bootstrapping.  On line 10, we check that the action was moving a card from one list to another and that the list we ended up on was the “Done” list (with the ID for that list configured away).  If so, we use the TrelloApi wrapper class to fire off a PUT request to the /1/card/<card_id> endpoint, updating the impacted card to set dueComplete to true.

I’m sure this could be accomplished by Butler or something but I’ve been invested in the Trello API from the start, so I use the API.

Maybe I’m imagining things but it feels like ten years ago or so there was a lot more of a developer community around Trello than there is now.  Maybe it’s simply that, at that time, I myself was learning so much about the API and writing so much about it, so it felt like something more.  I can’t put a finger on when that stopped; whether it was with Trello’s acquisition of Butler or Atlassian’s acquisition of Trello or the end of the Trello Community Slack.

Nonetheless, writing about this simple little script has me feeling nostalgic for those times, whether they actually existed or not.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.