Business Features & Catalogs
Relevant source files
The following files were used as context for generating this wiki page:
The Business Features & Catalogs system provides the infrastructure for interacting with WhatsApp Business-specific functionality. This includes managing business profiles, synchronizing commerce catalogs, managing product listings, and handling order details. It enables developers to automate business presence on the platform, allowing for the programmatical update of business hours, descriptions, and product inventories.
At its core, this module bridges the gap between high-level JavaScript objects (like products and profile settings) and the low-level WABinary nodes or Protobuf messages required by the WhatsApp protocol. It handles complex operations such as lazy-loading product images to WhatsApp's servers before catalog submission and parsing binary response nodes into structured metadata.
Sources: lib/Socket/business.js, lib/Utils/business.js
Business Profile Management
Management of the business profile involves updating public-facing metadata such as the physical address, contact email, description, and business hours. These updates are performed using the updateBussinesProfile function, which constructs a w:biz namespace query.
Profile Fields and Structure
The system supports several primary business profile fields. Simple string fields include address, email, and description. More complex structures exist for websites and business hours.
- Websites: An array of URLs associated with the business.
- Business Hours: A structured object containing a timezone and an array of daily configurations. Each day can have a
mode(e.g.,specific_hours) and specificopen_timeorclose_timein minutes.
Sources: lib/Socket/business.js:15-80
Profile Data Flow
The following diagram illustrates the flow of a profile update request from the application level through node construction to the final binary query sent to WhatsApp.
The diagram shows how various profile components are aggregated into a single binary node for the w:biz mutation.
Sources: lib/Socket/business.js:15-80
Catalog & Product Management
The catalog system allows for full CRUD (Create, Read, Update, Delete) operations on business products. It manages the product lifecycle, including image hosting and metadata parsing.
Product Lifecycle Operations
| Function | Description | Key Requirements |
|---|---|---|
productCreate | Adds a new product to the catalog. | Automatically uploads local images to WA servers. |
productUpdate | Modifies an existing product's details. | Supports partial updates via delta mutations. |
productDelete | Removes one or more products from the catalog. | Requires an array of Product IDs. |
getCatalog | Fetches a list of products for a specific JID. | Supports pagination via cursors and limits. |
Sources: lib/Socket/business.js:134-266, lib/Socket/business.d.ts:7-22
Automated Image Synchronization
Before a product can be created or updated, its images must reside on WhatsApp's media servers. the uploadingNecessaryImagesOfProduct utility checks if provided image URLs are already hosted on .whatsapp.net. If not, it streams the local file or remote buffer, generates a SHA256 hash, and uploads it using the product-catalog-image media type.
Sources: lib/Utils/business.js:148-183
Product Data Structure
Products are parsed from binary nodes into a standard structure using parseProductNode.
The class diagram represents the internal structure of a Product object as it is parsed for use in the library.
Sources: lib/Utils/business.js:122-143, lib/Utils/business.js:194-200
Interactive Business Messaging
Business features extend into the messaging layer through specialized interactive nodes. These nodes are used to display catalogs, product lists, and "Native Flow" buttons (e.g., "Single Select", "CTA Catalog").
The Business Binary Node (biz)
When sending interactive messages, the library often includes a biz binary node to specify the context of the interaction. This is handled by getBizBinaryNode, which determines if the message contains native flows like cta_catalog, mpm (Multi-Product Message), or standard product lists.
| Flow Type | Native Flow Name | Context Description |
|---|---|---|
| Catalog | cta_catalog | Directs user to the full business catalog. |
| Order Details | order_details | Triggered by buttons like review_and_pay. |
| Product List | product_list | Displays a list of specific items in a listMessage. |
| Mixed Flow | mixed | Used for complex interactive messages with multiple button types. |
Sources: lib/WABinary/generic-utils.js:141-218, lib/Utils/messages.js:1159-1163
Native Flow Sequencing
The sequence for sending an interactive business message involves identifying the specific business flow and appending the necessary biz quality control nodes.
This sequence diagram illustrates how business-specific interactive metadata is injected into the message relay process.
Sources: lib/WABinary/generic-utils.js:141-218, assets/buttonsbuilder/MessageBuilder.js:519-536
Collections & Orders
Beyond individual products, the system manages groupings called "Collections" and detailed retrieval of orders.
- Collections: Retrieved via
getCollections, these are sets of products curated by the business. The response includes collection IDs, names, and the list of associated products. - Order Details: The
getOrderDetailsfunction fetches the specifics of a customer's order using anorderIdand a securitytoken. This returns the total price, currency, and the specific items (including quantities and image URLs) contained within the order.
Sources: lib/Socket/business.js:179-232, lib/Utils/business.js:52-71
Conclusion
The Business Features & Catalogs module is an essential component for enterprise-level automation in Baileys. It provides a robust set of tools for profile maintenance and catalog synchronization, ensuring that business data is kept consistent with the WhatsApp platform. By automating the transition from local media to hosted product assets and providing structured access to order details, the system enables complex commerce workflows within the messaging interface.