Browse Source

Add pic into actionCard message

Athurg Feng 7 years ago
parent
commit
919d00437e
1 changed files with 5 additions and 0 deletions
  1. 5 0
      pkg/services/alerting/notifiers/dingding.go

+ 5 - 0
pkg/services/alerting/notifiers/dingding.go

@@ -101,6 +101,11 @@ func (this *DingDingNotifier) Notify(evalContext *alerting.EvalContext) error {
 
 
 	var bodyStr string
 	var bodyStr string
 	if this.MsgType == "actionCard" {
 	if this.MsgType == "actionCard" {
+		// Embed the pic into the markdown directly because actionCard doesn't have a picUrl field
+		if picUrl != "" {
+			message = "![](" + picUrl + ")\\n\\n" + message
+		}
+
 		bodyStr = `{
 		bodyStr = `{
 			"msgtype": "actionCard",
 			"msgtype": "actionCard",
 			"actionCard": {
 			"actionCard": {