From d18797b9a3ad972674c2e12040b66a0e46f34d75 Mon Sep 17 00:00:00 2001 From: Dima Xu Date: Tue, 26 Nov 2024 09:14:46 +1300 Subject: [PATCH] Add Msteams: { Width: 'full' } to Textblock to support adaptive card full width Signed-off-by: Dima Xu --- notify/msteamsv2/msteamsv2.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/notify/msteamsv2/msteamsv2.go b/notify/msteamsv2/msteamsv2.go index b25bf11dd7..84f5d926f0 100644 --- a/notify/msteamsv2/msteamsv2.go +++ b/notify/msteamsv2/msteamsv2.go @@ -51,10 +51,11 @@ type Notifier struct { // https://learn.microsoft.com/en-us/connectors/teams/?tabs=text1#adaptivecarditemschema type Content struct { - Schema string `json:"$schema"` - Type string `json:"type"` - Version string `json:"version"` - Body []Body `json:"body"` + Schema string `json:"$schema"` + Type string `json:"type"` + Version string `json:"version"` + Body []Body `json:"body"` + Msteams Msteams `json:"msteams,omitempty"` } type Body struct { @@ -67,6 +68,10 @@ type Body struct { Color string `json:"color,omitempty"` } +type Msteams struct { + Width string `json:"width"` +} + type Attachment struct { ContentType string `json:"contentType"` ContentURL *string `json:"contentUrl"` // Use a pointer to handle null values @@ -167,6 +172,9 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error) Text: text, }, }, + Msteams: Msteams{ + Width: "full", + }, }, }, },