Skip to content

Commit d18797b

Browse files
author
Dima Xu
committed
Add Msteams: { Width: 'full' } to Textblock to support adaptive card full width
Signed-off-by: Dima Xu <[email protected]>
1 parent 82b89dc commit d18797b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

notify/msteamsv2/msteamsv2.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ type Notifier struct {
5151

5252
// https://learn.microsoft.com/en-us/connectors/teams/?tabs=text1#adaptivecarditemschema
5353
type Content struct {
54-
Schema string `json:"$schema"`
55-
Type string `json:"type"`
56-
Version string `json:"version"`
57-
Body []Body `json:"body"`
54+
Schema string `json:"$schema"`
55+
Type string `json:"type"`
56+
Version string `json:"version"`
57+
Body []Body `json:"body"`
58+
Msteams Msteams `json:"msteams,omitempty"`
5859
}
5960

6061
type Body struct {
@@ -67,6 +68,10 @@ type Body struct {
6768
Color string `json:"color,omitempty"`
6869
}
6970

71+
type Msteams struct {
72+
Width string `json:"width"`
73+
}
74+
7075
type Attachment struct {
7176
ContentType string `json:"contentType"`
7277
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)
167172
Text: text,
168173
},
169174
},
175+
Msteams: Msteams{
176+
Width: "full",
177+
},
170178
},
171179
},
172180
},

0 commit comments

Comments
 (0)