Can I send a webhook to JIRA with Automation for JIRA?

andreas
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.
September 19, 2016

I would like to write a simple script that sends a HTTP POST with some extra data (like a version I'm releasing) to JIRA and get JIRA to update some issues as a result of this. Is this possible with Automation for JIRA?

1 answer

1 accepted

1 vote
Answer accepted
andreas
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.
September 19, 2016

One of the many rule components Automation for JIRA offers is the "Incoming webhook trigger":

Project automation - Code Barrel JIRA 2016-09-20 14-01-17.png

An incoming webhook provides a unique URL that anyone can send a HTTP POST to.  No extra authentication is required.  In case the URL ever gets sent to someone that shouldn't have it, it's trivial to generate a new URL, or you can simple disable the automation rule to stop the wrong people from executing your rule.

When you configure an incoming webhook, you can set it up to run a JQL search to find issues, or they can also be provided in the POST body.  The trigger provides a detailed example using curl on how to do this.

In the example above, we search for issues in a "Waiting for Deployment" status.

We can then access additional data that was sent in the HTTP POST body in any field that supports smart-values using the webhookData object.  For example you could use this CURL command to POST a 'releaseVersion' for the trigger above:

curl -X POST -H 'Content-type: application/json' \
 --data '{"data": {"releaseVersion":"5.3.2"}}' \
 https://automation.codebarrel.io/pro/hooks/9b49ead1assshhsecretc2d

This would then add a comment with "Issue released as 5.3.2" to any issue matching the JQL and set their status to "Done".

Incoming webhooks are incredibly useful when you're writing a quick script and want to interact with JIRA and perform some complex operations on a set of issues.

Alfredo Palacios April 15, 2021

What about if I want to send that extra data right from url webhook, like: 

?issue=Test-1&data[bid]=hello

I tried many different forms but no one works if then I want to use webhookData.bid to get the value Hello 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events