Is it possible to create a webhook with httpClient?

Hi,
I am following the instructions on https://developer.atlassian.com/server/jira/platform/webhooks/ for registering a webhook.
I am using the same http client I use for all my other functionality
let httpClient = addon.httpClient(request);
for the sake of it the scopes are
“scopes”: [
“read”,
“write”,
“delete”,
“project_admin”,
“admin”
],
The url is
let webhookurl = hostBaseUrl+ ‘/rest/webhooks/1.0/webhook’;
the json
let webhookjson= {
“name”: “Sprint Webhooks”,
“url”: “/jira-event”,
“events”: [
“sprint_updated”,
“sprint_deleted”
],

and the call:

httpClient.post({

            headers: {
           
                'Authorization': "JWT "+ request.context.token
            },
            url: webhookurl,
            accept: 'application/json',
            json: webhookjson,
            
        },

The response is always 403 (with or without the Authorization header).

What am I doing wrong?

Thanks
Jerry

Hi @jerry.laster,

The documentation you quote is for the Jira Server platform and since you’re posting this in the Jira Cloud category and using JWT for authentication, I’m assuming you’re building a Jira Cloud App.

As such, I suggest you look into defining the webhooks you want to receive in your atlassian-connect.json as documented here:
https://developer.atlassian.com/cloud/jira/platform/modules/webhook/
https://developer.atlassian.com/cloud/jira/platform/webhooks/

Hope I could help!
Tobias

1 Like

This site also lists events for sprint webhooks:
https://developer.atlassian.com/cloud/jira/service-desk/webhooks/

1 Like

Thanks a lot. Yeah. I went the way of setting up the listener on the atlassian-connect config and handling the notifications with routes. Thanks a lot for pointing to the right documentation.