Skip to content

Client

Defined in: sdks/js/node-sdk/dist/index.d.ts:1252

Client for interacting with the XMTP network

ContentTypes = ExtractCodecContentTypes

new Client<ContentTypes>(options?): Client<ContentTypes>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1262

Creates a new XMTP client instance

This class is not intended to be initialized directly. Use Client.create or Client.build instead.

ClientOptions

Optional configuration for the client

Client<ContentTypes>

get accountIdentifier(): Identifier | undefined

Defined in: sdks/js/node-sdk/dist/index.d.ts:1320

Gets the account identifier for this client

Identifier | undefined


get appVersion(): string | undefined

Defined in: sdks/js/node-sdk/dist/index.d.ts:1302

Gets the app version used by the client

string | undefined


get conversations(): Conversations<ContentTypes>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1344

Gets the conversations manager for this client

if the client is not initialized

Conversations<ContentTypes>


get debugInformation(): DebugInformation

Defined in: sdks/js/node-sdk/dist/index.d.ts:1350

Gets the debug information helpersfor this client

if the client is not initialized

DebugInformation


get env(): string

Defined in: sdks/js/node-sdk/dist/index.d.ts:1308

Gets the label used for the default database file name

if the client is not initialized

string


get inboxId(): string

Defined in: sdks/js/node-sdk/dist/index.d.ts:1324

Gets the inbox ID associated with this client

string


get installationId(): string

Defined in: sdks/js/node-sdk/dist/index.d.ts:1328

Gets the installation ID for this client

string


get installationIdBytes(): Uint8Array<ArrayBufferLike>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1332

Gets the installation ID bytes for this client

Uint8Array<ArrayBufferLike>


get isRegistered(): boolean

Defined in: sdks/js/node-sdk/dist/index.d.ts:1338

Gets whether the client is registered with the XMTP network

if the client is not initialized

boolean


get libxmtpVersion(): string | undefined

Defined in: sdks/js/node-sdk/dist/index.d.ts:1298

Gets the version of libxmtp used in the bindings

string | undefined


get options(): ClientOptions | undefined

Defined in: sdks/js/node-sdk/dist/index.d.ts:1312

Gets the client options

ClientOptions | undefined


get preferences(): Preferences

Defined in: sdks/js/node-sdk/dist/index.d.ts:1356

Gets the preferences manager for this client

if the client is not initialized

Preferences


get signer(): Signer | undefined

Defined in: sdks/js/node-sdk/dist/index.d.ts:1316

Gets the signer associated with this client

Signer | undefined

archiveMetadata(path, key): Promise<ArchiveMetadata>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1664

Load the metadata for an archive to see what it contains

Reads only the metadata without loading the entire file, so this function is quick.

string

The file path to the archive

Uint8Array

Encryption key for the archive

Promise<ArchiveMetadata>

Promise that resolves with the archive metadata


canMessage(identifiers): Promise<Map<string, boolean>>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1568

Checks if the client can message the specified identifiers

Identifier[]

The identifiers to check

Promise<Map<string, boolean>>

Whether the client can message the identifiers

if the client is not initialized


changeRecoveryIdentifier(identifier): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1560

Changes the recovery identifier for the client’s inbox

Requires a signer, use Client.create to create a client with a signer.

Identifier

The new recovery identifier

Promise<void>

if the client is not initialized

if no signer is available


close(): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1369

Cleanly shuts down the client: cancels in-flight workers and detached streams, then releases the database connection.

This is idempotent — calling it more than once resolves without error. Await this before deleting the database file or dropping the client reference to avoid log noise from background tasks running against a closed database.

Promise<void>

Promise that resolves when the client has shut down

if the client is not initialized


createArchive(path, key, opts?): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1646

Archive application elements to file for later restoration

string

The file path to save the archive

Uint8Array

Encryption key for the archive

ArchiveOptions

Archive options specifying what to include (defaults to consent and messages)

