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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to use a variable inside curly brackets? Edited

Hi.

 

So my idea is the following: whenever I create a new card (on my board about video games), I want to automatically fetch that game cover image and add it as an attachment (to then appear as the cover image of the card).

 

To realize this idea I am using a Game DB API and Butler to fetch that cover image and then add it as an attachment.

 

This is my current Butler workflow:

Butler.png

 

My issue here is with the second POST. I have made several tests and came to the conclusion that the issue is with using a variable inside curly brackets like it is happening in the POST header: { "client-id": "???", "authorization": "Bearer {httpresponse.access_token}" }

 

On my tests, I also tried adding a comment with the following format "{ {httpresponse.access_token} }" and it saved with exactly that text (i.e. did not replace the variable with its value). But if I used "{httpresponse.access_token}" then it worked correctly.

 

My question is then: is there a way to use variables inside curly brackets in Butler commands?

 

Thank you!

6 answers

1 accepted

0 votes
Answer accepted

To whomever finds himself in the same predicament as me, I leave the solution that worked for me that was achieved with the help from the Trello Support team.

 

Basically, it is not possible to use the `httpresponse` variable inside a JSON object (i.e. inside curly brackets) due to the way that the variable is handled (tip: has to do with regex parsing).

 

So the solution is to store the value that will be used inside a JSON object in another place, like a Custom Field or the card description and then use THAT variable inside the JSON object.

And that's it.

 

In my case, after I received the response from the first POST, I stored the {httpresponse.access_token} variable value in the card description and then for the second POST I used the card description variable to fill the header, like so: { "client-id": "???", "authorization": "Bearer {carddescription}" }

This is the flow:

Butler.png

 

Best regards!

Hi @Plutin ,

Welcome to the community!

Please follow up this documentation https://help.trello.com/article/1157-variables

Hi @Soumyadeep Mandal

 

Thank you for the welcome. Glad to be here :) 

 

Actually, I had already read that documentation. And all the others that are related to Butler (https://help.trello.com/category/1134-butler). 

Unfortunately this specific case is not mentioned. Or atleast I did not find anything mentioning this particular case of using variables inside curly brackets.

 

But I have done some more tests and noticed something.

 

I have created the following Butler rule:

Butler-1.jpg

 

And when I create a new card on the board that is using this rule, it behaves like the following:

Rule-1.jpg

 

As can be seen, the issue does not occur when using the `cardname` variable but only with the `httpresponse` variable. Which makes me ponder that the issue may be with the `httpresponse` variable and not with all variables (as I was initially thinking). It may be a bug with that particular variable.

 

Can someone confirm that this is really a bug?

But if not, how can I make `httpresponse` work as `cardname` does?

Like Soumyadeep Mandal likes this

Hi @Plutin ,

Wish you a very Happy New Year!

I think you have misspelled or made the wrong rule!

Delete the rules and recreate them! It was not a bug!

Happy New Year, @Soumyadeep Mandal !

 

As for the issue, I have recreated again the rule and it still has the same behaviour! Unfortunately :(

Hi @Plutin ,

You have written 3 different things in3 different rules in the screenshot!

{httpresponse.access_token}

{{httpresponse.access_token}}

{ {httpresponse.access_token} }

change all three to 

{httpresponse.access_token}

it doesn't work ask Trello support HERE

Hi @Soumyadeep Mandal ,

 

Just to clarify, that is only one rule but with several actions on it.

I did it that way to test the behaviour of the `httpresponse` variable (and consequentially, also with the `cardname` variable). 

 

Anyway, I will try contacting Trello Support by using the link that you provided. 

 

Thank you for all your support with this. I really appreciate it :)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

📹 Favorite Trello templates

Hello Community!  My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. In this video, I'll share my favorite Trello templates. Templates mentioned in ...

133 views 6 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you