# Add support for Bitbucket Server webhook format

**URL:** <https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25>\
**Category:** Released\
**Tags:** contrib-this-feature, released\
**Created:** [December 28, 2016, 5:41pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25 "2016-12-28T17:41:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [December 28, 2016, 5:41pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/1 "2016-12-28T17:41:36Z")

</div>

Currently you cannot setup a webhook with Bitbucket Server, even though you have support for [Bitbucket.org](http://Bitbucket.org), which creates an issue when trying to get builds to trigger after a push to a repository.

\_Original request: [Issues · bitrise-io/bitrise.io · GitHub](https://github.com/bitrise-io/bitrise.io/issues/50_)

\_\_Adding support to Bitbucket Server can be contributed to our open source Webhook processor: [https://github.com/bitrise-io/bitrise-webhooks\_\_](https://github.com/bitrise-io/bitrise-webhooks__)

Once added (and accepted) there, it will just work.  
**If anyone have the time to implement it, we’d be glad to review & merge it** , the `README` of the repository should cover every step required for developing the change, and you can even run your own version of the webhook server.

Right now we don’t have access to a Bitbucket Server instance, but if anyone can help us, either by letting us use one or to test a couple of things with us, we can also schedule to work on this.

---

<div class="post-metadata">

**Author:** ![jdeitchler](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@jdeitchler](https://discuss.bitrise.io/u/jdeitchler)\
**Post date:** [January 4, 2017, 5:08pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/3 "2017-01-04T17:08:51Z")

</div>

Has anyone found out how to use Bitbucket server Hook to call into Bitrise?

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 4, 2017, 8:49pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/4 "2017-01-04T20:49:44Z")

</div>

Hi @jdeitchler !

> [@viktorbenei](#):
>
> Currently you cannot setup a webhook with Bitbucket Server

> [@viktorbenei](#):
>
> Adding support to Bitbucket Server can be contributed to our open source Webhook processor: [GitHub - bitrise-io/bitrise-webhooks: Bitrise Webhooks processor](https://github.com/bitrise-io/bitrise-webhooks)

> [@viktorbenei](#):
>
> Once added (and accepted) there, it will just work.

So, not supported right now, but can be contributed by anyone, following the README here: [GitHub - bitrise-io/bitrise-webhooks: Bitrise Webhooks processor](https://github.com/bitrise-io/bitrise-webhooks)

We’d be happy to help too, if you have a question during the contribution 😉

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [November 17, 2017, 2:45pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/5 "2017-11-17T14:45:21Z")

</div>

It seems the recent [Bitbucket Server v5.4](https://confluence.atlassian.com/bitbucketserver/bitbucket-server-5-4-release-notes-935388966.html) added support for the Bitbucket V2 webhook support, the one we support for [Bitbucket.org](http://Bitbucket.org), but there’s a minor difference:

> <https://github.com/bitrise-io/bitrise-webhooks/issues/65>
>
> Hi,
> 
> Looks like the \[BitBucket Event Payloads\](https://confluence.atlassian.co…m/bitbucket/event-payloads-740262817.html) documentation is not completely accurate for BitBucket Server (non Cloud). The \`X-Attempt-Number\` is actually never sent. Would it be possible to apply a default value instead of an error \[here\](https://github.com/bitrise-io/bitrise-webhooks/blob/e244cb1707ba4b4e065045170ae0c15e4950c4a0/service/hook/bitbucketv2/bitbucketv2.go#L123)?
> 
> BitBucket Server Version: v5.5.1 (latest).
> 
> \<img width="807" alt="bildschirmfoto 2017-11-17 um 10 34 48" src="https://user-images.githubusercontent.com/2149883/32940614-6d48a13e-cb83-11e7-965b-24ae3f92638f.png"\>

If anyone has some time before we could work on that, PRs are welcome 😉

---

<div class="post-metadata">

**Author:** ![MartinStraub](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/martinstraub/32/3113_2.png) [@MartinStraub](https://discuss.bitrise.io/u/MartinStraub)\
**Post date:** [February 26, 2018, 1:59pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/6 "2018-02-26T13:59:01Z")

</div>

Seems to be not yet working. Tried to setup webhooks with BitBucket Server but only get a code 400 response  
`{"error":"Failed to transform the webhook: Content-Type is not supported: application/json; charset=UTF-8"}`  
☹

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 1, 2018, 8:27pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/7 "2018-03-01T20:27:33Z")

</div>

Two things @MartinStraub:

1. Please make sure that you use the Bitbucket **Server** specific webhook endpoint, as Bitbucket Server has a completely different webhook format compared to [bitbucket.org](http://bitbucket.org) .
  - For Bitbucket Server you should use the `/h/bitbucket-server/BITRISE-APP-SLUG/BITRISE-APP-API-TOKEN` format, instead of the `/h/bitbucket-v2/BITRISE-APP-SLUG/BITRISE-APP-API-TOKEN` which is [bitbucket.org](http://bitbucket.org) specific (simply replace `bitbucket-v2` with `bitbucket-server`).
  - You can find more info in the webhook handler (open source) server’s repo at: [https://github.com/bitrise-io/bitrise-webhooks](https://github.com/bitrise-io/bitrise-webhooks)

2. If you did not push any code yet, just registered the webhook in Bitbucket Server, then it might also be that Bitbucket Server just sent a “ping” webhook, which has once again a different format (see: [https://github.com/bitrise-io/bitrise-webhooks/issues/72](https://github.com/bitrise-io/bitrise-webhooks/issues/72) ). If you registered the right endpoint (the `/h/bitbucket-server` one) try to push a code change, that should work! 😉

---

<div class="post-metadata">

**Author:** ![MartinStraub](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/martinstraub/32/3113_2.png) [@MartinStraub](https://discuss.bitrise.io/u/MartinStraub)\
**Post date:** [March 5, 2018, 7:41am UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/8 "2018-03-05T07:41:57Z")

</div>

I already figured this out, together with your support.

Problem was 1., using the wrong url. But unfortunately, when you select BitBucket from the apps -\> code -\> incoming webhooks dropdown, you get the BitBucket cloud url. It’s a bit confusing as the dropdown lacks a specific BitBucket Server option and also doesn’t say [BitBucket.org](http://BitBucket.org) or cloud or something do differentiate it from the Server.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 5, 2018, 12:45pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/9 "2018-03-05T12:45:13Z")

</div>

Definitely makes sense - we created an internal bug report for this & linked this thread for context 😉

---

<div class="post-metadata">

**Author:** ![gergelybekesi](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/gergelybekesi/32/1321_2.png) [@gergelybekesi](https://discuss.bitrise.io/u/gergelybekesi)\
**Post date:** [March 9, 2018, 3:20pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/10 "2018-03-09T15:20:08Z")

</div>

Hello @MartinStraub,

Thank you for the issue report again, the fix is now released, so you can select Bitbucket Server from the webhook list on the _Code_ tab of the application:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/d/da3dbf336377683f2c142295c7a00bb7cf33f0eb.png)

Happy building 🏠 😉

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 25, 2018, 4:00pm UTC](https://discuss.bitrise.io/t/add-support-for-bitbucket-server-webhook-format/25/11 "2018-03-25T16:00:00Z")

</div>

Closed on March 25, 2018, 4:00pm UTC

This topic was automatically closed after 14 days. New replies are no longer allowed.
