Skip to content

GoLang Library for handling Outgoing Microsoft Teams WebHooks (for bots)

License

Notifications You must be signed in to change notification settings

ericdaugherty/msteams-webhook-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoLang Outgoing WebHook Library

This is a small library to simplify the task of writing BOT Outgoing WebHooks for Microsoft Teams, as outlined in their documentation https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/outgoingwebhook

The sample project (samples/helloworld) provide full documentation on using and deploying this library. In short, you need to implement a main function and an OnMessage function as follows:

import (
	"github.com/aws/aws-lambda-go/lambda"
	teams "github.com/ericdaugherty/msteams-webhook-go"
)

type webHook struct {
}

func (w webHook) OnMessage(req teams.Request) (teams.Response, error) {
	return teams.BuildResponse("Hello " + req.FromUser.Name), nil
}

func main() {
	lambda.Start(teams.NewHandler(false, "", webHook{}))
}

The main function starts the Lambda API and registers your callback. Then you simply process the request and return the response, using the BuildResponse helper method.

This library also supports HMAC authenctication. Simply pass in 'true' and the Base64 encoded String returned by Microsoft Teams when you register your callback URL.

About

GoLang Library for handling Outgoing Microsoft Teams WebHooks (for bots)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages