spectrum-ts is a unified messaging SDK for TypeScript. Write your logic once, deliver it across every platform — iMessage, WhatsApp Business, your terminal, or a custom platform you build yourself.
Installation
spectrum-ts is the batteries-included package — it bundles the runtime and every official provider.
@spectrum-ts/core plus only the providers you need:
spectrum-ts/providers/<platform> import paths work as long as the matching provider package is installed.
Requires TypeScript 5 or later (TypeScript 6 is also supported).
Core concepts
Spectrum is built around four primitives:| Primitive | What it represents |
|---|---|
| Message | An incoming piece of content — text, attachments, or structured data — from any platform. |
| Space | A conversation context. A DM, a group chat, a terminal session. You send messages into a space. |
| User | A participant on a platform, identified by a platform-specific ID. |
| Platform provider | A platform adapter (iMessage, terminal, WhatsApp, or your own) that translates platform-specific protocols into Spectrum’s unified interface. |
[Space, Message] tuple. The space gives you the ability to respond; the message gives you the content and metadata.
Quickstart
Get your credentials
Find yourPROJECT_ID and SECRET_KEY in your project Settings on the dashboard.
Run your first app
terminal) can be used without credentials:
The app instance
Spectrum() returns a — an object that merges a message stream with platform-specific custom event streams.
app.webhook() handles both native Spectrum webhooks and Fusor webhooks through the same method. See Webhooks for setup and framework adapters.
Multi-platform in three lines
Combine providers to receive and send across platforms simultaneously:app.messages stream. The message.platform field identifies the source.
Logging
Spectrum emits structured logs across the core runtime and providers. Control the verbosity withlogLevel:
Telemetry
Spectrum has built-in OpenTelemetry instrumentation. Enable it by passingtelemetry: true:
OTEL_EXPORTER_OTLP_* environment variables override the default endpoint and headers.
Calling app.stop() flushes any pending telemetry data before shutting down.