Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Adding Slack webhook CURL command in bitbucket pipeline

Ajay Maurya May 8, 2020

I am planning to add a command to my bitbucket pipeline.

curl -X POST -H 'Content-type: application/json' --data '{"text":"Allow me to reintroduce myself!"}' YOUR_WEBHOOK_URL

How do I do that, if I add this line it shows an error,  guide me with correct steps for this.

2 answers

1 accepted

0 votes
Answer accepted
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 22, 2020

Hi @Ajay Maurya ,

Thank you for your question!

It's a good case to use slack-notify pipe.

script:
  - pipe: atlassian/slack-notify:0.3.5
    variables:
      WEBHOOK_URL: $WEBHOOK_URL
      MESSAGE: 'Allow me to reintroduce myself!'


More useful pipes you can discover on the Bitbucket Pipes Marketplace.

Cheer,
Alex

Ajay Maurya May 23, 2020

Hi @Oleksandr Kyrdan  

Thanks for the help.  
I ended applying the same thing which you mentioned https://bitbucket.org/atlassian/slack-notify/src/master/

I am glad I did it the correct way.
Thanks once again.

1 vote
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 8, 2020

Hi Ajay, welcome to the Community!

I can see this curl command matches what's in Slack's 'hello world' tutorial. There are some prerequisites to sending a notification like this in the guide; an app already needs to be set up in your Slack instance to generate a webhook URL and connect it to a channel.

Are you able to run this curl command locally and receive the message in Slack?

If so, can you post the error you're receiving from the pipeline?

Thanks,
Daniel

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events