Spectrum
Spectrum is Photon's unified messaging SDK. Write your handler logic once against a single app.messages stream and deliver it across every platform — iMessage, WhatsApp Business, your terminal, or a custom platform you build yourself.
The current SDK is spectrum-ts (TypeScript). Spectrum is multi-platform by design and multi-language is on the roadmap — additional language SDKs (e.g. Python, Go, Swift) will join the family. The architecture, primitives, and patterns described in this skill are intended to be language-neutral; code samples in the topic files are currently TypeScript and are flagged where the API surface is language-specific (imports, syntax, runtime types).
How this skill is organized
Each topic lives in its own file in this directory. Read the file relevant to the user's question.
| File | When to consult |
|---|---|
getting-started.md |
Installation, the Spectrum() app instance, multi-platform setup, the four core primitives. |
messages.md |
Receiving messages, the Message shape, narrowing on content.type, filtering own messages. |
content.md |
Content builders for outgoing messages: text, attachment, voice, contact, richlink, poll, group, custom. |
spaces-and-users.md |
The Space interface, typing indicators, responding, creating DMs and groups. |
reactions-and-replies.md |
message.react(...), threaded message.reply(...), when to use which. |
platform-narrowing.md |
Recovering platform-specific types from generic Spectrum primitives. |
providers/imessage.md |
iMessage provider — cloud, local, dedicated modes, line model, per-phone routing, message effects, tapbacks. |
providers/terminal.md |
Terminal TUI provider — chat sidebar, reactions, replies, attachments, slash commands. |
providers/whatsapp-business.md |
WhatsApp Business Cloud API. 1:1 only. |
custom-events-and-lifecycle.md |
Per-provider event streams (app.typing, etc.), app.stop(), signal handling. |
custom-platforms.md |
Authoring your own provider with definePlatform — full field reference. |
best-practices.md |
Production architecture patterns Photon uses internally — debounce pipeline, in-flight cancellation, carry-forward, idempotent retries, per-resource memory, job-failure audit log. |