New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BREAKING CHANGE] Replace rtm.start with rtm.connect #184
Changes from 1 commit
0545ba6
bdf2f1b
8efc5ad
139b8f5
933bca0
afce9c2
6435955
1c2d347
edd81ca
26a435a
1fd95af
33a01e7
7956cc6
311bbd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"desc": "Gets information about a bot user.", | ||
"args": { | ||
"token": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No other doc file lists token. Listing it results in the following error:
|
||
"example" : "xxxx-xxxxxxxxx-xxxx", | ||
"required": true, | ||
"desc" : "Authentication token bearing required scopes." | ||
}, | ||
"bot": { | ||
"example" : "B12345678", | ||
"required": false, | ||
"desc" : "Bot user to get info on" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,7 @@ defmodule Slack.BotTest do | |
@rtm %{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's best to use a fake test web server here and instead of mocks later on. It's relatively safe to assume that unless Slack API misbehaves, the data will arrive as a well formed JSON. The tests will then catch issues with assuming keys to atoms conversion and others. Mocking results of processing outside data leads to green tests that are likely to lie. |
||
url: "http://example.com", | ||
self: %{name: "fake"}, | ||
team: %{name: "Foo"}, | ||
bots: [%{id: "123"}], | ||
channels: [%{id: "123"}], | ||
groups: [%{id: "123"}], | ||
users: [%{id: "123"}], | ||
ims: [%{id: "123"}] | ||
team: %{name: "Foo"} | ||
} | ||
|
||
test "init formats rtm results properly" do | ||
|
@@ -29,11 +24,13 @@ defmodule Slack.BotTest do | |
assert bot_handler == Bot | ||
assert slack.me.name == "fake" | ||
assert slack.team.name == "Foo" | ||
assert slack.bots == %{"123" => %{id: "123"}} | ||
assert slack.channels == %{"123" => %{id: "123"}} | ||
assert slack.groups == %{"123" => %{id: "123"}} | ||
assert slack.users == %{"123" => %{id: "123"}} | ||
assert slack.ims == %{"123" => %{id: "123"}} | ||
|
||
# TODO: how do we test these now that they are coming from the web API? | ||
# assert slack.bots == %{"123" => %{id: "123"}} | ||
# assert slack.channels == %{"123" => %{id: "123"}} | ||
# assert slack.groups == %{"123" => %{id: "123"}} | ||
# assert slack.users == %{"123" => %{id: "123"}} | ||
# assert slack.ims == %{"123" => %{id: "123"}} | ||
end | ||
|
||
defmodule Stubs.Slack.Rtm do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would kick off 5 different requests at once which I don't think is ideal. Is there no equivalent API to
rtm.start
to bootstrap the client?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't link to it directly, but https://api.slack.com/rtm has
rtm.connect
vsrtm.start
. It looks like both are still valid.I'd be okay with reverting the change to use
rtm.connect
meaning the library will continue to only supportrtm.start
until someone takes the time to addrtm.connect
support (assuming anyone needs it overrtm.start
).That being said, it does look like this approach of making multiple requests is how Slack recommends you use
rtm.connect
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, it will fire off 5 more requests and this is the recommended way to do this. That, and anyone using the Enterprise Grid with
rtm.start
will not work as expected if we stick with the old solution.The other option would be to not populate the slack state object you have in the first place. Save that for when people optimistically decide to pull channels, users, whatever (if ever). What do you think about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true. I'm not super concerned about supporting it but if we want to move forward with this and we get support at the same time I'm all for it 👍