How to restore Trello Card description

4 minute read

Have you ever found yourself accidentally messing up you Trello card description? I have, countless times. So, one of these times, when I tried to recreate the description from memory, I asked myself: “Maybe there’s a better way to do it?”. I started looking for a solution, and came across this Trello help article. Let’s look closer on how they advise to deal with recovering card descriptions.

Solution 1: use Trello API

It turns out that in the background Trello keeps track of the changes made on the cards. This means that the old version of the overridden description is not actually deleted, it’s just no longer available through the user interface. It can be accessed via the Trello API, though. You just need to follow a few steps:

  1. Log into your Trello account and retrieve the card ID. The card ID is included in the URL, after /c/, according to this schema: https://trello.com/c/{card_id}/{card_name}
  2. Visit https://trello.com/1/cards/[card ID]/actions?filter=updateCard:desc, replacing [card ID] with the ID you’ve just retrieved. Note: if you prefer to make request via other tool, like Postman or cURL, you’ll also need to pass authentication credentials as described in this article.
  3. Look for the data.old.desc to get your old card descriptions. You can use browser add-ons like JSONView Chrome Extension or JSONView Firefox Add On for a readable output, or simply inspect you request in the Network tab of the browser’s developer tools.
  4. Select the description you want to recover and paste on your card.

That’s it. However, while it’s quite simple, it’s still a manual task and requires some effort to be done. It really feels like there should be a built-in button in Trello that does this for us… Fortunately, even though there is no such button, Trello gives us an opportunity to build one using Butler automation, what brings us to the second solution.

Solution 2: add card button using Butler

While the previous solution works and is pretty simple, it requires a bit of manual work to be done. So I started thinking of a way to automate this, and the simplest thing I could think of was adding a card button using Trello.

We basically need to make our new button follow the instructions from the previous solution and make it retrieve the old description via the Trello API.

Let’s start with creating a new Trello button. In order to do this, we need to log in to you account and go to the board that you’d like to add the button to. Then, open the “Card buttons” tab under the “Automation” menu and click on “Create Button”.

card_buttons.png

The new page will open where we can enter our new button name and select the icon. Then. in order for the button to actually do something, we need to add an action to it.

We want our button to perform similar steps as described in the first solution, so we need to issue an HTTP request. The action we need can be found under the “Content” tab, it’s the last action in this section. As for the previous solution, we need to make a GET request to retrieve the history of card updates. Therefore, let’s set the URL to

https://trello.com/1/cards/{cardid}/actions?filter=updateCard:desc&key=API_KEY&token=API_TOKEN

Now, you may notice that the URL is slightly different - it contains API key and token, so the Butler can authorize this request. We need to replace the API_KEY and API_TOKEN with appropriate value. You can learn your API_TOKEN here. With the API key, we can now manually create an API token for our Butler button to use. This can be done by visiting the following URL, with API_KEY replaced with the key we retrieved earlier:

https://trello.com/1/authorize?key=API_KEY&name=RecoverDescription&expiration=never&response_type=token&scope=read

Please refer to this note about the token security.

Having API key and token, we can now replace them in the link in our card button. At this point, the button should look like this:

card_button_1.png

Now our card button will be able to retrieve the card’s update history and make the response available under {{httpresponse}} key. We now want to actually retrieve the previous description and make Butler update our card with that. Fortunately, Butler allows us to easily set the card’s description to whatever we want. Let’s use this and set it to the {{httpresponse[0].data.old.description}}. And that’s it! The button should look like this now:

card_button_2.png

We can now save the button and enable it on the board! Clicking the button on a card it would retrieve the latest description and update the card.

This method has one caveat though. With this instructions we can only select an arbitrary description - in this example, we select the first one from the retrieved list of changes. If you need the ability to select a particular version from history and you’re at liberty of adding third-party upgrades to your board, you can check out Backups for Trello add on.

Note

Please note that currently Trello does not support scopes related to Trello objects. The only scopes available are read, write and account. For the description retrieval button, the read scope is sufficient, so make sure your token doesn’t get any unnecessary permissions.

However, even the read scope gives the token the ability to access all cards, boards and workspaces of the user, even to the private ones. It cannot be scoped to the specific board.

This method puts your personal Trello API key and token in plain text inside a Butler button definition. Anyone who has the rights to read your button definitions would also be able to see potentially sensitive credentials, so please use this method with caution.