Good afternoon!
Can you please tell me if there is any way to send a message to Slack with the mention (@USERNAME) of a specific user?
The goal is to be able to send a message to the person in Slack who initiated the launch of the pipeline. This will perform a condition check at the end. For example:
- step: Some-step-name
name: Some name
script:
- ...
- if [ "$CHECK_ERRPR" != '"ERROR"' ]; then exit 0 ; fi
- pipe: atlassian/slack-notify:2.3.0 variables: WEBHOOK_URL: $WEBHOOK_URL MESSAGE: '"[${ENVIRONMENT_NAME}] problem with something"'
I'd like to understand how when Bitbucket and Slack connect, messages can notify certain users, and I can't figure out how to identify user data (email for example) in the Bitbucket API with which I could identify the same user in Slack and get their ID using the Slack API.
Hey @Andrei Hryharouski !
There is a dedicated app for Bitbucket Pipelines management within Slack: https://actioner.com/app-directory/bitbucket-pipelines-15
It's fully customisable, too, with a generous free plan. Let me know in case you have any questions about this solution.
Regards,
Emel
G'day @Andrei Hryharouski
That's an interesting use case of slack pipe notification. I believe you can use the default variable we have to fetch the user that triggers the pipeline build UUID:
https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/
BITBUCKET_STEP_TRIGGERER_UUID |
The person who kicked off the build ( by doing a push, merge etc), and for scheduled builds, the uuid of the pipelines user. |
Using the UUID you can fetch the user information via the following API endpoint:
You should get results of the user display_name that you can use with Slack API to mention the user. I can't help much on the Slack API end, but I believe you could create a script that fetches a user display name and matches it to get the user Slack ID stores it as variables, and uses it in the Slack pipe message notifications for example:
script: - echo "Notify someone in Slack" - pipe: atlassian/slack-notify:2.3.0 variables: WEBHOOK_URL: '<Webhook>' MESSAGE: 'Hey <@$slackID>'
Regards,
Syahrul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.