Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is there a way to create button to retrieve old card description via Butler?

Joanna May 17, 2021

According to this article, there is a way to recover the card description using Trello's API. I wanted to automate this and tried to create a `Restore previous description` card button using Butler. I was hoping it would be possible to do it using `issue HTTP request` action and then update the description from the response. However, when I run the card button, I always receive a following error:

 

```

There was an error requesting the URL [Trello API url here]

401 invalid key

```

 

The URL is generated properly using the {cardid} variable and works when copied over to another browser tab. Is there any way to get around this and access card's previous description?

2 answers

1 accepted

1 vote
Answer accepted
Iain Dooley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 17, 2021

@Joanna can you take a screenshot of your rule? You should be able to issue an HTTP request to grab the content, but be aware it will be in a big ugly JSON format. You might be better off just auto generating the URL and attaching it to the card so that you can manually click on it and copy/paste the most recent description because you won't be able to parse the JSON from Butler.

If you did want to create an API tool to auto generate the URL, fetch the JSON from it then parse the JSON and set the description to it's immediate predecessor then you could use my BenkoBot platform:

https://app.benkobot.com/

This code would recover the description on a card when you add the "Recover Description" label:

https://gist.github.com/iaindooley/15d82b4344d83d5f64885563f275034d

Joanna May 18, 2021

@Iain Dooleysure, here's a screenshot:

image.png

I am aware that the response is a blob of JSON, but according to this documentation:

When the response is a JSON object, this variable offers an access notation to retrieve properties within the object, e.g.: {httpresponse.myproperty}

For example, the following command in a card button will post a comment with data extracted from a JSON file retrieved with a GET request:

get url "https://example.com/movie-search?q={cardname}",
and post comment "Result count: {httpresponse.relatedMovies.length} \n\n First result: {httpresponse.relatedMovies[0].title}"
 

So I would expect it's ok to retrieve the data from the response in a way that is presented on the screenshot.

 

Anyway, by looking on the Butler logs, I think it never gets to the response. Here's the Butler log if that's helpful:

image.png

 

I checked out your platform and the gist you posted, and while it looks neat, I'm not in liberty of using third parties on the target board.

Iain Dooley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 18, 2021

@Joanna hey that's neat I didn't know that about the json response thing.

It looks to me as though the problem is that there's no session data passed in with the URL, so you're not authenticated to view the card when requesting as Butler.

Fortunately you can just put your API key and token into the URL:

get url "https://trello.com/1/cards/{cardid}/actions?filter=updateCard:desc&key=YOURKEYHERE&token=YOURTOKENHERE", and set the card's description to "{httpresponse[0].data.old.desc}"

Note that it's "desc" not "description".

You can grab your API key by clicking this link:

https://trello.com/1/appKey/generate

You can then grab a token by putting that key into the following URL where I have KEYGOESHERE and then going to the URL:

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

Replace YOURKEYHERE and YOURTOKENHERE with the key and token you generated with those two links, and viola, your Recover Description button will work! It's pretty cool actually I might use it :)

Like Joanna likes this
Joanna May 19, 2021

@Iain Dooleyahh yes, I was suspecting this is an authentication issue.

I checked out your API key/token instructions - works like a charm!

Thanks for your help! :)

0 votes
Dasha Shakov May 17, 2021

Hey Joanna!

I'm not able to suggest a DIY way to view your version history of card descriptions, I'd recommend checking out the Backups for Trello Power-Up. 

Backups for Trello is an on-demand backup & recovery app. Your Trello data gets saved in the Rewind Vault. In the coming months, we will be releasing a feature where you can see the version history of all your cards. You'll also be able to use our Power-Up to restore cards back to their previous versions.

You can check out the Power-Up listing here: https://trello.com/power-ups/5f68db5b510db84238769710.

Let me know if you have any questions!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events