Labels feature manages WhatsApp chat labels (etiquetas) — the colored tags WhatsApp Business uses to organize chats. Outbound calls create, rename, recolor, or delete labels and add or remove a label on a chat. Inbound label changes made on a linked device (such as WhatsApp Web or the phone) are delivered as events.
Labels sync across all linked devices via WhatsApp’s app state sync mechanism (the regular collection, action version 3).
Access
Access label operations through the client:Create or update a label
create_label
Create a new label or update an existing one. Because app state is an upsert keyed bylabel_id, calling this with an existing label_id renames or recolors that label.
label_id— Stable identifier for the label. Must be non-empty. Reuse the samelabel_idto update the label later.name— Display name shown in the WhatsApp UI. Must be non-empty.color— WhatsApp color index for the label swatch.
Delete a label
delete_label
Delete a label. Existing chat associations are kept by the server; WhatsApp Web prunes them from its local database on receipt of the delete.label_id— The label to delete. Must be non-empty.
Associate a label with a chat
add_chat_label
Tag a chat with a label.label_id— The label to apply. Must be non-empty.chat_jid— The chat to label.
remove_chat_label
Remove a label from a chat.label_id— The label to remove. Must be non-empty.chat_jid— The chat to untag.
Inbound label events
Label changes made on a linked device are delivered through the event bus. Both events carry the underlying app state action so you can read the new name, color, deleted flag, or labeled state directly.from_full_sync is true when the event came from an initial app state full sync, so you can suppress UI notifications during bootstrap.
App state sync
| Action | Collection | Action version |
|---|---|---|
| Create / update / delete label | regular | 3 |
| Add / remove label association | regular | 3 |
App state sync requires the relevant encryption keys, which arrive during initial sync after pairing. Outbound label calls may fail if invoked immediately after pairing before sync completes.
Error handling
All methods returnResult<(), anyhow::Error>. Empty label_id (and empty name for create_label) is rejected before any network work.
Complete example
See also
- Events — Handle
LabelEditUpdateandLabelAssociationUpdate - Chat actions — Archive, pin, mute, star, and other app-state-synced chat operations
- State management — How app state sync works under the hood