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

Smart Values no corpo POST

Marina Vital May 10, 2021

Bom dia,

Estou tentando, mas sem sucesso colocar uma variável em um corpo para obter o id de uma conta de usuário do Slack.

 

Estou usando o método users/lookupByEmail e quando insiro o parametro email=value, recebo a respota, porém preciso que o value seja uma variável criada como smart value.

 

Ex.: email={{approvers}}

 

Como faço isso?

Capturar (2).PNG

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 12, 2021

Hi Marina,

If I understand correctly here, I believe you are trying to get the response of this webhook so that you can use this as a smart value within another automation action.  It sounds like you are getting a response, but need this to be in a format that can be used in Jira's automation.

I can see from your screenshot that you have already created an action to send the webhook.  Ultimately, I believe you will need to create another action in this same automation rule to "Edit issue" and then pass in some value of the response.  In this case, using the smartvalue of {{webhookResponse.body}} will show us the complete json response of the webhook.

However in Jira's automation, we do not want to use the entire json response body here, just the email address.  If we look at the Slack documentation for this REST endpoint over in https://api.slack.com/methods/users.lookupByEmail

And use the automation smart value reference guide over in https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/#Smartvaluesgeneral---webhookResponse--

I believe that we can use a smart value such as {{webhookResponse.body.email}} or possibly {{webhookResponse.body.user.profile.email}}, (since the email address appears to be a child value inside profile which is inside the user object response) in order to see just the email address as a smart value.

One method I recommend for testing this out is to create a test rule that then posts an action to the Jira issue such as "create comment", and include a comment such as:

email test1:
{{webhookResponse.body.email}}


email test2:
{{webhookResponse.body.user.profile.email}}

Then save this rule, make sure it happens after the webhook rule, and then test this.  We should then see a comment on the issue in question when testing this.  If we can see only an email address from either value here, then we know that is the correct smart value to use for any other rule in automation here, such as the "Edit issue" where you can then use that smart value to set an approver.

Try this and let me know if you encounter any problems, or have any questions about this approach.

Andy

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events