teams-go

module
v0.0.0-...-ad4aeb8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2021 License: MIT

README

teams-go

CI status

A (very simple) Go library for posting messages to incoming webhooks in Microsoft Teams.

For details about card formatting, see the MessageCard reference. (even though it's described as 'legacy', that is actually the only format that the webhooks support) Note that not everything on that page is currently supported.

Example

package main

import "github.com/NoteToScreen/teams-go/teams"

func main() {
	url := "<insert webhook URL here>"
	card := teams.Card{
		Summary:    "This is a test.",
		ThemeColor: "0000FF",
		Title:      "Test",
		Sections: []teams.Section{
			teams.Section{
				ActivityTitle: "Important section",
				Text:          "This is a description of the section.",
				Facts: []teams.Fact{
					teams.Fact{
						Name:  "Is this a section?",
						Value: "Yes",
					},
					teams.Fact{
						Name:  "Contains text",
						Value: "Also yes",
					},
				},
			},
		},
	}

	err := teams.PostToWebhook(url, card)
	if err != nil {
		panic(err)
	}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL