A thin Slack Web API client built on Req.
Slack Web API methods are POSTs to https://slack.com/api/<method> with a
bearer token. Note that Slack returns HTTP 200 even on logical failures — the
real status is in the "ok" field of the JSON body, which the helpers here
surface as {:error, reason}.
Tokens:
apps.connections.openneeds an app-level token (xapp-…).- Everything else (e.g.
chat.postMessage) needs a bot token (xoxb-…).
Summary
Functions
Add an emoji reaction (name, no colons) to the message at channel/timestamp
via reactions.add. Needs the reactions:write scope.
Call any Web API method. Returns {:ok, body} when Slack replies ok: true,
otherwise {:error, reason} (the Slack error string, or a transport error).
Open a Socket Mode WebSocket URL via apps.connections.open.
Post a message with chat.postMessage.
Remove a reaction added with add_reaction/4, via reactions.remove.
Functions
@spec add_reaction(String.t(), String.t(), String.t(), String.t()) :: {:ok, map()} | {:error, term()}
Add an emoji reaction (name, no colons) to the message at channel/timestamp
via reactions.add. Needs the reactions:write scope.
Call any Web API method. Returns {:ok, body} when Slack replies ok: true,
otherwise {:error, reason} (the Slack error string, or a transport error).
Open a Socket Mode WebSocket URL via apps.connections.open.
Pass an app-level token (xapp-…) with the connections:write scope.
Post a message with chat.postMessage.
opts is merged into the request body (e.g. %{thread_ts: ..., blocks: ...}).
@spec remove_reaction(String.t(), String.t(), String.t(), String.t()) :: {:ok, map()} | {:error, term()}
Remove a reaction added with add_reaction/4, via reactions.remove.