Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation Inbound webhook with custom data

Alfredo Palacios April 13, 2021

Hello, I try to use an inbound webhook to send a custom param and update a custom field in issues. All done right from the url, so far this is the url that I guess should be use but not working at the moment: 

https://mywebhookurl?issue=test1&data[customParam]=customValue

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 15, 2021

Hi Alfredo,

I understand that you are trying to update an issue in Jira Cloud by sending Jira a webhook from another application.

Are you using automation in Jira Cloud to do this?  Because I think this way is easier to setup for changes like this.  More details on this are in https://support.atlassian.com/jira-software-cloud/docs/automation-triggers/#Automationtriggers-Incomingwebhook

It could also be possible to have your incoming webhook hit to a specific REST API endpoint, this is more complex to setup because you then have to manage authentication for the request.

But I think using automation to do this is a better way to set this up.  Automation can also then be used to edit the issue and pass in one of the values from the webhook payload.

Try this and let me know if you run into any problems with this approach.

Andy

Alfredo Palacios April 15, 2021

I'm using Automation but I have a custom field in my issues and want to pass data that also modify the custom field

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 16, 2021

Ah, thanks for clarifying.  While you can specify the issuekey in the URL as a path parameter (such as https://url/endpoint?issue=ABC-456), the problem with your approach here is that the other value that you want to change cannot be passed in the path parameter (as part of the URL itself).  But, you should still be able to pass that as a value in the body of the json payload.

For example, I have a custom number field in my instance called 'number1', and I can call the webhook in a format such as:

curl -X POST -H 'Content-type: application/json' \
"https://automation.atlassian.com/pro/hooks/[redactedId]?issue=SCRUM-13" \
--data '{"data": {"number1":787}}'

In this case, my issuekey is SCRUM-13.  From there you can setup an automation rule to set that field and use the json payload to look for that value.  This would look like this:

Screen Shot 2021-04-16 at 10.42.13 AM.png

This is one way that you can set a custom field value via the webhook.  The limitation here though is that you have to define the custom field that is being updated in the automation rule, and name the specific customfield in the {{webhookData}} object.  In my example I did that with a smart value of {{webhookData.number1}} to set that custom field.  I have not found a clear way yet to define both the custom field and that custom field's value using the automation incoming webhook.

If that aspect is important to you here, say because you want to set lots of different field values at the same time in a single call, then I think the better approach will be to look into calling the REST API with a webhook instead.  The payload will be a bit more complex, and we would have to deal with a means to authenticate here, which can be done, but adds an aspect of security best practices to address.  Most often users that use webhooks to call the REST API will choose Basic auth and use a token to be able to make such calls.

I hope this helps.

Andy

Suggest an answer

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

Atlassian Community Events