diff --git a/README.md b/README.md index b666b76..ae5a3f7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # Jitsi Slack - Jitsi Meet Integration for Slack -This project provides a Slack integration to enable starting video conferences -from Slack and easily inviting Slack members to conferences. +This project provides a Slack integration to enable starting video +conferences from Slack and easily inviting Slack members to conferences. -Enables starting and joining [Jitsi Meet](https://meet.jit.si) meetings from within [Slack](https://slack.com/) +Enables starting and joining [Jitsi Meet](https://meet.jit.si) meetings from +within [Slack](https://slack.com/) ## Getting Started @@ -13,18 +14,29 @@ on your local machine for development purposes. ### Prerequisites #### Go -A working setup for the Go Programming Language is needed. Here is a [getting started](https://golang.org/doc/install) guide. The project -is currently using go version 1.11 along with module support. +A working setup for the Go Programming Language is needed. Here is a [getting +started](https://golang.org/doc/install) guide. The project is currently +using go version 1.15 along with module support. #### Slack -A slack account needs to be created as well as an [app](https://api.slack.com/apps). The app created is intended for development -purposes. The following functionality must be enabled in the `Add features and functionality` section of the slack app configuration: +NOTE: This project uses the original outdated Slack OAUTH 2.0 flow. Work is in +progress to update this to use Slack's V2 OAUTH 2.0 flow. -* Slash Commands -* Bots +A slack account needs to be created as well as an +[app](https://api.slack.com/apps). The app created is intended for +development purposes. The following functionality must be enabled in the `Add +features and functionality` section of the slack app configuration: -The slash command setup is `/jitsi` and the bot mention name is `@jitsi_meet`. +* App Home + * Bot Name: 'jitsi_meet' +* Slash Commands + * set up '/jitsi' with: https://[server]/slash/jitsi +* OAuth & Permissions + * redirect URL: https://[server]/slack/auth +* Event Subscriptions: + * request URL: https://[server]/slack/event + * Subscribe to workspace events: 'tokens_revoked' ## Configuration @@ -34,8 +46,9 @@ SLACK_CLIENT_ID= SLACK_CLIENT_SECRET= SLACK_APP_ID= SLACK_APP_SHARABLE_URL= -DYNAMO_TABLE= DYNAMO_REGION= +TOKEN_TABLE= +SERVER_CFG_TABLE= JITSI_TOKEN_SIGNING_KEY= JITSI_TOKEN_KID= JITSI_TOKEN_ISS= @@ -43,22 +56,22 @@ JITSI_TOKEN_AUD= JITSI_CONFERENCE_HOST= ``` -## Development -Features are being worked on that assist with local development that remove the need for dynamodb and support a developer's Slack workspace. - ## Running -Clone this project and build with `go build cmd/api/main.go` or build and run with `go run cmd/api/main.go` +Clone this project and build with `go build cmd/api/main.go` or build and run +with `go run cmd/api/main.go` ## Dependency Management -Dependency management for this project uses go module as of go version 1.11. More information can be found at [go command documentation](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more). +Dependency management for this project uses go module as of go version 1.15. +More information can be found at [go command +documentation](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more). ## Versioning -This project uses [Semantic Versioning](https://semver.org) for the code and associated -docker containers. Versions are tracked as [tags](https://github.com/jitsi/jitsi-slack/tags) on this repository. - +This project uses [Semantic Versioning](https://semver.org) for the code and +associated docker containers. Versions are tracked as +[tags](https://github.com/jitsi/jitsi-slack/tags) on this repository. ## License This project is licensed under the Apache 2.0 License [LICENSE](LICENSE) diff --git a/go.mod b/go.mod index 7888628..5aed630 100644 --- a/go.mod +++ b/go.mod @@ -1,20 +1,19 @@ module github.com/jitsi/jitsi-slack +go 1.15 + require ( github.com/aws/aws-sdk-go v1.15.6 github.com/caarlos0/env v3.3.0+incompatible github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/go-ini/ini v1.38.1 // indirect github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect - github.com/gorilla/websocket v1.2.0 // indirect github.com/jtolds/gls v4.2.1+incompatible // indirect github.com/justinas/alice v0.0.0-20171023064455-03f45bd4b7da - github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5 // indirect - github.com/lusis/slack-test v0.0.0-20180109053238-3c758769bfa6 // indirect github.com/mitchellh/mapstructure v1.1.2 - github.com/nlopes/slack v0.3.0 github.com/rs/xid v1.2.0 // indirect github.com/rs/zerolog v1.8.0 + github.com/slack-go/slack v0.8.0 github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect github.com/stretchr/testify v1.3.0 // indirect diff --git a/go.sum b/go.sum index f90c7c1..a28180f 100644 --- a/go.sum +++ b/go.sum @@ -4,40 +4,43 @@ github.com/caarlos0/env v3.3.0+incompatible h1:jCfY0ilpzC2FFViyZyDKCxKybDESTwaR+ github.com/caarlos0/env v3.3.0+incompatible/go.mod h1:tdCsowwCzMLdkqRYDlHpZCp2UooDD3MspDBjZ2AD02Y= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-ini/ini v1.38.1 h1:hbtfM8emWUVo9GnXSloXYyFbXxZ+tG6sbepSStoe1FY= github.com/go-ini/ini v1.38.1/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= +github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ= -github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/justinas/alice v0.0.0-20171023064455-03f45bd4b7da h1:5y58+OCjoHCYB8182mpf/dEsq0vwTKPOo4zGfH0xW9A= github.com/justinas/alice v0.0.0-20171023064455-03f45bd4b7da/go.mod h1:oLH0CmIaxCGXD67VKGR5AacGXZSMznlmeqM8RzPrcY8= -github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5 h1:AsEBgzv3DhuYHI/GiQh2HxvTP71HCCE9E/tzGUzGdtU= -github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5/go.mod h1:c2mYKRyMb1BPkO5St0c/ps62L4S0W2NAkaTXj9qEI+0= -github.com/lusis/slack-test v0.0.0-20180109053238-3c758769bfa6 h1:iOAVXzZyXtW408TMYejlUPo6BIn92HmOacWtIfNyYns= -github.com/lusis/slack-test v0.0.0-20180109053238-3c758769bfa6/go.mod h1:sFlOUpQL1YcjhFVXhg1CG8ZASEs/Mf1oVb6H75JL/zg= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/nlopes/slack v0.3.0 h1:jCxvaS8wC4Bb1jnbqZMjCDkOOgy4spvQWcrw/TF0L0E= -github.com/nlopes/slack v0.3.0/go.mod h1:jVI4BBK3lSktibKahxBF74txcK2vyvkza1z/+rRnVAM= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rs/xid v1.2.0 h1:qRPemPiF/Pl06j+Pp5kjRpgRmUJCsfdPcFo/LZlsobA= github.com/rs/xid v1.2.0/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.8.0 h1:Oglcb4i6h42uWacEjomB2MI8gfkwCwTMFaDY3+Vgj5k= github.com/rs/zerolog v1.8.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/slack-go/slack v0.8.0 h1:ANyLY5KHLV+MxLJDQum2IuHTLwbCbDtaWY405X1EU9U= +github.com/slack-go/slack v0.8.0/go.mod h1:FGqNzJBmxIsZURAxh2a8D21AnOVvvXZvGligs4npPUM= github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY= github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w= github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb h1:lyL3z7vYwTWXf4/bI+A01+cCSnfhKIBhy+SQ46Z/ml8= diff --git a/slack_messages.go b/slack_messages.go index f7b50a9..2c5035a 100644 --- a/slack_messages.go +++ b/slack_messages.go @@ -3,7 +3,7 @@ package jitsi import ( "fmt" - "github.com/nlopes/slack" + "github.com/slack-go/slack" ) var ( @@ -80,24 +80,21 @@ func sendPersonalizedInvite(token, hostID, userID string, meeting *Meeting) erro return err } - params := slack.PostMessageParameters{ - Attachments: []slack.Attachment{ - slack.Attachment{ - Fallback: msg, - Title: msg, - Color: "#3AA3E3", - Actions: []slack.AttachmentAction{ - slack.AttachmentAction{ - Name: "join", - Text: "Join", - Type: "button", - Style: "primary", - URL: meetingURL, - }, + attachments := slack.MsgOptionAttachments( + slack.Attachment{ + Fallback: msg, + Title: msg, + Color: "#3AA3E3", + Actions: []slack.AttachmentAction{ + slack.AttachmentAction{ + Name: "join", + Text: "Join", + Type: "button", + Style: "primary", + URL: meetingURL, }, }, - }, - } + }) channel, _, _, err := slackClient.OpenConversation( &slack.OpenConversationParameters{ @@ -108,7 +105,7 @@ func sendPersonalizedInvite(token, hostID, userID string, meeting *Meeting) erro return err } - _, _, err = slackClient.PostMessage(channel.ID, "", params) + _, _, err = slackClient.PostMessage(channel.ID, slack.MsgOptionText("", false), attachments) return err }