Archive

Slack Webhook Alert

Explorer

Hello Experts,

Version : Splunk Enterprise 7.0.2

We have configured alerts from scheduled search which successfully sends alerts to slack.
Using "Slack Webhook Alert" with $result.fieldname$ .

Currently we have a problem of formatting the appearance of message in slack.
Please provide some documents or resources where the formatting in splunk can be done,so that the message looks good in slack.

Thank you.

0 Karma

Explorer

Edit slackwebhookalert.py

Replace the last line with :
try:
jsonobject = json.loads(slackmessage)
requests.post(slackwebhook, data=slackmessage)
except ValueError, e:
requests.post(slackwebhook, data=json.dumps({'text': slackmessage}))

This will allow you to send the message as JSON

0 Karma