DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Implementing Infrastructure as Code (IaC) for Data Center Management
  • How to Build Slack App for Audit Requests
  • On SBOMs, BitBucket, and OWASP Dependency Track
  • Scaling CI/CD: Standardizing Pipelines in Large-Scale Organizations

Trending

  • Rust, WASM, and Edge: Next-Level Performance
  • Infrastructure as Code (IaC) Beyond the Basics
  • After 9 Years, Microsoft Fulfills This Windows Feature Request
  • Data Quality: A Novel Perspective for 2025
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Customizing CircleCI Slack Notifications

Customizing CircleCI Slack Notifications

See how you can use the Transposit Slack plug-in to give your CircleCI Slack notifications that personal touch.

By 
Nina Yang user avatar
Nina Yang
·
Updated Sep. 06, 19 · Tutorial
Likes (0)
Comment
Save
Tweet
Share
2.2K Views

Join the DZone community and get the full member experience.

Join For Free

Slack notifications

You have Slack notifications, but are they all for you?

failed message

Nina's build failed...but she muted the channel so she's not going to see this message

My fellow engineers are very productive, so code is always being pushed and deployed. We use CircleCI and its GitHub integration to manage our continuous deployment process. CircleCI, via a Slack webhook, posts every successful and failed build into our #build channel.

But I don’t need to know about every successful and failed build. I want the #build channel to only ping me for my successful and failed builds. Actually, only the failed builds. (I really care about those!)

Unfortunately, CircleCI’s Slack integration can’t help: it knows who wrote the commit, but it doesn’t know who they are on Slack. It makes sense why this doesn’t exist out of the box; how would CircleCI learn such a mapping? Where would it be stored? Even if CircleCI provided some sort of lookup method, what if it still needed to be tailored to how my team handles build notifications?

Enter Transposit.

My CircleCI Router app acts as a bridge between CircleCI and Slack. It replaces the GitHub username in the message sent from CircleCI with the corresponding Slack ID. Engineers who have authenticated with my app can mute the #build channel and only get notified for their own builds, for which the message will @mention them.

Here’s How It Works

My teammates sign in with Slack and add their GitHub credentials. They can choose notifications for all builds or only for failures, via Transposit’s user settings.

Sign in to CircleCI RouterApp settings

App settings


Next, I replaced CircleCI’s Slack Webhook URL with my own, created in Transposit.

CircleCI settings

CircleCI settings

When CircleCI hits the webhook, my operation pulls the GitHub username from the message (it’s always the second word) and replaces it with the user’s Slack ID. I’ve created the mapping between identifiers using the application stash, which is a built-in k/v store. Depending on the state of the build (and that user’s preferences) we’ll @ them in the #build channel using the Slack connector.

The webhook operation code

Webhook operation code

Everything is wrapped in a try/catch so the original message will always be sent if there was an error in the code.

Success:

A successful Slack notification with an @ mention

Success!


Fork my app to customize your team’s build notifications!

Further Reading

How to Incorporate Slack Alerts Into Your Development Process

Slack (software) Continuous Integration/Deployment

Published at DZone with permission of Nina Yang. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Implementing Infrastructure as Code (IaC) for Data Center Management
  • How to Build Slack App for Audit Requests
  • On SBOMs, BitBucket, and OWASP Dependency Track
  • Scaling CI/CD: Standardizing Pipelines in Large-Scale Organizations

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!