Skip to content

Commit

Permalink
Add a fallback text to Mattermost attachement
Browse files Browse the repository at this point in the history
This is required in order not to have empty notifications
  • Loading branch information
bfontaine authored and Its-Alex committed Apr 28, 2023
1 parent cdc19b6 commit 3e5c187
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/sms/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ func main() {
log.Fatalf("Error reading body: %v", err)
}
jsonStringData := string(jsonByteData)
title := gjson.Get(jsonStringData, "event.title").String()

postBody, err := json.Marshal(map[string]interface{}{
"channel": channel,
"attachments": []interface{}{
map[string]interface{}{
"title": gjson.Get(jsonStringData, "event.title").String(),
"title": title,
"fallback": title,
"color": "#FF0000",
"author_name": "Sentry",
"author_icon": "https://assets.stickpng.com/images/58482eedcef1014c0b5e4a76.png",
Expand Down

0 comments on commit 3e5c187

Please sign in to comment.