Custom data in Automation incoming webhook webResponse.body
Asked by Fede B.:

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


Answers:
author: Bill Sheboy
body: Hi [@Fede B.](/t5/user/viewprofilepage/user-id/5491099)

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

comments: author: Fede B.
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

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.


author: Bill Sheboy
body: 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>


author: Fede B.
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313),

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...


Tags: automation

cloud

jira-cloud

smart-value

webhook