jido_chat_slack is the Slack adapter package for jido_chat.
This package is experimental and pre-1.0. APIs and behavior will change. It is part of the Elixir implementation aligned to the Vercel Chat SDK (chat-sdk.dev/docs).
Jido.Chat.Slack.Adapter is the canonical adapter module and uses Slack's
HTTP APIs via Req.
Jido.Chat.Slack.Channel is kept as a compatibility wrapper for legacy
Jido.Chat.Channel integrations.
def deps do
[
{:jido_chat, github: "agentjido/jido_chat", branch: "main"},
{:jido_chat_slack, github: "agentjido/jido_chat_slack", branch: "main"}
]
endalias Jido.Chat.Slack.Adapter
{:ok, incoming} =
Adapter.transform_incoming(%{
"type" => "message",
"channel" => "C123",
"user" => "U456",
"text" => "hello",
"ts" => "1706745600.000100"
})
{:ok, sent} =
Adapter.send_message("C123", "hi",
token: System.fetch_env!("SLACK_BOT_TOKEN")
)You can pass :token and :signing_secret per call, or configure globally:
config :jido_chat_slack, :slack_bot_token, System.get_env("SLACK_BOT_TOKEN")
config :jido_chat_slack, :slack_signing_secret, System.get_env("SLACK_SIGNING_SECRET")
config :jido_chat_slack, :slack_app_token, System.get_env("SLACK_APP_TOKEN")Jido.Chat.Slack.Adapter.listener_child_specs/2 supports:
ingress.mode = "webhook": no listener workers ({:ok, []}), host HTTP handles Events API, Interactivity, and Slash Command ingress.ingress.mode = "socket_mode": startsSocketModeWorker, opens Slack Socket Mode using an app-level token (xapp-...), acks envelopes, and emits payloads throughsink_mfa.
Slack history fetches currently support backward pagination only. Passing
direction: :forward returns {:error, :unsupported_direction} instead of
silently ignoring the option.
For interaction responses, you can either:
- set
chat.metadata[:slack_response]inside a slash/action/modal handler when using webhook ingress, or - provide
response_builder/slack_response_builderin webhook opts or Socket Mode ingress settings to build inline Slack response payloads.
Example:
Jido.Chat.Slack.Adapter.listener_child_specs("bridge_slack",
ingress: %{
mode: "socket_mode",
app_token: System.fetch_env!("SLACK_APP_TOKEN"),
response_builder: fn %{sink_result: sink_result} ->
case sink_result do
{:reply, payload} -> payload
_ -> nil
end
end
},
sink_mfa: {Jido.Messaging.IngressSink, :emit, [MyApp.Messaging, "bridge_slack"]}
)