SlackBot.Config (slack_bot_ws v0.1.0-rc.2)
View SourceRuntime configuration builder for SlackBot.
The module merges application environment defaults with runtime overrides,
validates required options, and returns a structured %SlackBot.Config{} that
other processes can consume without re-validating input.
Summary
Types
@type t() :: %SlackBot.Config{ ack_client: module(), ack_mode: :silent | :ephemeral | {:custom, (map(), t() -> any())}, api_pool_opts: keyword(), app_token: String.t(), assigns: map(), backoff: %{ min_ms: pos_integer(), max_ms: pos_integer(), max_attempts: pos_integer() | :infinity, jitter_ratio: number() }, block_builder: :none | {:blockbox, keyword()}, bot_token: String.t(), cache: {:ets | :adapter, any()}, cache_sync: %{ enabled: boolean(), interval_ms: pos_integer(), kinds: [atom()], page_limit: pos_integer() | :infinity, include_presence: boolean(), users_conversations_opts: map() }, diagnostics: %{enabled: boolean(), buffer_size: pos_integer()}, event_buffer: {:ets | :adapter, any()}, health_check: %{enabled: boolean(), interval_ms: pos_integer()}, http_client: module(), instance_name: atom() | nil, log_level: Logger.level(), module: module(), rate_limiter: :none | {:adapter, module(), keyword()}, telemetry_prefix: [atom()], telemetry_stats: %{ enabled: boolean(), flush_interval_ms: pos_integer(), ttl_ms: pos_integer() }, transport: module(), transport_opts: keyword(), user_cache: %{ttl_ms: pos_integer(), cleanup_interval_ms: pos_integer()} }
Functions
Builds a %SlackBot.Config{} by merging application environment defaults with the provided opts.
Returns {:ok, config} on success, or {:error, reason} if validation fails.
Examples
# With explicit options
SlackBot.Config.build(
app_token: "xapp-...",
bot_token: "xoxb-...",
module: MyApp.SlackBot
)
#=> {:ok, %SlackBot.Config{...}}
# Missing or empty tokens return errors
SlackBot.Config.build(app_token: "xapp-...", bot_token: "", module: MyBot)
#=> {:error, {:invalid_bot_token, ""}}
Same as build/1, but raises on validation errors.