{{webhookResponse.body.foo}} smart value is flat-out not working

Michael Skiles
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 15, 2020

I am currently experimenting with the "Send Web Request" action in JIRA automation. The documentation suggests that you can parse a web response (if the "wait for response option" is checked) as follows:

In successful webhook execution, you would be able access webhook response data using the following smart values:

{{webhookResponse.body}} returns the response body, if the body is a JSON object then you can access values using dot notation e.g. {{webhookResponse.body.name}}

In this screenshot of the audit log, you can see the first log action where I'm logging {{webhookResponse.body}}. This works just fine. But when I try to evaluate a JSON property in the second log action using {{webhookResponse.body.error}}, you can see it evaluates as an empty string.

 

image.png

8 answers

1 accepted

0 votes
Answer accepted
sreuter
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 28, 2020

Thanks for reporting this. We've started looking into this and already identified the issue. Expect a fix for this soon!

sreuter
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 28, 2020

Progress on this can be tracked here: https://codebarrel.atlassian.net/browse/AUT-1943

sreuter
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2020

This has been deployed to production 5 minutes ago. We successfully confirmed the fix with our own testing services, as well as the Slack API via https://api.slack.com/methods/api.test :)

@Jaroslaw Wojciechowski @Michael Skiles Please let us know if this fixes things for you as well!

Jaroslaw Wojciechowski June 1, 2020

Works for me now. Thank you for fixing this.

Like sreuter likes this
Dean Putney June 2, 2020

Hi, although it seems this was fixed, I am now seeing the same issue again. Has this regressed by any chance?

Like Nick Canada likes this
Dean Putney June 2, 2020

Specifically, my results are:

{{webhookResponse.body}}

{"data":{"rows":[ ["2020-04-18"] ], "cols":... "status":"completed"}

{{webhookResponse.body.status}}

Empty string.

 

"status" is a top-level field on the body. Fields like {{webhookResponse.body.data}} also fail, but what I really want to access is {{webhookResponse.body.data.rows[0][0]}}

sreuter
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2020

@Dean Putney It's a bit hard to tell, as you shortened the response object (I see a missing closing bracket in your example), but is it possible that status is part of data?

Otherwise, could you send us a screenshot of the response headers you get from your endpoint, ideally from using curl -v to do the same query?

Dean Putney June 2, 2020

Apologies for shortening the response too much, I corrected for clarity in some edits here. There are no missing brackets and it is a valid JSON object in my test. "status" is a top level field on the body. Similarly, "data" returns an empty string as well.

Regarding the headers, is there a way I can send that information privately?

sreuter
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2020

Sure, I'm sreuter@ :) 

Dean Putney June 2, 2020

Thank you, I've sent you an email with this information.

Like sreuter likes this
sreuter
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2020

Got it, answer sent :)

Darren Lattin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 3, 2020

I have the same issue, that I am trying to access a web request hook response similar to the above {{webhookResponse.body.data.rows[0][0]}}. where the data is within an array. Is this notation supported?

I am trying to use the following syntax in an email to loop items in the array.

{{#webhookResponses.body.query_results.column_positions}}

Data from response: {{[0].[0].name}}
{{/}}

Dean Putney June 3, 2020

@Darren Lattin Hi. I was able to get this functioning– for array/list accessors use .get(0)

https://support.atlassian.com/jira-software-cloud/docs/smart-values-lists/

2 votes
Jaroslaw Wojciechowski May 25, 2020

Hey, I am having exactly the same error:

 

This works fine

{webhookResponse.body}}

 

and it returns the following json:

{
"ok": true,
"group": {
"id": "xxxxxx",
"name": "xxxxx",

....

}

But then when I try to access anything within a response json nothing is working

{{webhookResponse.body.ok}}

{{webhookResponse.body.group}}

{{webhookResponse.body.group.id}}

steven.saito
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 26, 2021

Hey,

Was this problem ever resolved for you?

I am trying to do the same thing by trying to access id using {{webhookResponse.body.success_record_info.id}}. But nothing is returned

---------what {{webhookResponse.body}} returns-----

---------------------------------------------------------------------------- 

{

"status": "processed",

"input_record_count": 1,

"success_record_info": [

          {

          "index": 1,

          "id": 33,

          "type": "issue"

          }

],

....

 }

----------------------------------------------------------------------------

Even using {{webhookResponse.body.status}} returns nothing but an empty string for me.

I can see that this was resolved for others in this question but was it something done on Atlassian's side or something you were instructed to change/do?

What the exact solution is is unclear

Thanks in advance for anyone who responds :) 

Like # people like this
Deleted user August 4, 2021

Any news about this? I have the same problem! Thanks

Like # people like this
Nick Canada
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2021

I am also having this issue. Seems like it was fixed for a time but has reappeared as an issue?

Burak Hancerli January 10, 2022

I believe it's still not working. I cannot get any values with dot notation.

steven.saito
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 10, 2022

If this helps anyone

I did end up reaching to Atlassian Support and they gave me a smart-value to use that did work for a while

{{ webhookResponse.body.substringBetween("id\":", ",") }} 

 But I believe sometime in the summer of 2021, using the expected notation of 

{{ webhookResponse.body.success_record_info.id }}

did start working for me and is still working. Last tested December 20, 2021

1 vote
Antonio Jose da Silva March 28, 2024

Mine works after leaving the item in the image set:

image.png

1 vote
ginxx009 October 11, 2022

Tried and the dot notation is still not working on jira automation

{{webhookResponse.body.id}} -> gives me an empty value

{{webhookResponse.body}} -> gives me this

{

"id" : "1",

"name": "ewww"

}

1 vote
Shay Yacobinski August 14, 2022

Dot notations for webhook.body seems to not work again in Jira Automation. We're getting empty values.
We have existing automation rules that just started breaking.
We're using the workaround with `substringBetween` suggested in one of the comments we need a solution.

daniel.szewczyk September 13, 2022

It's {{webhookResponse.body}} not webhook.body

Shay Yacobinski October 23, 2022

I typed it wrong when posting but the issue remains the same.

1 vote
Kim Andersson March 15, 2022

Umm dot notation seems to be broken?

0 votes
Kotarlic_ Benjamin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 15, 2024

If anyone is still facing this issue:

Check if your webhook endpoint sends json headers in the response.

After telling my cutom api to send the propper headers ("Content-Type: application/json; charset=utf-8") I could access {{webhookResponse.body.example}}

0 votes
Anthony Purcell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2022

Any acknowledgment from Atlassian that this is an issue? Its not working for me. Does anyone have any docs explain how substringBetween works? I'd like to try that, but the pasted example does not work...

ginxx009 October 11, 2022

substringBetween works only if you've got an array of objects I guess.

Shay Yacobinski October 23, 2022

This worked for me:


{{webhookResponse.body.substringBetween("id\":", ",")}}

It won't work if the key is the last one in the JSON, in which case you'll need to do:


{{webhookResponse.body.substringBetween("id\":", "}")}}

Suggest an answer

Log in or Sign up to answer