BlakeWilliams / Elixir-Slack

Slack real time messaging and web API client in Elixir
MIT License
674 stars 183 forks source link

Slack RTM breaking changes #233

Open binaryseed opened 3 years ago

binaryseed commented 3 years ago

Regarding the note in the Readme about the Slack API changes upon connect (rtm.start).. https://github.com/BlakeWilliams/Elixir-Slack#upgrading-from-0x-to-020

1) I'm getting rate limited errors on even the first attempt to connect. Perhaps the Slack API s now rejecting rtm.start altogether?

2) Trying to initialize the Slack State requires more than the example code...

These could be addressed fairly easily, but I'm not sure if there other implications...

neodevelop commented 3 years ago

Hi @binaryseed ! How are you doing the initializations of the state?

acconrad commented 3 years ago

@binaryseed if you Slack app is new (within the last 1.5 yrs or so) it won't work. See this page for details: https://api.slack.com/methods/rtm.start

binaryseed commented 3 years ago

Here's the changes I made in a branch to make this work..

https://github.com/binaryseed/Elixir-Slack/commit/e9a9395f79e0d58e3ba2dc7811f8dea33bfc9a50

binaryseed commented 3 years ago

And to initialize channels for example, I do this:

  def handle_connect(slack, state) do
    channels =
      Slack.Web.Channels.list(%{token: slack.token})
      |> Map.get(:channels)
      |> Map.new(&{&1.id, &1})

    slack =
      slack
      |> Map.put(:channels, channels)

    {:ok, {slack, state}}
   end
acconrad commented 3 years ago

@binaryseed want to create a pull request? Also please make sure you run the tests to ensure there are no regressions from this change

binaryseed commented 3 years ago

Here we go: https://github.com/BlakeWilliams/Elixir-Slack/pull/235

Likely need to do some docs tweaks alongside it...

marceldegraaf commented 1 year ago

Any news on this change? Just received a "final notice" email from Slack regarding the upcoming changes to rtm.start and rtm.connect:

2022-09-02-11-05-14-QgJIMRUa@2x