Connection modes
- Cloud (default)
- Local
- Dedicated
Authenticates with Spectrum Cloud and connects to managed iMessage infrastructure via gRPC. Full feature set: send, receive, typing, reactions, replies, and group creation.Tokens are renewed automatically at 80% of their TTL. Requires
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 |
|---|---|---|
| Free / Pro | Shared pool. Each of your end users is routed through a different number from a shared pool. | A normal iMessage from a number that may differ across recipients. |
| Business | Dedicated. All of your end users text the same number, which belongs to your project. | A normal iMessage, always from the same number. |
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 managed Spectrum Cloud features. If you’re on the open-source path (
imessage.config({ local: true }) or your own dedicated relay), you provide your own iCloud account and managed-line concepts don’t 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 because the local Messages database doesn’t expose chat creation. Shared mode cannot create group chats. Use a dedicated number, or space.get(chatGuid) for an existing group.
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.