Promise<void>

Promise that resolves when the archive is created


disableNotifications(): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1674

Disable notifications. Per-conversation overrides remain stored.

Promise<void>


enableNotifications(config): Promise<NotificationState>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1672

Enable notifications and register the delivery channel.

NotificationConfig

Promise<NotificationState>


fetchInboxIdByIdentifier(identifier): Promise<string | null>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1601

Fetches the inbox ID for a given identifier from the local database If not found, fetches from the network

Identifier

The identifier to look up

Promise<string | null>

The inbox ID, if found

if the client is not initialized


fetchKeyPackageStatuses(installationIds): Promise<Record<string, KeyPackageStatus>>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1592

Fetches the key package statuses from the network for the specified installation IDs

string[]

The installation IDs to check

Promise<Record<string, KeyPackageStatus>>

The key package statuses

if the client is not initialized


fetchLatestInboxUpdatesCount(inboxIds): Promise<Map<string, number>>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1576

Fetches the latest inbox updates count for the specified inbox IDs

string[]

The inbox IDs to check

Promise<Map<string, number>>

Map of inbox IDs to their updates count

if the client is not initialized


fetchOwnInboxUpdatesCount(): Promise<number>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1583

Fetches the latest inbox updates count for the client’s inbox

Promise<number>

The latest inbox updates count

if the client is not initialized


importArchive(path, key): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1654

Import a previous archive from a file

string

The file path to the archive

Uint8Array

Encryption key for the archive

Promise<void>

Promise that resolves when the archive is imported


init(identifier): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1271

Initializes the client with the provided identifier

This is not meant to be called directly. Use Client.create or Client.build instead.

Identifier

The identifier to initialize the client with

Promise<void>


notificationState(): Promise<NotificationState>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1676

Read the local state without a backend request.

Promise<NotificationState>


refreshServerConfiguration(): Promise<ServerConfiguration>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1701

Fetch the deployment configuration now, rewrite the stored copy, and return what was fetched (spec 006 CFG-082).

The snapshot this client holds is unchanged; use it to observe a change an operator has made without restarting.

Promise<ServerConfiguration>

if the client is not initialized

if the deployment did not answer

if it published an unusable configuration

if it published a different identifier

if it now requires a newer libxmtp


register(): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1500

Registers the client with the XMTP network

Requires a signer, use Client.create to create a client with a signer.

Promise<void>

if the client is not initialized

if no signer is available


removeAccount(identifier): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1529

Removes an account from the client’s inbox

Requires a signer, use Client.create to create a client with a signer.

Identifier

The identifier of the account to remove

Promise<void>

if the client is not initialized

if no signer is available


revokeAllOtherInstallations(): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1538

Revokes all other installations of the client’s inbox

Requires a signer, use Client.create to create a client with a signer.

Promise<void>

if the client is not initialized

if no signer is available


revokeInstallations(installationIds): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1548

Revokes specific installations of the client’s inbox

Requires a signer, use Client.create to create a client with a signer.

Uint8Array<ArrayBufferLike>[]

The installation IDs to revoke

Promise<void>

if the client is not initialized

if no signer is available


serverConfiguration(): ServerConfiguration

Defined in: sdks/js/node-sdk/dist/index.d.ts:1687

What the deployment published about itself, as this client resolved it when it was built (spec 006 CFG-030, CFG-080).

Reads memory and makes no backend request. The value never changes for the life of the client: a background refresh rewrites the stored copy, and a new value takes effect at the next build.

ServerConfiguration

if the client is not initialized


signWithInstallationKey(signatureText): Uint8Array<ArrayBufferLike>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1609

Signs a message with the installation key

string

The text to sign

Uint8Array<ArrayBufferLike>

The signature

if the client is not initialized


syncAllDeviceSyncGroups(): Promise<GroupSyncSummary>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1670

Manually sync all device sync groups

Promise<GroupSyncSummary>

