Skip to content
Slack API in Go - community-maintained fork created by the original author, @nlopes
Go Makefile
Branch: master
Clone or download

Latest commit

ollieparsley Merge pull request #682 from hairyhenderson/fix-subteam_members_chang…
…ed-event

Add missing subteam_members_changed event mapping
Latest commit 5b8bbb1 Mar 18, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Added Makefile for contributors to use and updated PR guidelines Feb 24, 2020
examples Move websocket respond example into own director Mar 8, 2020
internal obey rate limits during connection setup Apr 4, 2019
slackevents add support for reaction events Mar 3, 2020
slacktest Fix paths Feb 16, 2020
slackutilsx add retryable behavior to errors Apr 19, 2019
vendor Run go mod tidy and go mod vendor Dec 9, 2019
.gitignore Added structs and basic methods for handling Slack dialogs Jul 14, 2018
.gometalinter.json Remove gofmt from gometalinter Jan 7, 2019
.travis.yml Remove 1.14 tests as there are test timing issues Mar 8, 2020
CHANGELOG.md v0.6.0 changelog Aug 31, 2019
LICENSE Implement most of the API and a couple of tests Jan 24, 2015
Makefile Ensure all tests in pr-prep make target are run Mar 8, 2020
README.md Added Makefile for contributors to use and updated PR guidelines Feb 24, 2020
TODO.txt Removed Slack prefix from some structs Aug 16, 2015
admin.go refactor to ease testing Apr 4, 2019
attachements_test.go Add unit test for marshal-unmarshal attachment with blocks Nov 29, 2019
attachments.go Ensure we use type Blocks which implements json.Unmarshaler interface Nov 29, 2019
auth.go fix typo in SendAuthRevokeContext doc string Nov 12, 2019
backoff.go obey rate limits during connection setup Apr 4, 2019
block.go Adding support for view interactions as well as input, file, and mult… Feb 19, 2020
block_action.go Refactoring for Blocks and BlockElements May 8, 2019
block_action_test.go Refactoring for Blocks and BlockElements May 8, 2019
block_context.go Refactoring for Blocks and BlockElements May 8, 2019
block_context_test.go Refactoring for Blocks and BlockElements May 8, 2019
block_conv.go Handle all unimplemented blocks with UnknownBlock and remove all but … Feb 27, 2020
block_divider.go Refactoring for Blocks and BlockElements May 8, 2019
block_divider_test.go Changed interfaces to be private, updated related code and tests. Imp… Feb 27, 2019
block_element.go Actually merging in upstream changes Feb 20, 2020
block_element_test.go Actually merging in upstream changes Feb 20, 2020
block_file.go Adding support for view interactions as well as input, file, and mult… Feb 19, 2020
block_file_test.go Adding support for view interactions as well as input, file, and mult… Feb 19, 2020
block_image.go Refactoring for Blocks and BlockElements May 8, 2019
block_image_test.go Changed interfaces to be private, updated related code and tests. Imp… Feb 27, 2019
block_input.go Actually merging in upstream changes Feb 20, 2020
block_input_test.go Actually merging in upstream changes Feb 20, 2020
block_object.go Merge branch 'master' into blockType Mar 8, 2020
block_object_test.go Adapt block tests May 8, 2019
block_section.go Add SectionBlockOption functionality Jun 23, 2019
block_section_test.go Added test with accessory Aug 31, 2019
block_test.go Test fixes after blocks refactoring May 8, 2019
block_unknown.go Handle all unimplemented blocks with UnknownBlock and remove all but … Feb 27, 2020
bots.go Add missing fields from bots.info API call Nov 2, 2019
bots_test.go Add missing fields from bots.info API call Nov 2, 2019
channels.go channels list pagination Dec 9, 2019
chat.go Check params.Channel instead of duplicated params.Cursor check Mar 8, 2020
chat_test.go Ensure we use type Blocks which implements json.Unmarshaler interface Nov 29, 2019
comment.go 🎨 Hygiene, Mostly Related To ID Jul 22, 2015
conversation.go Removing unread count support from conversation history as it is unsu… Nov 2, 2019
conversation_test.go Fix typo in test handlers Aug 9, 2019
dialog.go adds support for dialog text and textarea hints May 8, 2019
dialog_select.go Correct select dialog items' SelectedOptions type Aug 9, 2019
dialog_select_test.go Improve NewGroupedSelectDialog Apr 13, 2019
dialog_test.go Correct select dialog items' SelectedOptions type Aug 9, 2019
dialog_text.go change param to optional param Aug 9, 2019
dialog_text_test.go change param to optional param Aug 9, 2019
dnd.go refactor to ease testing Apr 4, 2019
dnd_test.go refactor to ease testing Apr 4, 2019
emoji.go refactor to ease testing Apr 4, 2019
emoji_test.go refactor to ease testing Apr 4, 2019
errors.go Fix paths Feb 16, 2020
files.go support response urls from slash commands Aug 31, 2019
files_test.go support response urls from slash commands Aug 31, 2019
go.mod Remove nlopes/slack reference in old PR Mar 8, 2020
go.sum Remove nlopes/slack reference in old PR Mar 8, 2020
groups.go Export conversations for testing (#498) Apr 13, 2019
history.go Removing unread count support from conversation history as it is unsu… Nov 2, 2019
im.go Export conversations for testing (#498) Apr 13, 2019
info.go user prefs struct defined and added user prefs getter + chat muting Mar 2, 2020
interactions.go Adding support for view interactions as well as input, file, and mult… Feb 19, 2020
interactions_test.go Actually merging in upstream changes Feb 20, 2020
item.go Pulling changes from joefitzgerald Jul 26, 2015
item_test.go 👕 Fix Lint and Vet Errors Jul 22, 2015
logger.go logging updates Oct 6, 2018
logger_test.go logging updates Oct 6, 2018
messageID.go Simplified ManageConnection to remove unneeded concurrency. Aug 16, 2015
messages.go added clientmsgid to Message struct Feb 28, 2020
messages_test.go change to array file share tests Aug 5, 2018
misc.go support response urls from slash commands Aug 31, 2019
misc_test.go Fix paths Feb 16, 2020
oauth.go Add support for V2 OAuth for granular permissions Feb 24, 2020
pagination.go Add comments (still no nearly enough) Jan 27, 2015
pins.go refactor to ease testing Apr 4, 2019
pins_test.go refactor to ease testing Apr 4, 2019
reactions.go refactor to ease testing Apr 4, 2019
reactions_test.go refactor to ease testing Apr 4, 2019
reminders.go refactor to ease testing Apr 4, 2019
reminders_test.go refactor to ease testing Apr 4, 2019
rtm.go simplify rtm Nov 2, 2019
search.go Add fields to CtxChannel to get search API's response Nov 2, 2019
security.go error cleanup Apr 2, 2019
security_test.go review changes Nov 4, 2018
slack.go Fix paths Feb 16, 2020
slack_test.go Implement most of the API and a couple of tests Jan 24, 2015
slash.go Add fields EnterpriseID and EnterpriseName to SlashCommand (#265) Feb 21, 2018
slash_test.go Add fields EnterpriseID and EnterpriseName to SlashCommand (#265) Feb 21, 2018
stars.go remove commented code Sep 1, 2019
stars_test.go refactor to ease testing Apr 4, 2019
team.go refactor to ease testing Apr 4, 2019
team_test.go refactor to ease testing Apr 4, 2019
usergroups.go Code format updates Feb 24, 2020
usergroups_test.go refactor to ease testing Apr 4, 2019
users.go Fix paths Feb 16, 2020
users_test.go Code format updates Feb 24, 2020
views.go Adding support for view interactions as well as input, file, and mult… Feb 19, 2020
views_test.go Fixing up pkg ref change Feb 19, 2020
webhooks.go Add function to use context in webhook posts Feb 17, 2020
webhooks_go112.go Add function to use context in webhook posts Feb 17, 2020
webhooks_go113.go Add function to use context in webhook posts Feb 17, 2020
webhooks_test.go Format with gofmt -l -s -w Jan 7, 2019
websocket.go simplify rtm Nov 2, 2019
websocket_channels.go patched json Mar 2, 2020
websocket_desktop_notification.go Add support desktop_notification event on rtm. Nov 6, 2019
websocket_dm.go 🔤 Document Websocket Files Aug 3, 2015
websocket_dnd.go Add dnd Mar 5, 2016
websocket_files.go Remove JSONTimeString Jan 30, 2016
websocket_groups.go Fixed unmarshalling for channel rename event. Aug 16, 2015
websocket_internals.go improve disconnect and retry interactions. Aug 31, 2019
websocket_managed_conn.go Add missing subteam_members_changed event mapping Mar 17, 2020
websocket_managed_conn_test.go Fix paths Feb 16, 2020
websocket_misc.go simplify rtm Nov 2, 2019
websocket_mobile_in_app_notification.go add RTM event: mobile_in_app_notification Jan 22, 2020
websocket_pins.go Remove JSONTimeString Jan 30, 2016
websocket_reactions.go Add ItemUser to reactions event Mar 5, 2016
websocket_stars.go Remove JSONTimeString Jan 30, 2016
websocket_subteam.go fix typo Sep 4, 2018
websocket_teams.go Merge pull request #54 from dvdplm/fix/user-is-pointer-in-teamjoinevent Mar 5, 2016

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.