Skip to content

Latest commit

 

History

History
93 lines (67 loc) · 2.96 KB

README.md

File metadata and controls

93 lines (67 loc) · 2.96 KB

Build Status Github Tag

Coverage Status Maintainability codecov

Go Report Card GoDoc License


go-teams-notify

A package to send messages to Microsoft Teams (channels)

...

Usage

To get the package, execute:

go get gopkg.in/dasrick/go-teams-notify.v1

To import this package, add the following line to your code:

import "gopkg.in/dasrick/go-teams-notify.v1"

And this is an example of a simple implementation ...

import (
	"gopkg.in/dasrick/go-teams-notify.v1"
)

func main() {
	_ = sendTheMessage()
}

func sendTheMessage() error {
	// init the client
	mstClient, err := goteamsnotify.NewClient()
	if err != nil {
		return err
	}
	// setup webhook url
	webhookUrl := "https://outlook.office.com/webhook/YOUR_WEBHOOK_URL_OF_TEAMS_CHANNEL"
	// setup message card
	msgCard := goteamsnotify.NewMessageCard()
	msgCard.Title = "Hello world"
	msgCard.Text = "Here are some examples of formatted stuff like <br> * this list itself  <br> * **bold** <br> * *italic* <br> * ***bolditalic***"
	msgCard.ThemeColor = "#DF813D"
	// firestarter
	return mstClient.Send(webhookUrl, msgCard)
}

some useful links