Elixir-Slack icon indicating copy to clipboard operation
Elixir-Slack copied to clipboard

Slack RTM breaking changes

Open binaryseed opened this issue 4 years ago • 7 comments

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?
  • I had to use the url /api/rtm.connect to get connected with the Slack API now
  • I had to tweak the Slack callback handle_connect to let you modify the slack portion of the internal state, which is necessary for any following state management to function
  1. Trying to initialize the Slack State requires more than the example code...
  • Slack state expects maps with the id as the key, not just a list
  • Slack state expects atom keys

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

binaryseed avatar Aug 10 '20 20:08 binaryseed

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

neodevelop avatar Sep 02 '20 15:09 neodevelop

@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

acconrad avatar Sep 02 '20 15:09 acconrad

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

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

binaryseed avatar Sep 02 '20 17:09 binaryseed

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

binaryseed avatar Sep 02 '20 17:09 binaryseed

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

acconrad avatar Sep 02 '20 20:09 acconrad

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

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

binaryseed avatar Sep 02 '20 20:09 binaryseed

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

marceldegraaf avatar Sep 02 '22 09:09 marceldegraaf