All Apps and Add-ons

Slack Notification Alert: How do you set the attachment color

danielbradleyfu
New Member

I'm wanting to post exceptions to slack, but want to be able to quickly differentiate between warnings and errors.

Slack supports setting a colour on the side of the message using attachments: https://api.slack.com/docs/attachments.

How would I set the attachment colour via the Slack Notification Alert?

0 Karma
1 Solution

acharlieh
Influencer

In this case, you must construct additional pylons er, I mean develop some custom code.

If you download the Slack Notification Alert App, in the bin directory you'll find slack.py. This is the script that kicks off the call to Slack when needed, but you'll note that it doesn't use attachments as part of the request to Slack. You'll probably also want to learn how to modify other parts of the modular alert to allow users to specify the color to send with when configuring the alert. The Splunk Docs go into more depth about how to build Custom Modular Alerts.

View solution in original post

acharlieh
Influencer

In this case, you must construct additional pylons er, I mean develop some custom code.

If you download the Slack Notification Alert App, in the bin directory you'll find slack.py. This is the script that kicks off the call to Slack when needed, but you'll note that it doesn't use attachments as part of the request to Slack. You'll probably also want to learn how to modify other parts of the modular alert to allow users to specify the color to send with when configuring the alert. The Splunk Docs go into more depth about how to build Custom Modular Alerts.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...