Skip to main content
BlueBubblesClient is the single entry point for every operation in the BlueBubbles SDK. You construct one instance, pass your server address and credentials, and then call methods on its resource-grouped properties — client.chats, client.messages, client.attachments, and so on — instead of managing URLs or HTTP headers yourself.

Constructing the client

The constructor accepts a partial OpenAPIConfig object so you only need to supply the fields that differ from the defaults. At a minimum, provide BASE (your BlueBubbles Server URL) and PASSWORD (your server password).

Full configuration reference

PASSWORD, TOKEN, USERNAME, and HEADERS each accept either a static value or an async resolver function — (options: ApiRequestOptions) => Promise<T> — so you can fetch credentials dynamically at request time.

Available services

The client exposes eleven service properties, each scoping methods to a particular resource domain. You access them directly on the client instance.

client.chats

Create, query, update, and delete chats. Manage participants, read status, typing indicators, and group icons.

client.messages

Send text messages and attachments, react to messages, query message history, and schedule future messages.

client.attachments

Fetch attachment metadata and download attachment files by GUID.

client.handles

Query and retrieve handle records — the contact addresses associated with iMessage conversations.

client.contacts

Access and search contacts stored on the macOS server.

client.server

Retrieve server metadata, check server health, and read diagnostic information.

client.backups

Manage server-side backups of your iMessage database and settings.

client.fcm

Configure Firebase Cloud Messaging for push notification delivery.

client.icloud

Access iCloud-related operations, including contact card sharing.

client.macos

Execute macOS-level operations on the host machine running BlueBubbles Server.

client.web

Manage web-facing features and webhook configurations.

Usage example

Custom HTTP request backend

The second argument to the constructor is an optional HttpRequest class — any class that extends BaseHttpRequest. By default the SDK uses an internal FetchHttpRequest implementation that calls the native fetch API. You can substitute your own implementation to add logging, retry logic, or use a different transport layer.

The request property

Every BlueBubblesClient instance exposes a request property of type BaseHttpRequest. This gives you direct access to the configured HTTP layer so you can issue raw API calls to endpoints not yet covered by named service methods.
The request property uses the same configuration (BASE URL, credentials, custom headers) you passed to the constructor, so you don’t need to repeat them for raw calls.

Error handling

All service methods return a CancelablePromise and throw an ApiError on non-2xx responses. The ApiError class extends Error and carries structured context about the failure.