feat(alerting): Text formatting for Threema alert messages

This commit is contained in:
Danilo Bargen 2017-02-07 11:10:05 +01:00
parent d1a5d9c15c
commit 689f5cb686

View File

@ -127,14 +127,14 @@ func (notifier *ThreemaNotifier) Notify(evalContext *alerting.EvalContext) error
data.Set("secret", notifier.APISecret)
// 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)
ruleURL, err := evalContext.GetRuleUrl()
if err == nil {
message = message + fmt.Sprintf("URL: %s\n", ruleURL)
message = message + fmt.Sprintf("*URL:* %s\n", ruleURL)
}
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)