Can I create a bot that will trigger some external event if a word is mentioned in a comment?

Kevin Gilmore March 23, 2022

I want to be able to monitor in Pull Requests if a particular word or phrase is mentioned in the comment section.

 

So the flow would go like;

1. create PR

2. mention phrase in comment for example "trigger xyz"

3. Request made to external service with body of xyz

 

Thanks!

2 answers

1 accepted

2 votes
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 23, 2022

Hi @Kevin Gilmore,

Welcome to Atlassian Community!

You could do this by using a webhook that triggers when a comment is created in a PR. Have a look at Manage webhooks for more information.

Aron Gombas
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.
March 24, 2022

Oh, wow, I didn't know about this. It looks easier than the approach I suggested. 

But, can you check for the keyword "trigger" and parse out "xyz" with this approach? (Maybe Kevin can handle this on the external service's side, if it cannot be done on the Bitbucket side...)

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 24, 2022

The webhook will only trigger based on the event, you would still have to configure your external script to parse the comment for what you are looking for.

Kevin Gilmore April 6, 2022

This is just what I was looking for. Thanks

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 23, 2022

I don't think you can do this in the Bitbucket side, but if your pull requests are normally related to Jira issues, then you can definitely create an automation rule on the Jira side!

For exampe, you can create a rule with the trigger Issue commented, then check the comment text for the keyword "trigger" using the Advance Compare Condition, finally send the request to the external system using the Webhook action. It'd definitely work.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events