Skip to content

Commit

Permalink
Add Msteams: { Width: 'full' } to Textblock to support adaptive card …
Browse files Browse the repository at this point in the history
…full width

Signed-off-by: Dima Xu <[email protected]>
  • Loading branch information
Dima Xu committed Nov 26, 2024
1 parent 82b89dc commit d18797b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions notify/msteamsv2/msteamsv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -167,6 +172,9 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
Text: text,
},
},
Msteams: Msteams{
Width: "full",
},
},
},
},
Expand Down

0 comments on commit d18797b

Please sign in to comment.