Skip to content

A package to send messages to Microsoft Teams (channels)

License

Notifications You must be signed in to change notification settings

dasrick/go-teams-notify

Repository files navigation

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)


This project is no longer being actively developed or maintained. Please use the successor.

https://github.com/atc0005/go-teams-notify


Usage

To get the package, execute:

go get https://github.com/dasrick/go-teams-notify/v2

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

import "github.com/dasrick/go-teams-notify/v2"

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

import (
	"github.com/dasrick/go-teams-notify/v2"
)

func main() {
	_ = sendTheMessage()
}

func sendTheMessage() error {
	// init the client
	mstClient := goteamsnotify.NewClient()

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

	// send
	return mstClient.Send(webhookUrl, msgCard)
}

some useful links