Skip to content

Client

Defined in: sdks/js/node-sdk/src/Client.ts:91

Client for interacting with the XMTP network

ContentTypes = ExtractCodecContentTypes

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

Defined in: sdks/js/node-sdk/src/Client.ts:110

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/src/Client.ts:239

Gets the account identifier for this client

Identifier | undefined


get appVersion(): string | undefined

Defined in: sdks/js/node-sdk/src/Client.ts:206

Gets the app version used by the client

string | undefined


get conversations(): Conversations<ContentTypes>

Defined in: sdks/js/node-sdk/src/Client.ts:290

Gets the conversations manager for this client

if the client is not initialized

Conversations<ContentTypes>


get debugInformation(): DebugInformation

Defined in: sdks/js/node-sdk/src/Client.ts:302

Gets the debug information helpersfor this client

if the client is not initialized

DebugInformation


get env(): string

Defined in: sdks/js/node-sdk/src/Client.ts:215

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/src/Client.ts:246

Gets the inbox ID associated with this client

string


get installationId(): string

Defined in: sdks/js/node-sdk/src/Client.ts:256

Gets the installation ID for this client

string


get installationIdBytes(): Uint8Array<ArrayBufferLike>

Defined in: sdks/js/node-sdk/src/Client.ts:266

Gets the installation ID bytes for this client

Uint8Array<ArrayBufferLike>


get isRegistered(): boolean

Defined in: sdks/js/node-sdk/src/Client.ts:278

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/src/Client.ts:199

Gets the version of libxmtp used in the bindings

string | undefined


get options(): ClientOptions | undefined

Defined in: sdks/js/node-sdk/src/Client.ts:225

Gets the client options

ClientOptions | undefined


get preferences(): Preferences

Defined in: sdks/js/node-sdk/src/Client.ts:314

Gets the preferences manager for this client

if the client is not initialized

Preferences


get signer(): Signer | undefined

Defined in: sdks/js/node-sdk/src/Client.ts:232

Gets the signer associated with this client

Signer | undefined

archiveMetadata(path, key): Promise<ArchiveMetadata>

Defined in: sdks/js/node-sdk/src/Client.ts:1002

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/src/Client.ts:738

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/src/Client.ts:723

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/src/Client.ts:333

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/src/Client.ts:968

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/src/Client.ts:1043

Disable notifications. Per-conversation overrides remain stored.

Promise<void>


enableNotifications(config): Promise<NotificationState>

Defined in: sdks/js/node-sdk/src/Client.ts:1027

Enable notifications and register the delivery channel.

NotificationConfig

Promise<NotificationState>


fetchInboxIdByIdentifier(identifier): Promise<string | null>

Defined in: sdks/js/node-sdk/src/Client.ts:804

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/src/Client.ts:786

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/src/Client.ts:754

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/src/Client.ts:770

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/src/Client.ts:985

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/src/Client.ts:123

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/src/Client.ts:1053

Read the local state without a backend request.

Promise<NotificationState>


refreshServerConfiguration(): Promise<ServerConfiguration>

Defined in: sdks/js/node-sdk/src/Client.ts:1091

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/src/Client.ts:567

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/src/Client.ts:628

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/src/Client.ts:644

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/src/Client.ts:666

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/src/Client.ts:1070

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/src/Client.ts:819

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/src/Client.ts:1018

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/src/Client.ts:598

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 = false

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/src/Client.ts:432

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 = false

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/src/Client.ts:356

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/src/Client.ts:551

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/src/Client.ts:528

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/src/Client.ts:406

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/src/Client.ts:461

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/src/Client.ts:482

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/src/Client.ts:504

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/src/Client.ts:835

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/src/Client.ts:182

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

DistributiveOmit<ClientOptions, "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/src/Client.ts:885

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/src/Client.ts:154

Creates a new client instance with a signer

ContentCodecs extends ContentCodec[] = []

Signer

The signer to use for authentication

DistributiveOmit<ClientOptions, "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/src/Client.ts:855

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/src/Client.ts:864

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/src/Client.ts:1113

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/src/Client.ts:924

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/src/Client.ts:934

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/src/Client.ts:675

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/src/Client.ts:906

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