Hello,
I'm facing a problem with a webhook deployed via add-on json descriptor. I need to receive notifications when JIRA issue is being updated.
I use the following command to start local JIRA:
atlas-run-standalone --product jira --version 7.0.0-OD-01-193 --bundled-plugins com.atlassian.bundles:json-schema-validator-atlassian-bundle:1.0.4,com.atlassian.webhooks:atlassian-webhooks-plugin:2.0.0,com.atlassian.jwt:jwt-plugin:1.2.2,com.atlassian.upm:atlassian-universal-plugin-manager-plugin:2.19.1.2-D20150723T232127,com.atlassian.plugins:atlassian-connect-plugin:1.1.44 --jvmargs -Datlassian.upm.on.demand=true
If I use the following format:
"webhooks": [
{
"event": "jira:issue_updated",
"url": "/jiranotifier.rest"
}
]
Then the request sent to my add-on has empty POST data and 2 fields in query string user_id and admin.
Adding "params" parameter as described on https://developer.atlassian.com/static/connect/docs/1.1.33/modules/common/webhook.html like this:
"webhooks": [
{
"event": "jira:issue_updated",
"url": "/jiranotifier.rest",
"params": {
"issue": "${issue.key}"
}
}
]
doesn't help. The POST data is still empty.
If I try to do something like this:
"webhooks": [
{
"event": "jira:issue_updated",
"url": "/jiranotifier.rest?issue=${issue.key}"
}
]
Then I get exception during deployment of the plugin and the root cause is that the url is not validated as correct URI because of $ sign. If I omit dollar sign, then it complaints about the { sign.
I tried to configure Webhooks in JIRA administration console, and the following syntax was OK:
/jiranotifier.rest?issue=${issue.key}
However, with that approach, the JWT token was not transmitted.
So, how can I describe my add-on in json descriptor so that I'd get key of the JIRA issue that is beeing changed?
Thanks,
Vladimir
Well, I don't fully understand why it works, but I managed to solve it this way in Spring @Controller class:
HttpServletRequest request ... String requestContent = IOUtils.toString(request.getInputStream(), "UTF-8"); JSONObject jo = return new JSONObject(requestContent);
The populated jo object contained all the data that I expected to be POST-ed
Perhaps, JIRA was making a different type of request, not POST or GET...
Vladimir
Have you tried using the Webhook inspector to see what is happening? https://bitbucket.org/atlassianlabs/webhook-inspector
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.