Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use smartvalues for webhooks in XML

Laura Guzman April 6, 2021

Hi,

I'm using Jira automation with Incoming Webhook as trigger. I'm pretty sure the incoming webhook comes in XML format, and I'm noticing I'm not able to access the webhook data using smart values. Is it because the webhook data can only be accessed using dot notation if its a Json object? I believe I read this somewhere and wanted to make sure this is the case. If so, how can I handle the XML data to be posted on Jira issue fields?

 

Cheers,

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 6, 2021

Hi @Laura Guzman 

That feature idea is in the backlog: https://codebarrel.atlassian.net/browse/AUT-193

Until that is implemented, I believe you would need to rely upon the string functions, including regular expressions, to get your data.

Best regards,

Bill

0 votes
Vijay Byndoor August 5, 2023

Hi Laura, Bill,

I am exactly at this point. 
I am using a A4J webhook request to make a SOAP call.  (Essentially, SOAP is just a webrequest over HTTP with specific headers).
The webrequest to a SOAP endpoint is successful, I see the response when I test validate it.
But I am unable to retrieve results from it.

As the above thread mentions, {{webhookData}} and parsing it is only supported for JSON response payloads. 
But the data is there, how do I use string functions or anything else to retrieve it?
I am ok to use scriptrunner or anything else

using script runner and any of the below code does not give me any result - 

//def wdata = ruleContext.renderSmartValues('{{webhookData}}')
def wresponse = ruleContext.renderSmartValues('{{webhookResponse}}')
addMessage(wresponse)
addMessage(wresponse.toString())
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2023

Hi @Vijay Byndoor 

First thing: I recommend creating a new question for this.  Otherwise only the people following this old thread will see it.  When you do that, please post images of your complete rule, the audit log details, explain what is not working as expected, and link back to this thread.  Thanks!

Back to your question...

The response from a rule's web request is a JSON, text string.  That can be processed using text functions and iterators.  When you need to do more, you can split apart text values and then use conversions, such as asNumber, toDate, etc.

Kind regards,
Bill

Vijay Byndoor August 7, 2023

Hi Bill, 
Thank you so much for your response.
I will create a new ticket and hope that you can take a look.  (I see that you are close to this subject)

Regarding your answer above, 
There is one change in my case, the response from my rule's web request is an XML, text string, and not JSON.  This is because I am calling a legacy SOAP web service. This part is working for me. 
I am unable to parse the XML/Text response

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 8, 2023

Thanks, Vijay.  I believe you can still use the text functions to parse the message as it is composed of text, even though the specific format is XML.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events