vikramarsid / go-ms-teams

A Golang module to interface with Miceosoft Teams API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Github Tag

Maintainability codecov

Go Report Card GoDoc License


go-ms-teams

A package to send messages to Microsoft Teams

Usage

To get the package, execute:

go get https://github.com/vikramarsid/go-ms-teams

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

import "github.com/vikramarsid/go-ms-teams"

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

import (
	"github.com/vikramarsid/go-ms-teams"
)

func main() {
	_ = sendTheMessage()
}

func sendTheMessage() error {
	// init the client
	pts := Options{
		Timeout: 60 * time.Second,
		Verbose: true,
	}
	mstClient := NewClient(opts)
	
	mstClient := gomsteams.NewClient()

	// setup webhook url
	webhookUrl := "https://outlook.office.com/webhook/YOUR_WEBHOOK_URL_OF_TEAMS_CHANNEL"

	// setup message card
	msgCard := gomsteams.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


About

A Golang module to interface with Miceosoft Teams API

License:MIT License


Languages

Language:Go 94.9%Language:Makefile 5.1%