Integrations

Bitbucket Cloud

A Bitbucket Cloud integration connects one Bitbucket workspace to Mobius. It lets agents read repositories and pull requests, comment on pull requests, and react to repository events.

Use Bitbucket Cloud when the code your team supports lives in Bitbucket and the agent needs repository context, pull request review, or a comment posted back. Posting a comment is visible to everyone on the pull request, so add an interaction when a human should approve the wording first.

Capability map

CapabilityValue
Provider IDbitbucket_cloud
Auth kindoauth2_user
Connect flowWorkspace OAuth consumer, then browser authorization
ActionsYes
EventsYes
Webhook deliveryYes
Event samplesNo
Live statusYes

Create the OAuth consumer

Bitbucket Cloud has no Mobius app to install. Each workspace creates its own OAuth consumer, which is the credential Mobius uses on your behalf.

In Bitbucket, open Workspace settings > OAuth consumers > Add consumer, then:

  1. Paste the callback URL shown on the Mobius integration page into the consumer's Callback URL field. Bitbucket refuses the connection if this does not match exactly, so copy it rather than typing it.

  2. Grant these permissions:

    GroupPermission
    AccountRead
    Workspace membershipRead
    RepositoriesRead
    Pull requestsWrite
  3. Save the consumer, then copy its Key and Secret.

Connect Bitbucket Cloud

SurfaceSupport
AppOpen Integrations, choose Bitbucket Cloud, enter the workspace slug, the consumer key and secret, and a webhook signing secret, then continue through Bitbucket's authorization screen.
CLIThe mobius CLI does not connect Bitbucket integrations yet. Use the app or API.
APICall POST /v1/integrations/providers/bitbucket_cloud/connect with workspace, client_id, client_secret, and webhook_secret, then send the user to the returned redirect URL.

The workspace slug is the name in your Bitbucket URLs: for https://bitbucket.org/acme/website, the slug is acme.

The webhook signing secret is a password you invent. Save the same value here and in Bitbucket so Mobius can tell real deliveries from forged ones.

Mobius stores the resulting access token and refreshes it before it expires. If the refresh ever fails, the integration is marked expired and you reconnect from the same page.

Receive repository events

Events arrive by webhook, which Bitbucket sends per repository or per project.

In Bitbucket, open the repository's Settings > Webhooks > Add webhook, then:

  1. Paste the webhook URL from the Mobius integration page.
  2. Paste the same signing secret you saved in Mobius into Secret.
  3. Select the repository and pull request triggers you want.

Mobius verifies the signature on every delivery and rejects anything that does not match, so a missing or mismatched secret means no events arrive.

Actions

bitbucket_cloud.pull_request.create_comment
bitbucket_cloud.pull_request.get
bitbucket_cloud.pull_request.list
bitbucket_cloud.pull_request.list_comments
bitbucket_cloud.repo.get
bitbucket_cloud.repo.get_file
bitbucket_cloud.repo.list
bitbucket_cloud.repo.list_branches
bitbucket_cloud.user.current
bitbucket_cloud.user.search

Every action except bitbucket_cloud.pull_request.create_comment only reads. A review agent usually lists the pull request's files and comments, decides, then post one comment at the end.

Events

Bitbucket webhook deliveries become provider events with the bitbucket_cloud. prefix:

bitbucket_cloud.pull_request.approved
bitbucket_cloud.pull_request.comment_created
bitbucket_cloud.pull_request.comment_deleted
bitbucket_cloud.pull_request.comment_updated
bitbucket_cloud.pull_request.created
bitbucket_cloud.pull_request.declined
bitbucket_cloud.pull_request.deleted
bitbucket_cloud.pull_request.merged
bitbucket_cloud.pull_request.unapproved
bitbucket_cloud.pull_request.updated
bitbucket_cloud.repo.push

Use bitbucket_cloud.pull_request.created for review work and bitbucket_cloud.pull_request.comment_created when the agent should answer human discussion. Avoid bitbucket_cloud.* unless every delivery is worth recording.

Next