Skip to content

Commit

Permalink
Extend MessageCard struct to support more fields
Browse files Browse the repository at this point in the history
In particular:

- Multiple sections
- Facts (subfield for Sections)
- PotentialAction
  - could be used to link back to reports or more details
    not provided by a Teams notification

refs atc0005/bounce#21
  • Loading branch information
atc0005 committed Mar 26, 2020
1 parent 97487a6 commit f73f1af
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions send.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,32 @@ func (c teamsClient) Send(webhookURL string, webhookMessage MessageCard) error {
}

// MessageCard - struct of message card
// https://docs.microsoft.com/en-us/outlook/actionable-messages/send-via-connectors
// https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference
// https://github.com/atc0005/bounce/issues/21
type MessageCard struct {
Summary string `json:"summary,omitempty"`
Title string `json:"title"`
Text string `json:"text"`
ThemeColor string `json:"themeColor,omitempty"`
Sections []struct {
Title string `json:"title"`
Text string `json:"text"`
Markdown bool `json:"markdown"`
Facts []struct {
Name string `json:"name"`
Value string `json:"value"`
} `json:"facts,omitempty"`
} `json:"sections,omitempty"`
PotentialAction []struct {
Target []string `json:"target"`
Context string `json:"@context"`
Type string `json:"@type"`
ID interface{} `json:"@id"`
Name string `json:"name"`
IsPrimaryAction bool `json:"isPrimaryAction"`
} `json:"potentialAction,omitempty"`
ThreadingCriteria interface{} `json:"threadingCriteria,omitempty"`
}

// NewMessageCard - create new empty message card
Expand Down

0 comments on commit f73f1af

Please sign in to comment.