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.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...