Help us shape the future of Go! Take the 2026 Go Developer Survey

goteamsnotify

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: MIT Imports: 8 Imported by: 19

README

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)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v1.1.1

type API interface {
	Send(webhookURL string, webhookMessage MessageCard) error
}

API - interface of MS Teams notify

func NewClient added in v1.1.0

func NewClient() (API, error)

NewClient - create a brand new client for MS Teams notify

type MessageCard

type MessageCard struct {
	Title      string `json:"title"`
	Text       string `json:"text"`
	ThemeColor string `json:"themeColor,omitempty"`
}

MessageCard - struct of message card

func NewMessageCard

func NewMessageCard() MessageCard

NewMessageCard - create new empty message card

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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