Send messages to Slack channels from Go
Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
GoSlackOff.go
LICENSE
README.md

README.md

GoSlackOff

Send messages to Slack channels from Go

Usage

First create an instance with your Slack company name and token as well as the username for the bot and a channel to post to:

instance := goslackoff.New("SLACK-USERNAME", "SLACK-INCOMING-HOOK-TOKEN", "GoSlackOff", "#general")

Then to send a message:

success, resp := instance.SendMessage(goslackoff.Message{
	Text:     "Hello from Go :)",
	Channel:  "#other-room",      //optional
	Username: "GoSlackOff Other", //optional
})

Catch the errors/http response with:

fmt.Println("Message sent successfully?", success)

if !success {
	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println("Response Code:", resp.Status)
	fmt.Println("Response Body:", body)
}

Demo

Demo is included in test/test.go