Promise that resolves with a summary of the sync operation


unsafe_addAccount(newAccountSigner, allowInboxReassign?): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1519

Adds a new account to the client inbox

WARNING: This function should be used with caution. Adding a wallet already associated with an inbox ID will cause the wallet to lose access to that inbox.

The allowInboxReassign parameter must be true to reassign an inbox already associated with a different account.

Requires a signer, use Client.create to create a client with a signer.

Signer

The signer for the new account

boolean

Whether to allow inbox reassignment

Promise<void>

if the account is already associated with an inbox ID

if the client is not initialized

if no signer is available


unsafe_addAccountSignatureRequest(newAccountIdentifier, allowInboxReassign?): Promise<SignatureRequestHandle>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1418

Returns a signature request handler for adding a new account to the client’s inbox

WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.

It is highly recommended to use the unsafe_addAccount method instead.

The allowInboxReassign parameter must be true or this function will throw an error.

Identifier

The identifier of the new account

boolean

Whether to allow inbox reassignment

Promise<SignatureRequestHandle>

The signature text

if the client is not initialized


unsafe_addSignature(signatureRequest, signer?): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1386

Adds a signature to a signature request using the client’s signer (or the provided signer)

WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.

It is highly recommended to use the register, unsafe_addAccount, removeAccount, revokeAllOtherInstallations, or revokeInstallations methods instead.

SignatureRequestHandle

The signature request to add the signature to

Signer

Promise<void>

if the client is not initialized

if no signer is available


unsafe_applySignatureRequest(signatureRequest): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1491

Applies a signature request to the client

WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.

It is highly recommended to use the register, unsafe_addAccount, removeAccount, revokeAllOtherInstallations, or revokeInstallations methods instead.

SignatureRequestHandle

Promise<void>

if the client is not initialized


unsafe_changeRecoveryIdentifierSignatureRequest()

Section titled “unsafe_changeRecoveryIdentifierSignatureRequest()”

unsafe_changeRecoveryIdentifierSignatureRequest(identifier): Promise<SignatureRequestHandle>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1477

Returns a signature request handler for changing the recovery identifier for this client’s inbox

WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.

It is highly recommended to use the changeRecoveryIdentifier method instead.

Identifier

The new recovery identifier

Promise<SignatureRequestHandle>

The signature text

if the client is not initialized


unsafe_createInboxSignatureRequest(): Promise<SignatureRequestHandle | null>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1399

Returns a signature request handler for creating a new inbox

WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.

It is highly recommended to use the register method instead.

Promise<SignatureRequestHandle | null>

The signature text

if the client is not initialized


unsafe_removeAccountSignatureRequest(identifier): Promise<SignatureRequestHandle>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1433

Returns a signature request handler for removing an account from the client’s inbox

WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.

It is highly recommended to use the removeAccount method instead.

Identifier

The identifier of the account to remove

Promise<SignatureRequestHandle>

The signature text

if the client is not initialized


unsafe_revokeAllOtherInstallationsSignatureRequest()

Section titled “unsafe_revokeAllOtherInstallationsSignatureRequest()”

unsafe_revokeAllOtherInstallationsSignatureRequest(): Promise<SignatureRequestHandle | null>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1447

Returns a signature request handler for revoking all other installations of the client’s inbox

WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.

It is highly recommended to use the revokeAllOtherInstallations method instead.

Promise<SignatureRequestHandle | null>

The signature text

if the client is not initialized


unsafe_revokeInstallationsSignatureRequest()

Section titled “unsafe_revokeInstallationsSignatureRequest()”

unsafe_revokeInstallationsSignatureRequest(installationIds): Promise<SignatureRequestHandle>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1462

Returns a signature request handler for revoking specific installations of the client’s inbox

WARNING: This function should be used with caution. It is only provided for use in special cases where the provided workflows do not meet the requirements of an application.

It is highly recommended to use the revokeInstallations method instead.

