Skip to content

int128/slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slack GoDoc CircleCI codecov

This is a Go package for sending messages via Slack Incoming Webhooks API and Mattermost Incoming Webhooks API. It provides dialects for Slack and Mattermost.

See GoDoc.

Examples

package main

import (
	"log"

	"github.com/int128/slack"
)

const webhook = "https://hooks.slack.com/services/..."

func main() {
	if err := slack.Send(webhook, &slack.Message{
		Username:  "mybot",
		IconEmoji: ":star:",
		Text:      "Hello World!",
	}); err != nil {
		log.Fatalf("Could not send the message to Slack: %s", err)
	}
}

See also example/main.go.

Contributions

This is an open source software licensed under Apache-2.0. Feel free to open issues and pull requests.