Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ms teamsv2 rendering issues #4160

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions notify/msteamsv2/msteamsv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,23 @@ type Notifier struct {
postJSONFunc func(ctx context.Context, client *http.Client, url string, body io.Reader) (*http.Response, error)
}

type MSTeams struct {
Width string `json:"width"`
}

// 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"`
}

type Body struct {
Type string `json:"type"`
Text string `json:"text"`
Weight string `json:"weigth,omitempty"`
Weight string `json:"weight,omitempty"`
Size string `json:"size,omitempty"`
Wrap bool `json:"wrap,omitempty"`
Style string `json:"style,omitempty"`
Expand Down Expand Up @@ -165,8 +170,12 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
{
Type: "TextBlock",
Text: text,
Wrap: true,
},
},
MSTeams: MSTeams{
Width: "full",
},
},
},
},
Expand Down