5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-09-20 02:12:29 +00:00
matterbridge/vendor/github.com/slack-go/slack
2020-07-18 17:27:41 +02:00
..
internal
slackutilsx
.gitignore
.gometalinter.json
.travis.yml Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
admin.go
attachments.go
auth.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
backoff.go
block_action.go
block_context.go
block_conv.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
block_divider.go
block_element.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
block_file.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
block_image.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
block_input.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
block_object.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
block_section.go
block_unknown.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
block.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
bots.go
CHANGELOG.md
channels.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
chat.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
comment.go
conversation.go
dialog_select.go
dialog_text.go
dialog.go
dnd.go
emoji.go
errors.go
files.go
go.mod Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
go.sum Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
groups.go Update dependencies / vendor (#1146) 2020-05-24 00:06:21 +02:00
history.go Update dependencies / vendor (#1146) 2020-05-24 00:06:21 +02:00
im.go
info.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
interactions.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
item.go
LICENSE
logger.go
Makefile Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
messageID.go
messages.go Update dependencies / vendor (#1146) 2020-05-24 00:06:21 +02:00
misc.go
oauth.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
pagination.go
pins.go
reactions.go
README.md
reminders.go
rtm.go
search.go
security.go
slack.go
slash.go
stars.go
team.go
TODO.txt
usergroups.go
users.go Update dependencies / vendor (#1146) 2020-05-24 00:06:21 +02:00
views.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
webhooks_go112.go
webhooks_go113.go
webhooks.go Update dependencies for 1.18.0 release (#1175) 2020-07-18 17:27:41 +02:00
websocket_channels.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
websocket_desktop_notification.go
websocket_dm.go
websocket_dnd.go
websocket_files.go
websocket_groups.go
websocket_internals.go
websocket_managed_conn.go Update dependencies / vendor (#1146) 2020-05-24 00:06:21 +02:00
websocket_misc.go
websocket_mobile_in_app_notification.go Update vendor slack-go/slack (#1068) 2020-03-28 23:50:47 +01:00
websocket_pins.go
websocket_reactions.go
websocket_stars.go
websocket_subteam.go
websocket_teams.go
websocket.go

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