Automate creating new boards on Trello using Python

This post contains a brief summary of my Qxf2 Hackathon project. It also has a link to a GitHub repository with some useful code that you can use to interact with Trello.


We, at Qxf2, are agile & our sprints last a week. At the end of every week, someone (we rotate the responsibility) creates a new Trello board, add default cards (like one for retrospectives) & then at the start of the sprint people still continuing their work from the last sprint move their card to the new board.

Like every manual re-occurring chain activity, when the person responsible for creating the Trello board doesn’t create one, the moving cards to the new sprint activity will be blocked & at times despite the new Trello board available, people working on last week’s cards required reminder on the team’s communication channel to move the ticket to the new Board.

This made me realize that automating the creating new Trello boards will:

    1. Rollover the sprint accurately
    2. Streamline this whole activity
    3. Provides a platform for automating other activities, like moving incomplete tasks to the new sprint

How I implemented my project:

Trello exposes API to perform every action that can be performed from the UI. It has a well documented API reference section that has examples on how to make API request to perform actions using a few programming languages.

So, I can replace the following manual action

    1. Log in to Trello 2. Click on Create Board 3. Name the Board

with a simple API call using Python request module:

import requests
response=requests.post('https://api.trello.com/boards',params=auth_dict_cont_key_token,data=data_dict_cont_name)

Very straight-forward, right!!
Now, to the detailed implementation – I created a Trello.py class that housed methods to get the details of the user – the organization associated with the user, boards the user was added to & add them to the data directory as pickled card & board objects.
The idea behind having data directory with pickled objects of information of the user was to use them for generating charts, which is yet to be implemented.
I use a runner script to create an instance of the class & execute the class methods. The runner script communicates to a conf file. The conf file holds the key/token or any other input the runner script.
You can find the code on GitHub here – trello-sprint-roll-over


Next steps:

This project is still a work in progress & has been pivoted twice since the start. So what this project does or how it does it may change in the future.
As a quick next action, I am planning to remove certain functions & use this solely to roll over sprints & later add functions like moving cards from an old sprint to a new one.

Leave a Reply

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