BlakeWilliams / Elixir-Slack

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

Accessing `apps.events.authorizations.list` or advice on how to add support? #241

Open jsmestad opened 3 years ago

jsmestad commented 3 years ago

I cannot seem to find in the hexdocs any support for the apps.event.authorizations.list endpoint. Did I miss it or is it indeed missing? I am happy to add support for it if anyone can provide some direction on how to do that.

nacengineer commented 2 years ago

I believe this requires a completely different token. I had to do generate an App Level Token in Basic Info on your Bot screen, to do something similar. Then you can fetch it like so (using httppoison)

    case HTTPoison.post(
      "https://slack.com/api/apps.event.authorizations.list",
      "",
      [
        {"Authorization", "Bearer xapp-1-...."},
      ],
      [timeout: 1000, recv_timeout: 1000]
    ) do
      {:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
        {:ok, json} =  Poison.decode!(body)
        IO.inspect(json["url"])
        {:ok, json["url"]}
    end