imessage, localIMessage,
slack, terminal, whatsappBusiness, telegram — that narrows generic
Spectrum types into platform-specific ones. The same function handles three
different inputs.
Narrowing the app
Pass a to get a for that platform. The platform instance gives youuser() and space.create() / space.get() resolvers, plus access to any custom events the provider emits.
providers array, the type of imessage(app) resolves to never — the call is a compile-time error.
Narrowing a space
Pass an existing space to access platform-specific fields:message.platform (or a similar signal) first to avoid unexpected behavior.
The local macOS provider is a separate platform. Gate on
message.platform === "local_imessage" and narrow with localIMessage(...);
the cloud provider continues to use "imessage" and imessage(...).
Narrowing a message
Same idea for messages — useful when a provider declares amessage.schema to attach extra properties:
Creating group conversations
space.create(...) accepts a single user or an array of users. On iMessage:
params argument for extra space creation options — the shape of those params is defined per-provider through space.params on the platform definition.