Installing • Examples • Build Status • License
This library supports most if not all of the api.slack.com
REST calls, as well as the Real-Time Messaging protocol over websocket, in a fully managed way.
Before the initial install allows git to use redirects for pkg.re service (reason why you should do this described here):
git config --global http.https://pkg.re.followRedirects true
Make sure you have a working Go 1.7+ workspace (instructions), then:
go get pkg.re/essentialkaos/slack.v2
For update to latest stable release, do:
go get -u pkg.re/essentialkaos/slack.v2
import (
"fmt"
"pkg.re/essentialkaos/slack.v2"
)
func main() {
api := slack.New("YOUR_TOKEN_HERE")
// If you set debugging, it will log all requests to the console
// Useful when encountering issues
// api.SetDebug(true)
groups, err := api.GetGroups(false)
if err != nil {
fmt.Printf("%s\n", err)
return
}
for _, group := range groups {
fmt.Printf("ID: %s, Name: %s\n", group.ID, group.Name)
}
}
import (
"fmt"
"pkg.re/essentialkaos/slack.v2"
)
func main() {
api := slack.New("YOUR_TOKEN_HERE")
user, err := api.GetUserInfo("U023BECGF")
if err != nil {
fmt.Printf("%s\n", err)
return
}
fmt.Printf("ID: %s, Fullname: %s, Email: %s\n", user.ID, user.Profile.RealName, user.Profile.Email)
}
See example.
Branch | Status |
---|---|
master (Stable) |
|
develop (Unstable) |
BSD 2-Clause license