@lastshotlabs/slingshot-interactions
v0.0.2
Published
Interactive message components and dispatch orchestration for slingshot
Readme
title: Human Guide description: Human-maintained guidance for @lastshotlabs/slingshot-interactions
@lastshotlabs/slingshot-interactions provides the dispatch layer for interactive components such as
buttons, menus, and action payloads emitted from chat or community surfaces. It compiles declarative
handler templates, stores interaction events, and exposes one dispatch endpoint for component
actions.
When To Use It
Use this package when your app needs:
- a single backend route for dispatching interactive component actions
- audited interaction events stored as entities
- declarative routing of actions to webhooks, routes, or queues
- optional integration with Slingshot chat and community packages
Do not use it as a generic job queue. This package is specifically for user-triggered interaction dispatch.
What You Need Before Wiring It In
createInteractionsPlugin() depends on:
slingshot-authslingshot-permissions
The plugin throws during setup if shared permissions state is missing.
Minimum Setup
Defaults are:
mountPath: '/interactions'rateLimit.windowMs: 60_000rateLimit.max: 20handlers: {}
The main required work is defining handlers, which map action prefixes to compiled dispatch
targets.
What You Get
The plugin mounts:
POST {mountPath}/dispatch- entity-backed read routes for
interactionEvents
It also:
- compiles declarative handler templates once at plugin construction time
- publishes plugin state under
INTERACTIONS_PLUGIN_STATE_KEY - registers client-safe bus events for
interactions:event.dispatchedandinteractions:event.failed - probes chat and community peers when present so interactions can integrate cleanly with those packages
Common Customization
The main knobs are:
mountPathrateLimithandlers, keyed by action prefix
If you need to extend the system, start in:
src/config/schema.tsfor config shape and defaultssrc/handlers/for template compilation and dispatcher behaviorsrc/routes/dispatchRoute.tsfor the public dispatch endpointsrc/peers/for chat and community integration points
Gotchas
- The longest matching handler prefix wins. Action naming conventions matter because routing is prefix-based, not exact-match only.
- The plugin owns an interaction-event entity surface in addition to the dispatch route. If you remove that entity layer, you also remove auditability.
- Chat and community integrations are optional probes, not hard dependencies. Your handlers should still behave sensibly when those peers are absent.
- Runtime handler registration overlays the compiled config. Treat that as an extension path, not a substitute for keeping manifest config accurate.
Key Files
src/index.tssrc/plugin.tssrc/config/schema.tssrc/components/schema.tssrc/handlers/compile.tssrc/routes/dispatchRoute.tssrc/entities/interactionEvent.ts
