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.
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.
This is an open source software licensed under Apache-2.0. Feel free to open issues and pull requests.