Sending a notification to Slack
Connect your Codefresh pipelines to Slack
There are many ways to integrate slack with Codefresh
- You can use the global slack integration
- You can use individual pipeline plugins such slack-message-sender and slack-notifier
- You use can simple POST requests with Curl (explained in this page)
Custom webhook to Slack
Use a container image with a freestyle step such as byrnedo/alpine-curl
to send a notification to a Slack channel.
- Get the
${{SLACK_WEB_URL}}
and put it in the Environment Variables or use shared configuration
You can find how to integrate with slack here https://api.slack.com/incoming-webhooks
- Add the following step to your
codefresh.yml
:
slack step
slack_notify:
image: byrnedo/alpine-curl # curlimages/curl, or any other curl image
commands:
- curl -X POST --data-urlencode 'payload={"text":"Test slack integration via yaml"}' ${{SLACK_WEB_URL}}