Last active
June 13, 2023 08:32
-
-
Save azhinu/713575b5e50540a9918296df19f5ecda to your computer and use it in GitHub Desktop.
Grafana alert RocketChat webhook script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rocketchat incoming grafana webhook script | |
// See the following links for some documentation: | |
// * Grafana outgoing format: https://grafana.com/docs/grafana/latest/alerting/manage-notifications/webhook-notifier/ | |
// * Rocketchat incoming message format: https://developer.rocket.chat/reference/api/rest-api/endpoints/core-endpoints/chat-endpoints/postmessage#attachments-detail | |
class Script { | |
process_incoming_request({ request }) { | |
var attachments = []; | |
request.content.alerts.map(function(item) { | |
attachments.push({ | |
"image_url" : item.imageURL, | |
}); | |
}); | |
return { | |
content:{ | |
text: request.content.message, | |
attachments: attachments | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment