Sending Messages to Slack From Go

Jul 27
Posted by

Slack is a great communication tool for teams of international developers who need to keep in sync. I personally use it every day and I find it to be much better than some of the other alternatives out there. While working on another project, I came across the need to send notifications to Slack from my Go application. Utilizing Slack’s awesome API, I wrote a quick package to easily send messages to a Slack channel.

GoSlackOff was born! To use it, simply create an instance with your Slack username, hook token, the default username to post as and the default channel to post in:

And then call the  SendMessage()  method. You can also override the channel or username for each message.

The SendMessage()  method will return a success boolean and the HTTP response object from the API call.

For more information, check out the README on github!

Filed Under: Dev
Tagged With: