open-wa
DocsAPI reference

Session Client API

Generated client method reference for the session namespace.

Session Client API

This page documents 16 schema-registry client methods in the session namespace.

getBatteryLevel

Get phone battery level

Signature client.getBatteryLevel(): Promise<number>

Usage

const result = await client.getBatteryLevel();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<number>

Resolves to number. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<number>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
Aliasessession.getBatteryLevel
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getBatteryLevelgetBatteryLevelActive
AliasGET/api/getBatteryLevelgetBatteryLevelActive

getConnectionState

Get connection state

Signature client.getConnectionState(): Promise<string>

Usage

const result = await client.getConnectionState();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<string>

Resolves to string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<string>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
Aliasessession.getConnectionState
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getConnectionStategetConnectionStateActive
AliasGET/api/getConnectionStategetConnectionStateActive

getFeatures

Get enabled features

Signature client.getFeatures(): Promise<FeatureFlags>

Usage

const result = await client.getFeatures();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<FeatureFlags>
FeatureFlagsView fields

WhatsApp feature flags keyed by name. Values are provider-defined and must be narrowed before use.

In-process Client resolves to Promise<Record<string, unknown>>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property. WhatsApp feature flags keyed by name. Values are provider-defined and must be narrowed before use.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
Aliasessession.getFeatures
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getFeaturesgetFeaturesActive
AliasGET/api/getFeaturesgetFeaturesActive

getHostNumber

Get host phone number

Signature client.getHostNumber(): Promise<string>

Usage

const result = await client.getHostNumber();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<string>

Resolves to string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<string>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
Aliasessession.getHostNumber
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getHostNumbergetHostNumberActive
AliasGET/api/getHostNumbergetHostNumberActive

getLicenseType

Get license type

Signature client.getLicenseType(): Promise<LicenseType \| false>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getLicenseType();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<LicenseType | false>
LicenseTypeView fields

Resolves to LicenseType \| false. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
Aliasessession.getLicenseType
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getLicenseTypegetLicenseTypeActive
AliasGET/api/getLicenseTypegetLicenseTypeActive

getLoadedMessageCount

Get loaded message count

Signature client.getLoadedMessageCount(): Promise<number>

Usage

const result = await client.getAmountOfLoadedMessages();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<number>

Resolves to number. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<number>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
AliasesgetAmountOfLoadedMessages, session.getAmountOfLoadedMessages, session.getLoadedMessageCount
Deprecated aliasesgetAmountOfLoadedMessages, session.getAmountOfLoadedMessages
Licensenone
WAPI overridegetAmountOfLoadedMessages
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getLoadedMessageCountgetLoadedMessageCountActive
Deprecated aliasGET/api/getAmountOfLoadedMessagesgetAmountOfLoadedMessagesDeprecated
AliasGET/api/getLoadedMessageCountgetLoadedMessageCountActive
Deprecated aliasGET/api/session/getAmountOfLoadedMessagessession.getAmountOfLoadedMessagesDeprecated

getMe

Get host account info

Signature client.getMe(): Promise<HostAccount>

Usage

const result = await client.getMe();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<HostAccount>
HostAccountView fields

Host account attributes plus the current account ID. Additional WhatsApp Web attributes vary by version.

In-process Client resolves to Promise<HostAccount>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property. Host account attributes plus the current account ID. Additional WhatsApp Web attributes vary by version.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
Aliasessession.getMe
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getMegetMeActive
AliasGET/api/getMegetMeActive

getProcessStats

Get process statistics

Signature client.getProcessStats(): Promise<ProcessStats>

Usage

const result = await client.getProcessStats();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<ProcessStats>
ProcessStatsView fields

Process diagnostics keyed by process ID. The provider controls each entry; no stable entry shape is guaranteed.

In-process Client resolves to Promise<Record<string, unknown>>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property. Process diagnostics keyed by process ID. The provider controls each entry; no stable entry shape is guaranteed.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
Aliasessession.getProcessStats
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getProcessStatsgetProcessStatsActive
AliasGET/api/getProcessStatsgetProcessStatsActive

getSnapshot

Take screenshot

Signature client.getSnapshot(chatId?: string, width?: number, height?: number): Promise<string>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getSnapshot();

Parameters

Prop

Type

Returns

PropValue
Return typePromise<string>

Resolves to string. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter orderchatId, width, height
Aliasessession.getSnapshot, session.takeScreenshot, takeScreenshot
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getSnapshotgetSnapshotActive
AliasGET/api/getSnapshotgetSnapshotActive
AliasGET/api/session/takeScreenshotsession.takeScreenshotActive
AliasGET/api/takeScreenshottakeScreenshotActive

getUserAgent

Get user agent

Signature client.getUserAgent(userAgent?: string): Promise<string>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getUserAgent();

Parameters

Prop

Type

Returns

PropValue
Return typePromise<string>

Resolves to string. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter orderuserAgent
AliasesgetGeneratedUserAgent, session.getGeneratedUserAgent, session.getUserAgent
Deprecated aliasesgetGeneratedUserAgent, session.getGeneratedUserAgent
Licensenone
WAPI overridegetGeneratedUserAgent
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getUserAgentgetUserAgentActive
Deprecated aliasGET/api/getGeneratedUserAgentgetGeneratedUserAgentDeprecated
AliasGET/api/getUserAgentgetUserAgentActive
Deprecated aliasGET/api/session/getGeneratedUserAgentsession.getGeneratedUserAgentDeprecated

getWAVersion

Get WhatsApp Web version

Signature client.getWAVersion(): Promise<string>

Usage

const result = await client.getWAVersion();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<string>

Resolves to string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<string>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
AliasesgetWhatsAppVersion, session.getWAVersion, session.getWhatsAppVersion
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/getWAVersiongetWAVersionActive
AliasGET/api/getWAVersiongetWAVersionActive
AliasGET/api/getWhatsAppVersiongetWhatsAppVersionActive
AliasGET/api/session/getWhatsAppVersionsession.getWhatsAppVersionActive

healthCheck

Health check

Signature client.healthCheck(): Promise<HealthCheck>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.healthCheck();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<HealthCheck>
HealthCheckView fields

Browser health diagnostics. This is not the Easy API /health HTTP envelope.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API. Browser health diagnostics. This is not the Easy API /health HTTP envelope.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
Aliasessession.healthCheck
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/healthCheckhealthCheckActive
AliasGET/api/healthCheckhealthCheckActive

isPlugged

Check if phone is charging

Signature client.isPlugged(): Promise<boolean>

Usage

const result = await client.getIsPlugged();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<boolean>

Resolves to boolean. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<boolean>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionread
Functionalityboth
Positional parameter order-
AliasesgetIsPlugged, session.getIsPlugged, session.isPlugged
Deprecated aliasesgetIsPlugged, session.getIsPlugged
Licensenone
WAPI overridegetIsPlugged
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/session/isPluggedisPluggedActive
Deprecated aliasGET/api/getIsPluggedgetIsPluggedDeprecated
AliasGET/api/isPluggedisPluggedActive
Deprecated aliasGET/api/session/getIsPluggedsession.getIsPluggedDeprecated

setMyName

Set host name

Signature client.setMyName(name: string): Promise<boolean>

Usage

const result = await client.setMyName("OpenWA Bot");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

Resolves to boolean. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<boolean>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionupdate
Functionalitypersonal-only
Positional parameter ordername
Aliasessession.setDisplayName, session.setMyName, session.setName, setDisplayName
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/session/setNamesetMyNameActive
AliasPUT/api/session/setDisplayNamesession.setDisplayNameActive
AliasPUT/api/session/setMyNamesession.setMyNameActive
AliasPUT/api/setDisplayNamesetDisplayNameActive
AliasPUT/api/setMyNamesetMyNameActive

setMyStatus

Set host status

Signature client.setMyStatus(statusText: string): Promise<boolean>

Usage

const result = await client.setMyStatus("Available");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

Resolves to boolean. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<boolean>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionupdate
Functionalityboth
Positional parameter orderstatusText
Aliasessession.setMyStatus, session.setStatus, session.setStatusText, setStatusText
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/session/setStatussetMyStatusActive
AliasPUT/api/session/setMyStatussession.setMyStatusActive
AliasPUT/api/session/setStatusTextsession.setStatusTextActive
AliasPUT/api/setMyStatussetMyStatusActive
AliasPUT/api/setStatusTextsetStatusTextActive
Insiders

setProfilePicture

Set profile picture

Signature client.setProfilePicture(image: string): Promise<boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.setProfilePicture({
  image: "data:image/png;base64,iVBORw0KGgo...",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

Resolves to boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacesession
Actionupdate
Functionalityboth
Positional parameter orderimage
Aliasessession.setProfilePic, session.setProfilePicture, setProfilePic
Deprecated aliasessession.setProfilePic, setProfilePic
Licenseinsiders
WAPI overridesetProfilePic
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/session/setProfilePicturesetProfilePictureActive
Deprecated aliasPUT/api/session/setProfilePicsession.setProfilePicDeprecated
Deprecated aliasPUT/api/setProfilePicsetProfilePicDeprecated
AliasPUT/api/setProfilePicturesetProfilePictureActive

Was this helpful?

Your answer includes the page path and docs version.

On this page