Commit f185c2c9 by Carl Bergquist Committed by GitHub

Merge pull request #7676 from dbrgn/threema-emoji

feat(alerting): Add emoji to Threema alert notifications
parents 55e0df78 1422655e
......@@ -126,9 +126,21 @@ func (notifier *ThreemaNotifier) Notify(evalContext *alerting.EvalContext) error
data.Set("to", notifier.RecipientID)
data.Set("secret", notifier.APISecret)
// Determine emoji
stateEmoji := ""
switch evalContext.Rule.State {
case m.AlertStateOK:
stateEmoji = "\u2705 " // White Heavy Check Mark
case m.AlertStateNoData:
stateEmoji = "\u2753 " // Black Question Mark Ornament
case m.AlertStateAlerting:
stateEmoji = "\u26A0 " // Warning sign
}
// Build message
message := fmt.Sprintf("%s\n\n*State:* %s\n*Message:* %s\n",
evalContext.GetNotificationTitle(), evalContext.Rule.Name, evalContext.Rule.Message)
message := fmt.Sprintf("%s%s\n\n*State:* %s\n*Message:* %s\n",
stateEmoji, evalContext.GetNotificationTitle(),
evalContext.Rule.Name, evalContext.Rule.Message)
ruleURL, err := evalContext.GetRuleUrl()
if err == nil {
message = message + fmt.Sprintf("*URL:* %s\n", ruleURL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment