This Pipelines Task sends Slack notifications from your Pipelines Step.
Prerequisites
To send notifications to a pre-defined channel, this task requires a Slack integration containing a Webhook URL.
To send notifications to users or dynamic public channels, a Generic integration containing a Slack Token is required.
Usage
Basic:
- task: jfrog/slack-notify@v0.1.0 input: slackIntegration: "slack_int" message: "notification message"- task: jfrog/setup-yarn@v0.1.0
To send a notification to a specific user, use the Generic integration with the following inputs:
Note
User name should start with @. Example: @john
.
- task: jfrog/slack-notify@v0.1.0 input: tokenIntegration: "generic_slack_int" token: "SLACK_TOKEN" to: "@user" message: "notification message"
To send a notification to a dynamic public channel, use the Generic integration with the following inputs:
Note
Channel name should start with #. Example: #mychannel
.
- task: jfrog/slack-notify@v0.1.0 input: tokenIntegration: "generic_slack_int" token: "SLACK_TOKEN" to: "#channel" message: "notification message"
Input Variables
Name | Required | Default | Description |
---|---|---|---|
slackIntegration | true * |
| Slack integration used for getting webhook |
tokenIntegration | true * | Generic integration used for getting token | |
token | true ** | Token name used in tokenIntegration for storing Slack token | |
to | true ** | Receiver of the message | |
message | false |
| Message to be sent to Slack |
Note
* At least one of these inputs is required | ** Required when tokenIntegration is set
Output Variables
Name | Description |
---|---|
messageSent | Message sent to Slack |
Exported Environment Variables
None
How does it work?
This task sends HTTP request to Slack to send the notification.
To send messages to a user or public channels, create Slack token with the below bot scope permissions:
chat:write
im:write
chat:write.public
License
This project is licensed under Apache 2.0 license.