Forums

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

Custom data in Automation incoming webhook webResponse.body

Fede B.
Contributor
June 27, 2024

Hi all,

I've created a library of useful Automation rules, that can be called from other rules as incoming webhook, using the "Web Request" component.

Is it possible to insert a custom value in the webResponse body of the library rule?

E.g. (just a silly example):

- Let's imagine I create a "library" incoming webhook rule, which takes the current day and calculates the 1st day of next month

- From another rule, I call the first one using Web Request

- Is it possible for the first rule to return to the second rule, in the webResponse, the calculated day?

 

I mean: without having to store the value in an issue field or comment or similar action.

A typical webResponse includes:

WebhookResponseBean{status=200, statusCategory=SUCCESS, headers={Connection=[keep-alive], Content-Length=[0], Content-Type=[application/json], Date=[Thu, 27 Jun 2024 08:17:51 GMT], Strict-Transport-Security=, [...] body=}

, but for my incoming webHook the body value is always empty.

 

Best regards,

Federico

1 answer

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.
June 27, 2024

Hi @Fede B. 

Without seeing your rule specifics, I believe that is possible.  For examples showing custom data usage, please see this article on calling the Jira REST API endpoints from a rule using the Send Web Request action:

https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

 

Please note well: again without knowing the specifics of your rules...if your rules use any form of looping (e.g., branching or callbacks with webhooks) that might be detected as looping and so hit the looping service limit.  The specifics of how that limit is detected are not documented well: https://support.atlassian.com/cloud-automation/docs/automation-service-limits/

 

Kind regards,
Bill

Fede B.
Contributor
July 11, 2024

Hi @Bill Sheboy

 

Thanks for your answer.

Unfortunately, that article only explains how to access a webResponse using the json notation, e.g. webResponse.body.name.

As far as I understood until now, Automation rules of type "Incoming webhook" do not allow to customise the response they return, so this leaves me with the only (bad) solution of writing the "1st day of next month" value in some jira custom field.

In Jira DC I could have replaced the second automation with a ScriptRunner REST endpoint with a customised response, but in Cloud we don't have this option either.

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.
July 11, 2024

Please this article on a dynamically looping rule using an incoming webhook trigger for an example of passing and consuming custom data:

https://community.atlassian.com/t5/Jira-Service-Management-articles/How-to-create-dynamic-looping-in-Automation-for-Jira/ba-p/2293077

 

Fede B.
Contributor
July 19, 2024

Hi @Bill Sheboy,

 

Very interesting article, thanks for sharing it. I got more or less to the same conclusion when writing 'cascade'web request/incoming webhook rules. I found out it was easier to call the rule itself, instead of duplicating it.

 

But still it doesn't provide a way to customise the response body of an incoming webhook rule... 

Suggest an answer

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

Atlassian Community Events