- Explore Slack’s Block Kit Builder and message layouts
- Build JSON payloads with attachments and blocks
- Integrate payloads in Jenkins via a shared library
- Customize messages with emojis, images, and buttons
Quick Slack Notifications Example
Out of the box, Jenkins’ Slack plugin can send basic build statuses:Slack API: Rich Message Layouts
Slack’s Messaging Layouts guide shows how to assemble messages with attachments and blocks:
Use the Slack API documentation to discover block types like
section, divider, and interactive elements such as buttons and overflow menus.Block Kit Builder
Prototype your message in Slack’s Block Kit Builder before coding.Basic Section Block
Interactive Message with Button and Image
Constructing an Attachment Payload
Wrap blocks in anattachments array to add colors, fallbacks, or pretext:
Always validate your JSON. Slack expects arrays
[] around lists and objects {} for key/value pairs.Jenkins Slack Notification Plugin
Jenkins uses the Slack Notification Plugin to send JSON payloads. You can pass your attachment payload directly:Shared Library: sendNotifications.groovy
Use a shared library to assemble attachments dynamically:Custom Emojis in Slack
Add custom emojis under Customize Slack → Add Emoji. For example, uploaddeadpool.png as :deadpool::

:tada:, :warning:, and :hulk: available.
Integrating in Jenkinsfile
CallsendNotifications in your pipeline’s post section:
Resulting Slack Message
A successful pipeline produces a detailed Slack notification:
- A header with deployment name and emoji
- Job name and build number fields
- Custom icons and images
- Optional action buttons or links to Jenkins, Kubernetes, or GitHub