Slack
Golang client for the Slack API. Include the example code using each slack api.
Currently supports:
Method | Description | Example |
---|---|---|
channels.history | Fetches history of messages and events from a channel. | #link |
channels.join | Joins a channel, creating it if needed. | #link |
channels.list | Lists all channels in a Slack team. | #link |
chat.postMessage | Sends a message to a channel. | #link |
files.upload | Upload an image/file | #link |
files.info | Retrieves the information about an uploaded file | #link |
groups.invite | Invites a user to a private group. | #link |
groups.create | Creates a private group. | #link |
groups.list | Lists private groups that the calling user has access to. | #link |
users.info | Gets information about a channel. | #link |
users.list | Lists all users in a Slack team. | #link |
Example
package main
import (
"github.com/bluele/slack"
)
const (
token = "your-api-token"
channelName = "general"
)
func main() {
api := slack.New(token)
err := api.ChatPostMessage(channelName, "Hello, world!", nil)
if err != nil {
panic(err)
}
}
Command line tool
If you are looking for slack commandline utility, vektorlab/slackcat probably suits you.
Author
Jun Kimura