Skip to content
Slack API in Go - community-maintained fork created by the original author, @nlopes
Go Makefile
Branch: master
Clone or download
This branch is even with slack-go:master.

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
examples
internal
slackevents
slacktest
slackutilsx
vendor
.gitignore
.gometalinter.json
.travis.yml
CHANGELOG.md
LICENSE
Makefile
README.md
TODO.txt
admin.go
attachements_test.go
attachments.go
auth.go
backoff.go
block.go
block_action.go
block_action_test.go
block_context.go
block_context_test.go
block_conv.go
block_divider.go
block_divider_test.go
block_element.go
block_element_test.go
block_file.go
block_file_test.go
block_image.go
block_image_test.go
block_input.go
block_input_test.go
block_object.go
block_object_test.go
block_section.go
block_section_test.go
block_test.go
block_unknown.go
bots.go
bots_test.go
channels.go
chat.go
chat_test.go
comment.go
conversation.go
conversation_test.go
dialog.go
dialog_select.go
dialog_select_test.go
dialog_test.go
dialog_text.go
dialog_text_test.go
dnd.go
dnd_test.go
emoji.go
emoji_test.go
errors.go
files.go
files_test.go
go.mod
go.sum
groups.go
history.go
im.go
info.go
interactions.go
interactions_test.go
item.go
item_test.go
logger.go
logger_test.go
messageID.go
messages.go
messages_test.go
misc.go
misc_test.go
oauth.go
pagination.go
pins.go
pins_test.go
reactions.go
reactions_test.go
reminders.go
reminders_test.go
rtm.go
search.go
security.go
security_test.go
slack.go
slack_test.go
slash.go
slash_test.go
stars.go
stars_test.go
team.go
team_test.go
usergroups.go
usergroups_test.go
users.go
users_test.go
views.go
views_test.go
webhooks.go
webhooks_go112.go
webhooks_go113.go
webhooks_test.go
websocket.go
websocket_channels.go
websocket_desktop_notification.go
websocket_dm.go
websocket_dnd.go
websocket_files.go
websocket_groups.go
websocket_internals.go
websocket_managed_conn.go
websocket_managed_conn_test.go
websocket_misc.go
websocket_mobile_in_app_notification.go
websocket_pins.go
websocket_reactions.go
websocket_stars.go
websocket_subteam.go
websocket_teams.go

README.md

Slack API in Go GoDoc Build Status

This is the original Slack library for Go created by Norberto Lopez, transferred to a Github organization.

Join the chat at https://gitter.im/go-slack/Lobby

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

You can’t perform that action at this time.