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

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

Open jsmestad opened this issue 5 years ago • 1 comments

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.

jsmestad avatar Dec 20 '20 18:12 jsmestad

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

nacengineer avatar Jul 16 '21 19:07 nacengineer