How can I mention someone using slack notification from bitbucket pipeline

John Michael Flores September 4, 2022
how to send slack notification mentioning someone?

 -
step:
        name: Send Notification to Slack
        script:
          - pipe: atlassian/slack-notify:2.0.0
            variables:
              WEBHOOK_URL: 'CLASSIFIED'
              MESSAGE: '$(cat error_message.txt; printf [CLASSIFIED/$(cat folder_name.txt)/index.html] @[Someone]'

1 answer

1 accepted

2 votes
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 5, 2022

Hey @John Michael Flores 

Welcome to the community!

I did some search and found that you'll need to use 'memberID' when you want to mention someone from the Slack webhook.

For example, I have a user name Syahrul with 'memberID' of 'U88271KS', I'll pass this in the message as the following example:

          script:
            - echo "Notify someone in Slack"
            - pipe: atlassian/slack-notify:2.0.0
              variables:
                  WEBHOOK_URL: '<Webhook>'
                  MESSAGE: 'Hey <@U88271KS>' 

This create @Syahrul notification in my Slack test channel as expected. You can check the guide  here to find the Slack 'memberID'.

Cheers,
Syahrul

John Michael Flores September 6, 2022

Thanks for the answer, how can I BOLD the message?

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 7, 2022

Hey @John Michael Flores 

If you looking into formatting your Slack message, I would suggest you check the Slack API formatting page below:

https://api.slack.com/reference/surfaces/formatting#visual-styles

That said, you can use *BOLD* in your message to bold a text message.

Cheers,
Syahrul

Like John Michael Flores likes this
John Michael Flores September 7, 2022

Thank you

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events