mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 19:00:54 -06:00
feat(alerting): Text formatting for Threema alert messages
This commit is contained in:
parent
d1a5d9c15c
commit
689f5cb686
@ -127,14 +127,14 @@ func (notifier *ThreemaNotifier) Notify(evalContext *alerting.EvalContext) error
|
|||||||
data.Set("secret", notifier.APISecret)
|
data.Set("secret", notifier.APISecret)
|
||||||
|
|
||||||
// Build message
|
// Build message
|
||||||
message := fmt.Sprintf("%s\nState: %s\nMessage: %s\n",
|
message := fmt.Sprintf("%s\n\n*State:* %s\n*Message:* %s\n",
|
||||||
evalContext.GetNotificationTitle(), evalContext.Rule.Name, evalContext.Rule.Message)
|
evalContext.GetNotificationTitle(), evalContext.Rule.Name, evalContext.Rule.Message)
|
||||||
ruleURL, err := evalContext.GetRuleUrl()
|
ruleURL, err := evalContext.GetRuleUrl()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
message = message + fmt.Sprintf("URL: %s\n", ruleURL)
|
message = message + fmt.Sprintf("*URL:* %s\n", ruleURL)
|
||||||
}
|
}
|
||||||
if evalContext.ImagePublicUrl != "" {
|
if evalContext.ImagePublicUrl != "" {
|
||||||
message = message + fmt.Sprintf("Image: %s\n", evalContext.ImagePublicUrl)
|
message = message + fmt.Sprintf("*Image:* %s\n", evalContext.ImagePublicUrl)
|
||||||
}
|
}
|
||||||
data.Set("text", message)
|
data.Set("text", message)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user