Skip to Content
Business & Catalog

Business & Catalog

client.business is the WhatsApp Business namespace on the zaileys Client. It exposes read access to business profiles, product catalogs, collections, and order details, plus write access to create, update, and delete catalog products. It is a lazily-created BusinessModule — 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 () => { const profile = await client.business.profile('628xxxxxxxxxx@s.whatsapp.net') console.log(profile) const catalog = await client.business.catalog({ limit: 10 }) console.log(catalog) })
⚠️

Requires a WhatsApp Business account. These methods only work when the connected account is a WhatsApp Business account (or you are reading another account that is a business). Catalog write operations (createProduct, updateProduct, deleteProduct) act on your own business catalog.

🚫

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()) first. See Error Handling.

Return shapes are raw. Every method returns the raw object from the underlying transport layer (baileys). zaileys does not reshape these — consult the baileys types for the exact fields. The signatures below type returns as unknown; cast or narrow as needed for your use case.

Methods at a glance

MethodSignatureReturnsDescription
profileprofile(jid)Promise<unknown>Fetch a business profile.
catalogcatalog({ jid?, limit?, cursor? })Promise<unknown>Browse a catalog (paginated).
collectionscollections(jid?, limit?)Promise<unknown>List catalog collections.
orderDetailsorderDetails(orderId, tokenBase64)Promise<unknown>Fetch order details.
createProductcreateProduct(create)Promise<unknown>Create a catalog product.
updateProductupdateProduct(productId, update)Promise<unknown>Update a catalog product.
deleteProductdeleteProduct(...productIds)Promise<{ deleted: number }>Delete one or more products.

profile

profile(jid: string): Promise<unknown>

Fetches the business profile for the given JID: description, category, address, hours, websites, and related fields.

client.on('connect', async () => { const profile = await client.business.profile('628xxxxxxxxxx@s.whatsapp.net') console.log(profile) })
ParameterTypeDescription
jidstringThe business account JID.

catalog

catalog(opts?: { jid?: string; limit?: number; cursor?: string }): Promise<unknown>

Browses a product catalog. With no jid, returns your own catalog. Use limit to page size and cursor to paginate.

client.on('connect', async () => { // Your own catalog const mine = await client.business.catalog({ limit: 20 }) // Another business's catalog const theirs = await client.business.catalog({ jid: '628xxxxxxxxxx@s.whatsapp.net', limit: 10, }) console.log(mine, theirs) })
ParameterTypeDescription
opts.jidstring (optional)Target business JID. Omit for your own catalog.
opts.limitnumber (optional)Max products to return.
opts.cursorstring (optional)Pagination cursor from a previous response.

collections

collections(jid?: string, limit?: number): Promise<unknown>

Lists the catalog collections (groupings of products) for a business. Omit jid for your own collections.

client.on('connect', async () => { const collections = await client.business.collections(undefined, 5) console.log(collections) })
ParameterTypeDescription
jidstring (optional)Target business JID. Omit for your own collections.
limitnumber (optional)Max collections to return.

orderDetails

orderDetails(orderId: string, tokenBase64: string): Promise<unknown>

Fetches the details of an order. Both the orderId and the base64 token come from an inbound order message’s payload.

client.on('connect', async () => { const order = await client.business.orderDetails('ORDER_ID', 'BASE64_TOKEN') console.log(order) })
ParameterTypeDescription
orderIdstringThe order identifier.
tokenBase64stringThe base64 order token from the order message.

createProduct

createProduct(create: Record<string, unknown>): Promise<unknown>

Creates a new product in your business catalog. The create payload is passed through to baileys — typical fields include name, price, currency, description, images, and isHidden.

client.on('connect', async () => { const product = await client.business.createProduct({ name: 'Zaileys Sticker Pack', price: 25000, currency: 'IDR', description: 'Official sticker pack.', images: [{ url: 'https://example.com/sticker.png' }], }) console.log('Created:', product) })
ParameterTypeDescription
createRecord<string, unknown>The product payload (passed through to baileys productCreate).

updateProduct

updateProduct(productId: string, update: Record<string, unknown>): Promise<unknown>

Updates an existing catalog product by id. Pass only the fields you want to change.

client.on('connect', async () => { const updated = await client.business.updateProduct('PRODUCT_ID', { price: 30000, isHidden: false, }) console.log('Updated:', updated) })
ParameterTypeDescription
productIdstringThe product id to update.
updateRecord<string, unknown>The fields to change (passed through to baileys productUpdate).

deleteProduct

deleteProduct(...productIds: string[]): Promise<{ deleted: number }>

Deletes one or more catalog products. Returns the count of products that were deleted.

client.on('connect', async () => { const { deleted } = await client.business.deleteProduct('PRODUCT_ID_1', 'PRODUCT_ID_2') console.log(`${deleted} product(s) deleted.`) })
ParameterTypeDescription
productIds...string[]One or more product ids to delete.

Returns: { deleted: number } — the number of products deleted.

See also

Last updated on