user5047085
user5047085

Reputation:

Sending PR id and other info with Bitbucket Cloud webhooks

I am looking at the docs for webhooks for Bitbucket Cloud: https://confluence.atlassian.com/bitbucket/manage-webhooks-735643732.html

I can send a GET request to the url in the url field, but I want to send the commit of the branch that changed, or the PR id, so that I can send a request back to Bitbucket to update Bitbucket's UI. Is there a way to include dynamic values in the url field in the webhooks form?

Upvotes: 0

Views: 388

Answers (1)

user5047085
user5047085

Reputation:

Bitbucket will send the info for you in the request body, not in query params, it looks like this:

 { push: { changes: [ [Object] ] },
  actor: 
   { username: 'ntrs_oleg',
     display_name: 'Foo',
     uuid: '{c0e09bb2-26e-f89afe7b1b2c}',
     links: { self: [Object], html: [Object], avatar: [Object] },
     nickname: 'interos_alex',
     type: 'user',
     account_id: '5cc0db15c66f0ffe44c597' },
  repository: 
   { scm: 'git',
     website: '',
     name: 'jenkins-jobs',
     links: { self: [Object], html: [Object], avatar: [Object] },
     project: 
      { key: 'DEVOPS',
        type: 'project',
        uuid: '{2dc188bd997eaa244d9}',
        links: [Object],
        name: 'devops' },
     full_name: 'interos/jenkins-jobs',
     owner: 
      { username: 'interos',
        display_name: 'Interos',
        type: 'team',
        uuid: '{d4ee7ec3-04fce894572}',
        links: [Object] },
     type: 'repository',
     is_private: true,
     uuid: '{4c6795ff-362eb64d935b9}' } }

Upvotes: 0

Related Questions