Integrating Jenkins with Slack using the Slack Notification Plugin provides real-time build alerts directly to your development team. This guide walks through configuring a secure, production-ready Slack alert system for your CI/CD pipelines.
🛠️ Step 1: Create a Slack App & Obtain OAuth Scopes
Modern Slack integrations require creating a dedicated Slack App within your workspace.

- Navigate to the Slack API Apps Portal and click Create New App.
- Choose From an app manifest, select your workspace, and choose YAML.
- Replace the default template with the following configuration manifest:
display_information:
name: Jenkins Alert Bot
features:
bot_user:
display_name: Jenkins
always_online: true
oauth_config:
scopes:
bot:
- channels:read
- chat:write
- chat:write.customizeYAML- Click Next, review the permissions (
chat:writeandchannels:read), and click Create. - Under the Install App menu, click Install to Workspace.
- Copy the generated Bot User OAuth Token (starts with
xoxb-). Keep this token completely private. - Open your Slack client, go to your designated alerts channel (e.g.,
#jenkins-alerts), type/invite @Jenkins Alert Bot, and press enter to add your bot.



⚙️ Step 2: Install and Configure the Slack Notification Plugin
With your token ready, configure Jenkins to communicate with your workspace safely.
Plugin Installation
- Go to your Jenkins Dashboard -> Manage Jenkins -> Plugins.
- Select the Available Plugins tab, search for
Slack Notification, and check the box. - Click Install and let Jenkins download the dependencies.
Secure Credentials Entry
- Navigate to Manage Jenkins -> Credentials -> System -> Global credentials.
- Click Add Credentials and configure the fields exactly as follows:
- Kind:
Secret text - Scope:
Global - Secret: Paste your
xoxb-Bot User OAuth Token here. - ID:
jenkins-slack-token(or another memorable string) - Description: Slack Bot Token for Channel Alerts
- Kind:

Global Plugin Setup
- Head to Manage Jenkins -> System (System Configuration).
- Scroll down until you find the Slack section.
- Set up your workspace parameters:
- Workspace: Enter your explicit Slack workspace domain name (the prefix of
.slack.com). - Credential: Select
jenkins-slack-tokenfrom the dropdown list. - Default Channel: Enter your channel name (e.g.,
#jenkins-alerts).
- Workspace: Enter your explicit Slack workspace domain name (the prefix of
- Click the Test Connection button at the bottom of the section. You should see a “Success” message in Jenkins and a test ping inside your Slack channel.

💻 Step 3: Implement Alerts in Jenkins Pipelines
The most efficient way to maintain alerts across development teams is to define notifications within your Jenkinsfile.
Standard Declarative Pipeline Syntax
Use the pipeline post block to dynamically capture execution statuses and format alerts appropriately.
pipeline {
agent any
stages {
stage('Build & Test') {
steps {
echo 'Executing application compilation...'
}
}
}
post {
always {
// Sends a standard baseline message regardless of state
slackSend(
color: '#cccccc',
message: "Build Finished: ${env.JOB_NAME} #${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open Build>)"
)
}
success {
slackSend(
color: 'good',
message: "SUCCESS: Job '${env.JOB_NAME}' [Build #${env.BUILD_NUMBER}] completed cleanly."
)
}
failure {
// Pings active channel members using Slack special mentions
slackSend(
color: 'danger',
message: "<!here> ALERT: Job '${env.JOB_NAME}' [Build #${env.BUILD_NUMBER}] failed! Review logs immediately."
)
}
}
}GroovyParameter Reference Matrix
| Argument | Valid Options / Type | Technical Utility |
|---|---|---|
color | 'good', 'warning', 'danger', or Hex Code | Left-side border accent line formatting for visual urgency. |
message | String (Supports dynamic env variables) | Plain text core body of your slack message. |
channel | String (Optional override) | Targets a custom channel, overriding global system defaults. |
tokenCredentialId | String (Optional override) | Employs an alternative credential scope for isolating specific pipelines. |
🔍 Step 4: Verification and Advanced Alert Mentions
Run a quick build on your modified pipeline to verify execution. When an automated build fails, your pipeline will instantly format a message block inside Slack, highlighting structural issues with a red or green vertical identifier accent line.


Special Formatting & Mentions
- Tagging Everyone Active: To flag emergency attention inside a channel, prepend
<!here>or<!channel>to your alert message. - Explicit User Mentions: You can target specific team members directly by capturing their distinct Slack string ID using the syntax
<@U12345678>within the text payload.
Discover more from Altgr Blog
Subscribe to get the latest posts sent to your email.
