google chat integration
Asked by Abdulrahman alabdullah:

Hi

I have a problem with sending the status of the pipeline and branch that trigger the pipeline to Google Chat using the curl command and using webhook from Google Chat

the message received in Google chat like this   
"Pipeline has finished for branch: ${BITBUCKET_BRANCH} with status: ${BITBUCKET_BUILD_STATUS} "

and the pipeline is like this  
after-script:  
- \>  
curl -X POST -H "Content-Type: application/json" -d '{  
"text": "Pipeline has finished for branch: ${BITBUCKET_BRANCH} with status: ${BITBUCKET_BUILD_STATUS}"  
}' ${GOOGLE_CHAT_WEBHOOK_URL}  

<br />

<br />

another issue I am trying to use the bitbucket for Google chat   
after connecting and trying to select the repository I get this error  
Could not load dialog. Invalid response returned by app


Answers:
author: Theodora Boudale
body: Hi Abdulrahman and welcome to the community!

You mention in your post that you are facing two issues.

For the first issue with the curl command in the pipeline, could you please let us know:

* What is the output of the curl command when you run it in Pipelines?  

* Are you able to run this command successfully locally, from your computer, if you replace the variable names (BITBUCKET_BRANCH, BITBUCKET_BUILD_STATUS, GOOGLE_CHAT_WEBHOOK_URL) with their respective values?

Regarding the second issue:
> another issue I am trying to use the bitbucket for Google chat   
> after connecting and trying to select the repository I get this error   
> Could not load dialog. Invalid response returned by app

It is not clear which screen gives you this error.

* Are you using one of the apps listed on the link below and if so, which one? If not, can you provide a link of the app you are using  

  [https://marketplace.atlassian.com/search?hosting=cloud\&product=bitbucket\&query=google%20chat](https://marketplace.atlassian.com/search?hosting=cloud&product=bitbucket&query=google%20chat)  

* Could you please provide the exact steps you follow after installing the app and a screenshot that shows the error?

Please keep in mind that if the error comes from a third-party app, you will need to reach out to the app's vendor for support. I am asking for the above details so I can better understand where the error is coming from and which app you are using, and advise you on the next steps.

Kind regards,  
Theodora

comments: author: Abdulrahman alabdullah
body: Dear Theodora,

Thank you for your warm welcome and for your assistance with the issues I've been encountering.

Regarding the first issue with the curl command in the pipeline, I'm pleased to inform you that I managed to resolve it. The solution involved modifying the parameters of the curl command. Here's the revised command that effectively relayed the required information to my Google Chat space:  
curl -d "{\\"text\\": \\"Build started for branch: $BITUCKET_BRANCH, repository: $BITBUCKT_REPO_SLUG\\"}  

This adjustment ensured the accurate display of the branch and repository details in Google Chat.

Moving on to the second issue concerning the Bitbucket integration with Google Chat, I confirm that I am using the following app from the Atlassian Marketplace: [Google Chat App for Bitbucket](https://marketplace.atlassian.com/apps/1232541/google-chat-app-for-bitbucket?hosting=cloud&tab=overview).  

The error occurs when I attempt to add a repository using this app. Specifically, after installing the app and navigating to the 'Add Repository' option, an error message stating "Could not load dialog. Invalid response returned by app" appears. Below is a screenshot depicting the exact moment the error is encountered:

I hope this information helps in diagnosing the issue further. I understand that if the problem stems from the third-party app, I may need to contact the app's vendor for support. However, any guidance or suggestions you could offer based on this situation would be greatly appreciated.

Thank you once again for your support and guidance.

Kind regards,

Abdulrahman

<br />

<br />

![Screenshot from 2023-12-11 15-12-49.png](https://community.atlassian.com/t5/image/serverpage/image-id/296182i70D79A20561033C3/image-size/large?v=v2&px=999 "Screenshot from 2023-12-11 15-12-49.png")![Screenshot from 2023-12-11 15-19-11.png](https://community.atlassian.com/t5/image/serverpage/image-id/296181i36F2F08AF696F0CD/image-size/large?v=v2&px=999 "Screenshot from 2023-12-11 15-19-11.png")![Screenshot from 2023-12-11 15-25-23.png](https://community.atlassian.com/t5/image/serverpage/image-id/296180iD56CEA664345C966/image-size/large?v=v2&px=999 "Screenshot from 2023-12-11 15-25-23.png")


author: Theodora Boudale
body: Hi Abdulrahman,

Thank you for the update and info, it's good to hear that you resolved the issue with the curl command!

I tried installing the app you linked on my workspace, but I don't see any option to add a repository there. Additionally, the screenshot you posted doesn't seem to be from Bitbucket Cloud. Is this screenshot from the Apps in your Google workspace or Google Chat?

I see in the app's description that an installation of this app <https://workspace.google.com/marketplace/app/bitbucket_for_google_chat/313395291201> is also needed in Google Chat. If this is the app that is showing you this error, please check the **Support** resources on the app's page to request assistance. This second app is not developed by Atlassian and it is not even installed on Bitbucket side, so we don't have any knowledge of how it works and what are the possible reasons for this error.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud