How to secret while creating Webhook?

Hi,

I’m using the cloud id url rest api to register webhooks https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-webhooks/#api-rest-api-3-webhook-post. I want to use jqlFilter and set secret so I can verify signature when receive events. How to do that? Here’s my current code:

response = @connection.post('rest/api/3/webhook') do |req|

        req.headers['Content-Type'] = 'application/json'

        req.body = {

           name: 'Integration Webhook',

           description: 'Integration Webhook',

           url: webhook_url,

           webhooks: [

             {

              "jqlFilter": 'labels = testfish',

              "events": events

            }
          ],

          secret: 'my_secret',

          excludeBody: false

        }.to_json
end

Webhook does get created but I’m not receiving HTTP_X_HUB_SIGNATURE in events meaning it’s set. Right?

Kindly guide how to set and verify it.

Thanks

1 Like