Skip to Content
Profile

Profile

client.profile is the profile namespace on the zaileys Client. It lets you update your own display name and status text, set or remove a profile picture (yours or a group’s), and read the picture URL and status of any JID. It is a lazily-created ProfileModule — constructed on first access and proxying every call through the live socket.

import { Client } from 'zaileys' const client = new Client({ sessionId: 'default' }) client.on('connect', async () => { await client.profile.setName('Zaileys Bot') await client.profile.setStatus('Powered by zaileys ⚡') const url = await client.profile.getPicture('628xxxxxxxxxx@s.whatsapp.net') console.log('Avatar URL:', url) })
🚫

Every method calls an internal requireSocket() guard. If the client is not connected, the call immediately throws a ZaileysDomainError with code NOT_CONNECTED and message client not connected. Always wait for the 'connect' event (or await client.connect()) before calling any profile method. See Error Handling.

Methods at a glance

MethodSignatureReturnsDescription
setNamesetName(name)Promise<void>Update your profile display name.
setStatussetStatus(status)Promise<void>Update your profile status (the “about” text).
setPicturesetPicture(jid, image)Promise<void>Set the avatar for jid (self or a group).
removePictureremovePicture(jid)Promise<void>Remove the avatar for jid.
getPicturegetPicture(jid, hd?)Promise<string | null>Get the avatar URL for jid.
getStatusgetStatus(jid)Promise<unknown>Fetch the status (about text) of jid.

setName

setName(name: string): Promise<void>

Updates your own profile display name (the name other contacts see).

client.on('connect', async () => { await client.profile.setName('Zaileys Bot') })
ParameterTypeDescription
namestringThe new display name.

setStatus

setStatus(status: string): Promise<void>

Updates your profile status — the short “about” text shown on your profile.

client.on('connect', async () => { await client.profile.setStatus('Available 24/7 ⚡') })
ParameterTypeDescription
statusstringThe new status / about text.

setPicture

setPicture(jid: string, image: Buffer | MediaSource): Promise<void>

Sets the profile picture. The jid defaults to your own account when you pass your self JID; pass a group JID instead to set that group’s avatar (you must be a group admin). The image may be a Buffer or any zaileys MediaSource (URL, path, stream — see Media Processing).

import { readFileSync } from 'node:fs' client.on('connect', async () => { // Set your own avatar from a file (pass your own JID) await client.profile.setPicture('628xxxxxxxxxx@s.whatsapp.net', readFileSync('./avatar.jpg')) // Set a group's avatar from a URL await client.profile.setPicture( '120363000000000000@g.us', 'https://example.com/group-logo.png', ) })
ParameterTypeDescription
jidstringTarget JID. Your self JID for your own avatar, or a group JID for a group avatar.
imageBuffer | MediaSourceThe image to upload.

removePicture

removePicture(jid: string): Promise<void>

Removes the current profile picture for the given JID (your own account or a group you administer).

client.on('connect', async () => { await client.profile.removePicture('628xxxxxxxxxx@s.whatsapp.net') })
ParameterTypeDescription
jidstringTarget JID whose avatar to remove.

getPicture

getPicture(jid: string, hd = false): Promise<string | null>

Returns the profile picture URL for the given JID, or null if the JID has no picture (or it is not visible to you). Pass hd: true to request the full-resolution image URL instead of the small preview.

client.on('connect', async () => { const preview = await client.profile.getPicture('628xxxxxxxxxx@s.whatsapp.net') const fullRes = await client.profile.getPicture('628xxxxxxxxxx@s.whatsapp.net', true) if (preview) console.log('Preview URL:', preview) if (fullRes) console.log('HD URL:', fullRes) })
ParameterTypeDescription
jidstringThe JID to fetch the avatar for (user or group).
hdboolean (default false)true for the full-resolution image URL, false for the preview.

Returns: string | null — the picture URL, or null when unavailable.

getStatus

getStatus(jid: string): Promise<unknown>

Fetches the status (“about” text) of the given JID. The return value is the raw object from the underlying transport layer; read .status and .setAt from it.

client.on('connect', async () => { const status = await client.profile.getStatus('628xxxxxxxxxx@s.whatsapp.net') console.log(status) })
ParameterTypeDescription
jidstringThe JID to fetch the status for.

See also

  • Client & Lifecycle — how to construct the client and connect.
  • Media Processing — the MediaSource shapes accepted by setPicture.
  • Groups — group administration (you must be an admin to set a group avatar).
  • Error HandlingZaileysDomainError codes and catch patterns.
Last updated on