Setu Recipes: reusable workflows across every app.Browse templates

Integrations / Bitbucket

Bitbucket

Git code hosting from Atlassian: repositories, pull requests and commits on Bitbucket Cloud.

8 actions OAuth 2 5 read3 write Calls api.bitbucket.org

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "bitbucket" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

ScopeWhy it is requested
accountIdentify the connected Bitbucket account
repositoryRead your repositories and commits
pullrequestRead pull requests and comment on them
pullrequest:writeCreate and approve pull requests

Actions

Approve pull requestwritebitbucket.approve_pull_requestApprove a pull request as the connected user. Does not merge it.

Needs scope: pullrequest:write

InputTypeDescription
workspacestringRequiredWorkspace id or slug
repo_slugstringRequiredRepository slug
pull_request_idintegerRequiredPull request id
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bitbucket.approve_pull_request",
  input: {
    "workspace": "<workspace>",
    "repo_slug": "<repo_slug>",
    "pull_request_id": 1
  },
});
Create pull requestwritebitbucket.create_pull_requestOpen a pull request from a source branch into a destination branch (default: the repository's main branch).

Needs scope: pullrequest:write

InputTypeDescription
workspacestringRequiredWorkspace id or slug
repo_slugstringRequiredRepository slug
titlestringRequiredPull request title
source_branchstringRequiredBranch with the changes
destination_branchstringOptionalBranch to merge into; defaults to the main branch
descriptionstringOptionalPull request description
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bitbucket.create_pull_request",
  input: {
    "workspace": "<workspace>",
    "repo_slug": "<repo_slug>",
    "title": "<title>",
    "source_branch": "<source_branch>"
  },
});
Comment on pull requestwritebitbucket.create_pull_request_commentAdd a general comment to a pull request.

Needs scope: pullrequest

InputTypeDescription
workspacestringRequiredWorkspace id or slug
repo_slugstringRequiredRepository slug
pull_request_idintegerRequiredPull request id
textstringRequiredComment text (Markdown)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bitbucket.create_pull_request_comment",
  input: {
    "workspace": "<workspace>",
    "repo_slug": "<repo_slug>",
    "pull_request_id": 1,
    "text": "<text>"
  },
});
Get pull requestreadbitbucket.get_pull_requestGet one pull request by id: title, state, source and destination branches and web URL.

Needs scope: pullrequest

InputTypeDescription
workspacestringRequiredWorkspace id or slug
repo_slugstringRequiredRepository slug
pull_request_idintegerRequiredPull request id
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bitbucket.get_pull_request",
  input: {
    "workspace": "<workspace>",
    "repo_slug": "<repo_slug>",
    "pull_request_id": 1
  },
});
Get repositoryreadbitbucket.get_repositoryGet one repository: full name, privacy, main branch and web URL.

Needs scope: repository

InputTypeDescription
workspacestringRequiredWorkspace id or slug
repo_slugstringRequiredRepository slug
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bitbucket.get_repository",
  input: {
    "workspace": "<workspace>",
    "repo_slug": "<repo_slug>"
  },
});
List commitsreadbitbucket.list_commitsList recent commits in a repository, newest first. Returns hashes and messages.

Needs scope: repository

InputTypeDescription
workspacestringRequiredWorkspace id or slug
repo_slugstringRequiredRepository slug
pagelenintegerOptionalResults per page, up to 100
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bitbucket.list_commits",
  input: {
    "workspace": "<workspace>",
    "repo_slug": "<repo_slug>"
  },
});
List pull requestsreadbitbucket.list_pull_requestsList pull requests in a repository, by default open ones. Returns ids, titles and states.

Needs scope: pullrequest

InputTypeDescription
workspacestringRequiredWorkspace id or slug
repo_slugstringRequiredRepository slug
statestringOptionalFilter by state
pagelenintegerOptionalResults per page, up to 50
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bitbucket.list_pull_requests",
  input: {
    "workspace": "<workspace>",
    "repo_slug": "<repo_slug>"
  },
});
List repositoriesreadbitbucket.list_repositoriesList repositories in a Bitbucket workspace the user can see. Can filter by role or a Bitbucket query string.

Needs scope: repository

InputTypeDescription
workspacestringRequiredWorkspace id or slug
rolestringOptionalOnly repos where the user has this role
qstringOptionalBitbucket query filter, e.g. name ~ "api"
sortstringOptionalField to sort by, e.g. -updated_on
pagelenintegerOptionalResults per page, up to 100
TypeScript
await setu.execute({
  userId: "user_1",
  action: "bitbucket.list_repositories",
  input: {
    "workspace": "<workspace>"
  },
});