Slink.Context (Slink v0.1.0)

Copy Markdown View Source

The context passed to Slink.handle_event/2.

Handlers are stateless; the context carries what they need to respond:

  • :transport:socket_mode or :http, whichever delivered the event.
  • :bot_token — the bot token (xoxb-…) for Web API calls, e.g. via send_message/4. May be nil if the transport was started without one.
  • :event — the Slink.Event being handled. Carried here so reply/3 needs only the context (channel and thread come from the event, the token from the context). Set by the dispatcher before your handler runs.

Summary

Types

t()

@type t() :: %Slink.Context{
  bot_token: String.t() | nil,
  event: Slink.Event.t() | nil,
  transport: :socket_mode | :http
}