Sending a notification to Slack

Connect your Codefresh pipelines to Slack

There are many ways to integrate slack with Codefresh

  1. You can use the global slack integration
  2. You can use individual pipeline plugins such slack-message-sender and slack-notifier
  3. 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.

  1. 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

  1. 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}}