23d8742f0d | 4 years ago | |
---|---|---|
.. | ||
internal | 5 years ago | |
slackutilsx | 5 years ago | |
.gitignore | 5 years ago | |
.gometalinter.json | 5 years ago | |
.travis.yml | 4 years ago | |
CHANGELOG.md | 5 years ago | |
LICENSE | 5 years ago | |
Makefile | 5 years ago | |
README.md | 5 years ago | |
TODO.txt | 5 years ago | |
admin.go | 5 years ago | |
attachments.go | 5 years ago | |
auth.go | 5 years ago | |
backoff.go | 5 years ago | |
block.go | 4 years ago | |
block_action.go | 5 years ago | |
block_context.go | 5 years ago | |
block_conv.go | 4 years ago | |
block_divider.go | 5 years ago | |
block_element.go | 4 years ago | |
block_file.go | 5 years ago | |
block_image.go | 4 years ago | |
block_input.go | 5 years ago | |
block_object.go | 4 years ago | |
block_section.go | 5 years ago | |
block_unknown.go | 5 years ago | |
bots.go | 5 years ago | |
channels.go | 5 years ago | |
chat.go | 4 years ago | |
comment.go | 5 years ago | |
conversation.go | 5 years ago | |
dialog.go | 5 years ago | |
dialog_select.go | 5 years ago | |
dialog_text.go | 5 years ago | |
dnd.go | 5 years ago | |
emoji.go | 5 years ago | |
errors.go | 5 years ago | |
files.go | 5 years ago | |
go.mod | 4 years ago | |
go.sum | 4 years ago | |
groups.go | 4 years ago | |
history.go | 4 years ago | |
im.go | 5 years ago | |
info.go | 5 years ago | |
interactions.go | 4 years ago | |
item.go | 5 years ago | |
logger.go | 5 years ago | |
messageID.go | 5 years ago | |
messages.go | 4 years ago | |
misc.go | 5 years ago | |
oauth.go | 4 years ago | |
pagination.go | 5 years ago | |
pins.go | 5 years ago | |
reactions.go | 5 years ago | |
reminders.go | 5 years ago | |
rtm.go | 5 years ago | |
search.go | 5 years ago | |
security.go | 5 years ago | |
slack.go | 5 years ago | |
slash.go | 5 years ago | |
stars.go | 5 years ago | |
team.go | 5 years ago | |
usergroups.go | 5 years ago | |
users.go | 4 years ago | |
views.go | 5 years ago | |
webhooks.go | 4 years ago | |
webhooks_go112.go | 5 years ago | |
webhooks_go113.go | 5 years ago | |
websocket.go | 5 years ago | |
websocket_channels.go | 5 years ago | |
websocket_desktop_notification.go | 5 years ago | |
websocket_dm.go | 5 years ago | |
websocket_dnd.go | 5 years ago | |
websocket_files.go | 5 years ago | |
websocket_groups.go | 5 years ago | |
websocket_internals.go | 5 years ago | |
websocket_managed_conn.go | 4 years ago | |
websocket_misc.go | 5 years ago | |
websocket_mobile_in_app_notification.go | 5 years ago | |
websocket_pins.go | 5 years ago | |
websocket_reactions.go | 5 years ago | |
websocket_stars.go | 5 years ago | |
websocket_subteam.go | 5 years ago | |
websocket_teams.go | 5 years ago |
README.md
Slack API in Go
This is the original Slack library for Go created by Norberto Lopez, transferred to a Github organization.
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.
Changelog
CHANGELOG.md is available. Please visit it for updates.
Installing
go get
$ go get -u github.com/slack-go/slack
Example
Getting all groups
import (
"fmt"
"github.com/slack-go/slack"
)
func main() {
api := slack.New("YOUR_TOKEN_HERE")
// If you set debugging, it will log all requests to the console
// Useful when encountering issues
// slack.New("YOUR_TOKEN_HERE", slack.OptionDebug(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)
}
}
Getting User Information
import (
"fmt"
"github.com/slack-go/slack"
)
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)
}
Minimal RTM usage:
See https://github.com/slack-go/slack/blob/master/examples/websocket/websocket.go
Minimal EventsAPI usage:
See https://github.com/slack-go/slack/blob/master/examples/eventsapi/events.go
Contributing
You are more than welcome to contribute to this project. Fork and make a Pull Request, or create an Issue if you see any problem.
Before making any Pull Request please run the following:
make pr-prep
This will check/update code formatting, linting and then run all tests
License
BSD 2 Clause license