Forums

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

How can I send a JSON Object to an Incoming webhook to be able to branch over it?

Alfredo
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 22, 2025

I'm building some automation rules to check some Asset Attributes, an to modify other attributes depending on some values.

The logic I build is the following:

Rule 1)

  • Gets a list of Assets IDs

[Asset-1, Asset-2, Asset-3..]

  • I branch over each Asset-ID, and using Asset API, I send a web request to get its asset attributes, storing a specific attribute into a variable. In this case I store an USER ID attribute.

Asset-1 --> USER ID-1

  • Using Admin API, I send a web request API to check last active data of that specific USER ID.

Asset-1 --> USER ID-1 --> Last active dates of that user ID Json Object

Last active dates has the following format.

{productKey=confluence.ondemand, lastActiveTimestamp=2025-04-21T07:40:21.979864451Z, cloudSiteId=XXXX}, {productKey=jira_addon, lastActiveTimestamp=2025-04-18T10:04:46.620857038Z, cloudSiteId=XXXX}, {productKey=jira-core.ondemand, lastActiveTimestamp=2025-04-21T07:45:45.275296075Z, cloudSiteId=XXXX}, {productKey=jira_platform, lastActiveTimestamp=2025-04-21T15:10:36.658960768Z, cloudSiteId=XXXX},

Until here everything works well.

I get the asset ID, I get the user ID associated to it, and the last active dates of that user ID.

But now I want to loop over that Last Active Dates JSON Object. As Jira does not allow to create a branch within a branch, I created an incoming webhook where I send the Last Active Json Object. I followed this article for dynamic looping. How to create a Dynamic Loop in Automation for Jira

I know I can loop using List in smart values properties, but that option does not solve my need, as I need to filter and to manipulate the data later on.

My problem is the following:

When I build the custom data on the Send Web Request, I don't find the way to send a Json Object. If I follow the article instructions I send text, instead of a Json Object, so I cannot loop over it on the second rule.

Rule 1:

Rule1.png

Rule 1 Send Web Request format:

lastsendwebrequest.png

My problem is here:

How can I define "lastactivedates" to send a Json Object instead of text!

As you can see, I add apostrophe around lastactivedata web response, so it is sent as text, instead of an json object. I know is text because I cannot loop over it on the rule 2 and I can split it or count characters.

Rule 2)

  • It is receiving the data and it should loop over webHookData.field to do the second loop, but it gets text, so no looping.

Rule2.pngRule2Part2.png

If I remove the apostrophes, I get the following error:

 

There was an error when trying to parse the webhook body to JSON (could be due to un-escaped control characters like newlines):

Unexpected character ('d' (code 100)): was expecting double-quote to start field name at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]

 

I hope someone can help me!

Thanks in advance.

2 answers

0 votes
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 22, 2025

Hi @Alfredo -- Welcome to the Atlassian Community!

In your second rule, please try using the function jsonStringToObject() to parse / convert the input:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#jsonStringToObject--

If that does not work, you may need to use other text functions, including match() with regex, to parse and then iterate over the data as a list.

Kind regards,
Bill

0 votes
Alfredo
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 22, 2025

I've seen that @Bill Sheboy is an automation expert. Maybe you could help me a bit with this topic. 

For everyone; If more clarifications or screenshots are needed, don't hesitate to let me know.

Thanks!

Suggest an answer

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

Atlassian Community Events