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

How to develop a webhook in bitbucket server

Javier Perez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 21, 2019

I need to develop a webhook in bitbucket server which would fire when a pull request task is checked/unchecked (since this webhook type is not provided out of the box)

Does anybody know of any documentation/tutorial/code example I could use to start this project with?

Please, don't answer with already available apps, even if they're free.

1 answer

0 votes
Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2019

Hi @Javier Perez,

You might want to start here: https://confluence.atlassian.com/bitbucketserver/managing-webhooks-in-bitbucket-server-938025878.html

It looks as thought the documentation outlines what you are looking for in the creating & trigger webhooks sections.

I hope that helps!

-Jimmy

Javier Perez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 21, 2019

That documentation would be instructions on how to set webhooks on out of the box provided events, which are

Pull request events

  • Opened
  • Approved
  • Unapproved
  • Needs work
  • Merged
  • Declined
  • Deleted
  • Comment added
  • Comment edited
  • Comment deleted

There is no pull request task checked/unchecked event in the list.

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 22, 2019

Could you please provide a bit more information about what events you are trying to capture when you say checked/unchecked as it relates to a pull request?

Javier Perez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2019

Jimmy,

See the screen-shot below. The webhook I intend would trigger when the check box Sanity Passed changed state (checked<->unchecked which would result in the task state transition OPEN<->RESOLVED)

taskCheckBox.png

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 23, 2019

Hi @Javier Perez,

Ok now I understand what you are trying/wanting to accomplish.  I think where you are going to need to start is in the Java API since it looks like you are going to want/need to create a new event to trigger and specifically you will want to look at the PullRequestEvent Class: https://docs.atlassian.com/bitbucket-server/javadoc/6.7.1/api/com/atlassian/bitbucket/event/pull/PullRequestEvent.html

From there you will want call the new event you have created anytime you check/uncheck the checkbox you have added to the pull request comment.

I hope that helps as a starting point.

-Jimmy

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events