How To Use PowerShell To Manage Trello

The PowerShell community is great and to prove it, Josh shows us a community module called TrellOps that allows us to do just about anything in Trello from the command line using PowerShell!

In this snip, we’re going to look at managing Trello with powershell. To do this, I'm using the TrellOPS Module, which you can install from the powerShell Gallery. I’ve already got it installed, so I’ll go ahead and import it and of course, you can use get dash command to list all of the functions available within this module. The first thing you need is an API key mine’s prepopulated here and all loaded into a variable. But in order to get yours. You'll need to be signed into Trello and go to trello.com slash app dash key. If it's the first time you're going to this page. You'll be asked to accept the developer terms and conditions. And then your key will be generated. It's not possible to reset the key and it's important to keep it a secret. I'm not too worried about the key as the account. I'm using for this demo will be deleted soon after. This recording is finished. With your API key you can now generate an access token. You supply the key you just received from the Trello website give it a meaningful name. This is important to help identify the token later on via the Trello website. I’ve set my expression never 'cause I could potentially want to use this token in the future. And my scope is read write so that I can create items on my Trello account we’ll go ahead and create this access token this opens up a browser window. You may need to sign into Trello at this point but once you have signed on click allow. And now you've got your access token. You may want to export this so that you can import it later to users and future power shell sessions. You can test that your access token’s, working by using Get Trello Board. And you'll know that it's working if you receive data back. Let's go ahead and create our first item in Trello, which will be a board. You need to specify the token you have just generated and give your board, a name and optionally a description. It's not strictly speaking necessary to assign this board to a variable but it will make additional steps such as creating lists and cards much easier. So let's create our board. And one thing that this function doesn't do is allow you to delete lists. So if we head back to Trello you'll see that this board has been created with some default lists. Because we can't delete these with power shell at the moment. Let's go ahead and remove them manually. And then we’ll head back to powershell. And we’ll create a list for each day of the week. Notice each of them are referencing our access token and each of them are referencing the ID of our board that we've created. I’ve also named each list Monday through Sunday and each of them is specifying the position of bottom. This basically means that each list will be created at the end of the list or when you're looking at in Trello. It will be represented as being to the right. So let's go ahead and create all 7 lists. And then we can create 2 labels. This will allow us to separate cards into work items and personal items on our weekly planner. Again, I'm referencing the board ID, giving them a name and this time, specifying a color. So let's go ahead and create our first card as always we're specifying our access token. However, this time, the ID is the ID of the list in which this card is to be created. Give it a name, a description and I can specify the idea of one of my labels and a position. I’m using splitting here if you're interested in learning more about splitting see the techsnips video on the subject. So I'll go ahead and run this. And it's created our card successfully. Notice the position here I’ve specified as bottom as this is going to be the first card in that list. This won't have any impact. But if there were other cards that would naturally be placed underneath all of the existing ones. If we go ahead and create a second card, this one is also on the Wednesday list. But as this is a very important card given the nature of what it represents. I'm going to set this position as top meaning it should appear above the previous card. We just created. I go ahead and run thus. And then head back over to Trello. We'll see that 7 lists have been created on our new board and on the Wednesday list specifically our 2 cards are being created with the meeting with the CIO card being created at top. You'll also see each of them have been labeled with the label that we've created earlier. And the description, we specified is within the cards. That's been managing Trello using powershell. Thank you for watching.