Slink.Identity (Slink v0.6.0)

Copy Markdown View Source

Caches the bot's own identity (auth.test) per token.

This is what fills Slink.Context's :bot_user_id: the transports prewarm the cache (Socket Mode on connect, the Events API plug per request) and stamp the cached id into the handler context, powering Slink.mentions_me?/1.

Reads never block and never touch the network — until the one-off auth.test round-trip completes, bot_user_id/1 is nil. A failed fetch stays uncached, so the next prewarm simply retries.

Summary

Functions

The cached bot user id for token, or nil if not (yet) known.

Returns a specification to start this module under a supervisor.

Fetch and cache the identity for token off-process, unless already cached.

Functions

bot_user_id(token)

The cached bot user id for token, or nil if not (yet) known.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

prewarm(token)

Fetch and cache the identity for token off-process, unless already cached.

Fire-and-forget: the auth.test call runs under Slink.TaskSupervisor, so a slow or failing Slack never blocks the caller (a transport). Safe to call on every event — a cache hit is a single ETS read.

start_link(opts)