Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger bitbucket on pull requyest comment

Kamil Walo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 19, 2025
I am trying to set up automated pipeline triggers in Bitbucket by commenting on a pull request. The goal is to write a specific comment, e.g., "//deploy" on bitbucket comment, and have it trigger a pipeline on bitbucket.
Similar functionality exists in GitHub Actions and Azure DevOps — they support triggering workflows or pipelines via commenting (for example, through webhooks or built-in integrations).

My question is: is there a way to achieve this in Bitbucket? I know that Bitbucket supports webhooks that can be sent when a new comment is created. But how can I leverage this webhook to trigger a pipeline automatically — specifically, how can I configure Bitbucket to send the webhook into itself or otherwise trigger the pipeline based on a comment?

I’ve tried using the API endpoint like this:

https://api.bitbucket.org/2.0/repositories/kamil/test/pipelines/?target=%7B%22target%22%3A%7B%22ref_type%22%3A%22branch%22%2C%22type%22%3A%22pipeline_ref_target%22%2C%22ref_name%22%3A%22main%22%7D%7D

but it doesn’t work

 

this one does work but I cannot add body to webhook on 

Repository -> repository settings -> Webhooks

 

curl -X POST  \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  -d '
  {
    "target": {
      "ref_type": "branch",
      "type": "pipeline_ref_target",
      "ref_name": "main"
    }
  }'

Any guidance on how to set this up? Thanks!

1 answer

1 vote
Saxea _Flowie_
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.
September 21, 2025

Hi @Kamil Walo

You need to send the webhook to a 'service' that will process and call the API.

You can't do:

   Webhook -> Pipeline

You need a 'service' in between.

   Webhook -> Service -> Pipeline

This 'service' can be a Bitbucket app, or any HTTP service you deploy that is reachable by Bitbucket.

The closest to 'send the webhook into itself' is to use a Forge app. You can build your own custom app, or use a third party app that already does what you need. 

We provide a Bitbucket app, Flowie, that might be useful to what you are trying to achieve. We support triggering pipelines in different ways. Comments are not supported yet, but you can reach to support and depending on your needs we might be able to add it for you.

We have customers that deploy/undeploy to different envs, using labels for instance.

If you need help building your own app, you might try posting your question in the Developer Community too.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events