Uint8Array<ArrayBufferLike>[]

The installation IDs to revoke

Promise<SignatureRequestHandle>

The signature text

if the client is not initialized


verifySignedWithInstallationKey(signatureText, signatureBytes): boolean

Defined in: sdks/js/node-sdk/dist/index.d.ts:1618

Verifies a signature was made with the installation key

string

The text that was signed

Uint8Array

The signature bytes to verify

boolean

Whether the signature is valid

if the client is not initialized


static build<ContentCodecs>(identifier, options): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1292

Creates a new client instance with an identifier

Clients created with this method must already be registered. Any methods called that require a signer will throw an error.

ContentCodecs extends ContentCodec[] = []

Identifier

The identifier to use

Omit<NetworkOptions & DeviceSyncOptions & StorageOptions & ContentOptions & OtherOptions, "codecs"> | Omit<object & DeviceSyncOptions & StorageOptions & ContentOptions & OtherOptions, "codecs"> & object

Optional configuration for the client

Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>

A new client instance


static canMessage(identifiers, optionsOrBackend): Promise<Map<string, boolean>>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1624

Check identifiers with an explicit backend or network options.

Identifier[]

NetworkOptions | Backend

Promise<Map<string, boolean>>


static create<ContentCodecs>(signer, options): Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1279

Creates a new client instance with a signer

ContentCodecs extends ContentCodec[] = []

Signer

The signer to use for authentication

Omit<NetworkOptions & DeviceSyncOptions & StorageOptions & ContentOptions & OtherOptions, "codecs"> | Omit<object & DeviceSyncOptions & StorageOptions & ContentOptions & OtherOptions, "codecs"> & object

Optional configuration for the client

Promise<Client<ExtractCodecContentTypes<ContentCodecs>>>

A new client instance


static fetchInboxStates(inboxIds, optionsOrBackend): Promise<InboxState[]>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1620

Fetch inbox states with an explicit backend or network options.

string[]

NetworkOptions | Backend

Promise<InboxState[]>


static fetchLatestInboxUpdatesCount(inboxIds, optionsOrBackend): Promise<Map<string, number>>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1622

Fetch inbox update counts with an explicit backend or network options.

string[]

NetworkOptions | Backend

Promise<Map<string, number>>


static fetchServerConfiguration(target): Promise<ServerConfiguration>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1714

Read what a deployment publishes about itself with no database, no client, and no credential (spec 006 CFG-081, CFG-045).

Lets an app learn auth.enabled, auth.requiredScopes, and the accepted smart contract wallet chains before it decides how to build a client. Nothing is stored and no identifier binding is applied.

string | NetworkOptions | Backend

A backend URL, network options, or an existing backend

Promise<ServerConfiguration>

if the deployment did not answer

if it published an unusable configuration


static isAddressAuthorized(inboxId, address, optionsOrBackend): Promise<boolean>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1635

Check address authorization with an explicit backend or network options.

string

string

NetworkOptions | Backend

Promise<boolean>


static isInstallationAuthorized(inboxId, installation, optionsOrBackend): Promise<boolean>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1637

Check installation authorization with an explicit backend or network options.

string

Uint8Array

NetworkOptions | Backend

Promise<boolean>


static revokeInstallations(signer, inboxId, installationIds, optionsOrBackend): Promise<void>

Defined in: sdks/js/node-sdk/dist/index.d.ts:1550

Revoke installations with an explicit backend or network options.

Signer

string

Uint8Array<ArrayBufferLike>[]

NetworkOptions | Backend

Promise<void>


static verifySignedWithPublicKey(signatureText, signatureBytes, publicKey): boolean

Defined in: sdks/js/node-sdk/dist/index.d.ts:1633

Verifies a signature was made with a public key

string

The text that was signed

Uint8Array

The signature bytes to verify

Uint8Array

The public key to verify against

boolean

Whether the signature is valid