Connection modes
- Cloud (default)
- Local
Authenticates with Spectrum Cloud and connects to managed iMessage infrastructure via gRPC. Supports sending, receiving, typing indicators, reactions, and replies. Group creation and inbound group-change events require a dedicated line.With automatic discovery, tokens are renewed at 80% of their TTL. This requires Spectrum discovers all cloud lines owned by the project and renews their tokens automatically. For advanced routing, you can instead provide a subset of the project’s cloud clients:Explicit clients let you control which cloud-owned lines this SDK instance subscribes to. They are still cloud mode. Their tokens are not renewed by the SDK, so you are responsible for keeping them current; most applications should use automatic discovery.
projectId and projectSecret on the Spectrum() call:Line model
Cloud mode routes your messages through phone numbers, also called lines, provisioned by Spectrum. Which lines you get depends on your plan, and the difference is mostly invisible to end users.| Plan | Line allocation | What end users see | Group support |
|---|---|---|---|
| Free / Pro | Shared pool. Each end user is routed through a number from a shared pool. | A normal iMessage from a number that may differ across recipients. | No group creation or inbound group-change events. |
| Business | Dedicated. All end users text the same number, which belongs to your project. | A normal iMessage, always from the same number. | Group creation and inbound group-change events are supported. |
Auto-scale
When traffic to a dedicated line approaches its per-line capacity, Spectrum can automatically provision an additional line so deliverability isn’t affected. Auto-scale is an opt-in feature on the Business plan. Enable it in your project settings if you’d rather not get paged when a line saturates.These are Spectrum Cloud features. In local mode (
imessage.config({ local: true })), you provide your own iCloud account and managed-line concepts do not apply.Quotas
Space types
iMessage spaces carry atype field, either "dm" or "group", and a phone field indicating which phone number the conversation is routed through. Both are accessible through narrowing:
User properties
iMessage users carry optional platform-specific fields when resolved through narrowing. These are available when the platform has sender details for the user:| Field | Type | Description |
|---|---|---|
address | string (optional) | The user’s phone number or email address. |
country | string (optional) | The user’s country code. |
service | "iMessage" | "SMS" | "RCS" | "unknown" (optional) | The messaging service the user is reachable on. |
message.sender after narrowing:
Creating conversations
Resolve users by phone number or email, then create a space withspace.create(...):
space.get(id):
space.create() throws an UnsupportedError. You can use space.get(chatGuid) to reference an existing group, but shared mode still does not receive membership or metadata changes from the group-event stream.
Per-phone routing
If your account has multiple dedicated phone numbers, you can pin a conversation to a specific line by passingphone as a space parameter:
Per-phone routing applies to dedicated lines on the Business plan only. On shared-pool plans the
phone parameter is ignored because all conversations route through the shared pool automatically.