Reconnects. Backoff. Heartbeats. Slack’s per-method rate limit. Traffic shaping. SlackBot WS handles all of it—and makes building a bot feel like the reason you picked Elixir. This is not a thin API wrapper; it’s an OTP-first Socket Mode runtime.
For slash commands, you declare your command grammar—no regexes or nested conditionals. SlackBot compiles it into a parser at build time.
defmodule MyApp.SlackBot do
use SlackBot, otp_app: :my_app
# /deploy api → %{service: "api"}
# /deploy api canary → %{service: "api", canary?: true}
slash "/deploy" do
grammar do
value :service
optional literal("canary", as: :canary?)
end
handle payload, _ctx do
Deployments.kick(payload["parsed"].service)
end
end
end
Slash commands aren’t the only thing routed this way. Event handlers work the same:
handle_event "app_mention", event, _ctx do
SlackBot.push(MyApp.SlackBot, {"chat.postMessage", %{
channel: event["channel"],
text: "Hi <@#{event["user"]}>!"
}})
end
SlackBot WS handles the tier limits and throttling for you.
And middleware works the way you’d expect if you’re familiar with Plug—just over Slack events instead of HTTP.
defmodule MyApp.LogMiddleware do
def call(_type, payload, ctx) do
Logger.debug("Slack event: #{payload["type"]}")
{:cont, payload, ctx}
end
end
middleware MyApp.LogMiddleware
Return {:cont, payload, ctx} to continue, {:halt, response} to short-circuit.
That’s it. Add your API tokens, supervise the module, ship.
The defaults are production-ready. ETS for cache and event buffer. Sensible backoff. Rate limiting on. You can swap cache adapters if you want to go multi-node, tune timeouts, wire up Telemetry dashboards—but you don’t have to touch any of it until you need to.
SlackBot WS is an extraction of something else I’m building, and I want to share it with those who just want to write Slack bots without the Slack complexity—be they one-off utilities or large bots. Maybe that’s you.






















