Skip to main content

Slack Notify Step

This topic describes the settings for the Slack Notify step available in Continuous Delivery (CD) and custom stages.

The Slack Notify step lets you easily send notifications to slack channel and slack threads during a pipeline execution.

Step-by-Step Guide

note

The Slack Notify step can be added in any stage, but it is only available within a step group.

Types of Recipients Supported:

  • Email: The email address associated with the Slack account. This can be used to send notifications to a specific recipient.
  • Channel: The channel where the notification is to be sent. Provide the channel-id of the channel.

Types of Messages Supported:

  • Message: A plain text format. This can be a fixed value, runtime input, or an expression.
  • Block: You can send Slack Block notifications. Ensure that the block is enclosed in an array. For more information on Slack Blocks, refer to Slack documentation.
Sample Block Message
[{
"type": "header",
"text": {
"type": "plain_text",
"text": "This is a Header block"
}
}]

This block will send the notification This is a Header block in heading 1 format to the recipient.

Sending Notifications to a Specific Thread in a Channel

To send notifications to a specific thread, provide the thread_ts details under Thread. For more information on how to get thread_ts details, refer to Slack documentation

YAML example

Sample YAML describing the Slack Notify Step
stages:
- stage:
name: slack-step
identifier: slack-step
description: ""
type: Custom
spec:
execution:
steps:
- stepGroup:
name: container
identifier: container
steps:
- step:
type: SlackNotify
name: SlackNotify_1
identifier: SlackNotify_1
spec:
channel: CHANNEL_ID
messageContent: <+input>
token: SLACK_TOKEN
threadTs: THREAD_ID
stepGroupInfra:
type: KubernetesDirect
spec:
connectorRef: KUBERNETES_DELEGATE
namespace: NAMESPACE
rollbackSteps: []
serviceDependencies: []
tags: {}

Upon a successful pipeline run, the message you configured in the Slack Notify step will be sent to the designated Slack channel or recipient.

Execution