TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/wppconnect-team/wa-js/llms.txt
Use this file to discover all available pages before exploring further.
WPP.labels module lets you create, edit, delete, and apply colored label tags to chats in a WhatsApp Business account. Labels appear as colored chip badges on conversations in the chat list, making it easy to categorize leads, orders, support tickets, or any other workflow state without changing the chat itself. Every function in this module enforces a Business account check via assertIsBusiness() and will throw immediately on a personal account.
Labels vs. lists
| Feature | WPP.labels | WPP.lists |
|---|---|---|
| Account type | Business only | Personal and Business |
| Appearance | Colored chip tags on each chat | Named filter tabs at the top of the chat list |
| Multiple per chat | Yes | No |
| Color picker | Yes | Automatic |
WPP.labels when you need per-chat tagging with color coding. Use WPP.lists when you need named tabs that filter the entire chat list.
Color system
Labels use a fixed color palette managed internally by WhatsApp Business. Colors are referenced either as:- A hex string like
'#dfaef0' - A decimal index like
16
getLabelColorPalette() to see all valid hex values, and getNewLabelColor() to get an automatically chosen next color. colorIsInLabelPalette() validates a color before you attempt to create or edit a label.
Functions
getAllLabels
Returns every label defined in the Business account.
Promise<Label[]>
Numeric string identifier for the label (e.g.
'76').Display name of the label.
Asserted hex color string, or
null.Hex color derived from
colorIndex.Integer index into the WhatsApp color palette.
Number of chats that currently have this label applied.
getLabelById
Fetches a single label by its numeric string ID.
Numeric string ID of the label (e.g.
'76').Promise<Label> — same shape as an item from getAllLabels. Throws WPPError with code canot_get_label_error if no label with that ID exists.
addNewLabel
Creates a new label with a given name and optional color. If no color is provided, one is chosen automatically from the palette.
Display name for the new label.
Promise<Label> — the newly created label object.
Throws WPPError with code color_not_in_pallet if the specified color is not in the WhatsApp palette.
editLabel
Renames an existing label and/or changes its color. Fields not included in options are preserved.
Numeric string ID of the label to edit.
Promise<Label> — the updated label object.
Throws WPPError with code label_not_exist if the ID is not found, or color_not_in_pallet if the color is invalid.
deleteLabel
Deletes one label, or an array of labels, by ID.
Numeric string ID of the label to delete when passing a single value.
Array of numeric string IDs when deleting multiple labels in one call.
Promise<DeleteLabelReturn>for a single IDPromise<DeleteLabelReturn[]>for an array of IDs
The label ID that was processed.
true if the label was found and successfully removed, false otherwise.deleteAllLabels
Convenience wrapper that fetches all labels then deletes every one of them in a single operation.
Promise<DeleteLabelReturn[]> — one result entry per deleted label.
addOrRemoveLabels
Applies or removes one or more labels from one or more chats in a single operation.
One chat ID or an array of chat IDs to act on (e.g.
'15551234567@c.us').One operation or an array of operations. Each entry describes a single label action.
Promise<any> — the raw result from LabelStore.addOrRemoveLabels.
getLabelColorPalette
Returns the full list of valid label colors as hex strings.
Promise<string[]> — array of hex color strings in palette order (index 0 is the first color, etc.).
Throws WPPError with code canot_get_color_palette if the palette cannot be retrieved.
getNewLabelColor
Returns the decimal index of the next available (unused) color in the palette, suitable for auto-assigning to a new label.
Promise<number> — a positive decimal integer representing the next color index.
Throws WPPError with code cannot_get_color if the color cannot be determined.
colorIsInLabelPalette
Validates whether a given color (hex string or decimal index) is part of the official WhatsApp Business label palette.
Color to validate. Accepts a hex string (e.g.
'#ffd429') or a decimal index (e.g. 4284794111).Promise<boolean> — true if the color is valid, false otherwise.