Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.photon.codes/docs/llms.txt

Use this file to discover all available pages before exploring further.

Providers plug into Spectrum’s type system and runtime. Each one exports a callable — call provider.config(...) to register it, and call provider(app) to narrow into its platform-specific instance.

Built-in providers

iMessage

Local, cloud, and dedicated modes. Tapbacks, typing indicators, threaded replies, DMs and groups.

Terminal

Reads stdin, writes stdout. Zero config, great for local development and tests.

WhatsApp Business

Official WhatsApp Business Cloud API. Native reactions and replies, 1:1 conversations only.

Combining providers

Drop any combination into providers:
import { Spectrum } from "spectrum-ts";
import { imessage, terminal, whatsappBusiness } from "spectrum-ts/providers";

const app = await Spectrum({
  projectId: "...",
  projectSecret: "...",
  providers: [
    imessage.config(),
    whatsappBusiness.config({
      accessToken: process.env.WA_TOKEN!,
      phoneNumberId: process.env.WA_NUMBER_ID!,
      appSecret: process.env.WA_SECRET!,
    }),
    terminal.config(),
  ],
});
app.messages merges messages from every provider. The message.platform field tells you which one delivered each message.

Writing your own

If none of the built-ins fit, implement a provider with definePlatform. See Building a custom platform.