The Slack plugin posts build status messages to your channel. The below pipeline configuration demonstrates simple usage:

pipeline:
  slack:
    image: plugins/slack
    channel: dev
    secretFrom:
      SLACK_WEBHOOK:
        name: slack-webhook-secret-name
        keyRef: webhook

Templating

You can customize the content of the message using the template parameter:

pipeline:
  slack:
    image: plugins/slack
    channel: dev
    link_names: true
    template: >
      {{ if eq (default "success" .DRONE_BUILD_STATUS) "success" }}
        build {{ .DRONE_BUILD_NUMBER }} succeeded. Good job. <@john.doe>
      {{else}}
        build {{ .DRONE_BUILD_NUMBER }} failed. Fix me please. <@channelname> <@someone>
      {{ end }}

Note

Compared to the original Drone Webhook plugin, templates are evaluated one step earlier (by Drone itself), so instead of the original template variables you can use environment variables. Read more about templating here.

Secret Reference

parameter description
SLACK_WEBHOOK incoming webhook url for posting to a channel

Read more how to attach secrets to CI/CD.

Parameter Reference

parameter required description
channel yes messages sent to the above webhook are posted here
recipient no alternatively you can send it to a specific user
username no choose the username this integration will post as
template no overwrite the default message template
image_url no a valid URL to an image file that will be displayed inside a message attachment
icon_url no a valid URL that displays a image to the left of the username
icon_emoji no displays a emoji to the left of the username
link_names no links usernames and channels in the message