Bitbucket

Send Bitbucket Cloud repository events to Telegram.

Add the webhook

In your repository open Repository settings โ†’ Webhooks โ†’ Add webhook and fill the form:

Field Value
Title Any name, for example Thook
URL https://thook.altr.dev/hooks/bitbucket/{unique_path}
Secret The secret key from the bot
Status Active
Triggers Choose from a full list of triggers, then pick the ones below

Bitbucket does not show the secret again after you save the webhook. Save, then open the webhook and use View requests: a 202 means it works.

Supported events

  • Push, including the creation and the deletion of branches and tags
  • Fork
  • Build status created and build status updated: the result of Bitbucket Pipelines and of the other CI tools that report on a commit
  • Pull requests: created, updated, approved, approval removed, changes requested, change request removed, merged, declined, and comments (created, updated, deleted)
  • Issues: created, updated and comment created, when the issue tracker is on

You choose the events: Thook shows the ones the webhook sends. Other events are accepted and ignored.

What you get

The title tells the event, then the details, who did it and a link to the event as the last line. The meaning of the icons is in the quick start.

๐Ÿ“ฃ Push ยท Bitbucket

๐Ÿ“ฆ workspace/app ยท main
๐Ÿ“” 2 commits
โ€ข Fix the start message
โ€ข Add tests

๐Ÿ‘ค Alice

View push
๐ŸŸข Build passed ยท Bitbucket

๐Ÿ“ฆ workspace/app
๐Ÿ“” 709d658
โš™๏ธ Unit Tests ยท ๐Ÿ•’ 1m 5s

๐Ÿ‘ค Alice

View build
๐ŸŸฃ Pull request merged ยท Bitbucket

๐Ÿ“ฆ workspace/app
๐Ÿ“ฐ #7 Add rate limiting
๐ŸŒฟ feat/rate-limit โ†’ main

๐Ÿ‘ค Bob

Open PR

A few things are different from the other services:

  • Bitbucket lists up to 5 commits of a push and does not say how many there are in total: when there are more the message says 5+ commits.
  • The status of a build is not tied to a branch, the message shows the commit instead.
  • A build is one message that updates from running to the result, and the result is a new message: see Workflows, pipelines and deploys.

Troubleshooting

  • 401 in View requests: the Secret is different from the one in the bot message. Bitbucket does not show it after saving, so edit the webhook and type it again.
  • Nothing arrives but the status is 202: the event is not in the list above.
  • Redeliver: Bitbucket keeps the requests of the last days in View requests, with the option to send them again.