Skip to content

Feature request: read WhatsApp Lists / labels (chat and message associations) #394

Description

@betobetico

Summary

wacli has no way to read WhatsApp Lists (the chat filters in the personal app, called labels at the protocol level). Neither the list a chat belongs to, nor the labels attached to an individual message.

This is not a protocol limitation — whatsmeow already decodes all of it. It is just not wired up in wacli.

Why "labels" are the personal-account Lists

Worth stating explicitly, because "labels" reads like a WhatsApp Business–only feature. It is not: WhatsApp's own protobuf models the personal Lists on top of the label app-state. LabelEditAction in proto/waSyncAction/WAWebProtobufSyncAction.proto carries an enum literally named ListType:

message LabelEditAction {
	enum ListType {
		NONE = 0;
		UNREAD = 1;
		GROUPS = 2;
		FAVORITES = 3;
		PREDEFINED = 4;
		CUSTOM = 5;
		COMMUNITY = 6;
		...
		ARCHIVED = 12;
		LOCKED = 13;
		MENTIONS_AND_REPLIES = 17;
	}

	optional string name = 1;
	optional int32 color = 2;
	optional int32 predefinedID = 3;
	optional bool deleted = 4;
	optional int32 orderIndex = 5;
	optional bool isActive = 6;
	optional ListType type = 7;
	optional bool isImmutable = 8;
	optional int64 muteEndTimeMS = 9;
}

UNREAD, GROUPS, FAVORITES, CUSTOM are exactly the filter chips above the chat list, and orderIndex / isActive are their UI state.

What's already available upstream

App-state indices (appstate/keys.go):

  • label_edit — the list/label itself (name, color, order, type)
  • label_jid — chat ↔ label association
  • label_message — message ↔ label association
  • label_reordering, label_sublist

Events (types/events/appstate.go), none of which wacli currently handles:

  • events.LabelEditLabelID, Action *waSyncAction.LabelEditAction
  • events.LabelAssociationChatJID, LabelID, Action.Labeled
  • events.LabelAssociationMessageJID, MessageID, LabelID, Action.Labeled

Current state in wacli

Checked against main (57124e0, 0.17.3-unreleased):

  • internal/store/schema.sqlchats stores archived, pinned, muted_until, unread, unread_count; no label/list column. messages has none either.
  • No events.Label* handler anywhere in the tree.
  • contact_tags exists but is unrelated: docs/contacts.md states aliases and tags are local to wacli and do not touch WhatsApp.

Proposal

Read-only support would already cover most scripting and agent use cases:

  1. Store labels and their associations — e.g. labels(label_id, name, color, type, order_index, is_active, deleted), chat_labels(chat_jid, label_id), message_labels(chat_jid, msg_id, label_id).
  2. Handle events.LabelEdit / LabelAssociationChat / LabelAssociationMessage, and hydrate on full sync.
  3. Surface it:
    • wacli labels list
    • wacli chats list --label NAME (and label_ids in chats list --json / chats show --json)
    • label_ids in messages list --json / messages search --json

Write support (wacli chats label add|rm) would be a natural follow-up, but read-only is the valuable half.

Use case

Triaging an assistant's WhatsApp inbox by the same Lists the user already curates on their phone, instead of maintaining a parallel taxonomy in contact_tags that never stays in sync.

Caveat

Label behaviour on non-business accounts has been reported as flaky elsewhere (e.g. devlikeapro/waha#1581 mentions labels resetting after re-login). Worth validating against a personal account before committing to a schema.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions