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
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Build a GitHub Slack Bot With AWS Bedrock and MCP, Part 2
  • Build a GitHub Slack Bot With AWS Bedrock and MCP, Part 1
  • Building MCP Hub for DevOps and CI/CD Pipelines
  • Engineering Habits for Building Resilient Software

Trending

  • Building a Skill-Based Agentic Reviewer with Claude Code: A Practical Guide Using Skills.MD, MCP Servers, Tools, and Tasks
  • Stateless JWT Auth Microservice Architecture With Spring Boot 3 and Redis Sentinel
  • AI Paradigm Shift: Analytics Without SQL
  • Introduction to Retrieval Augmented Generation (RAG)
  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.3K 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

  • Build a GitHub Slack Bot With AWS Bedrock and MCP, Part 2
  • Build a GitHub Slack Bot With AWS Bedrock and MCP, Part 1
  • Building MCP Hub for DevOps and CI/CD Pipelines
  • Engineering Habits for Building Resilient Software

Partner Resources

×

Comments

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

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

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 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook