evolution-api icon indicating copy to clipboard operation
evolution-api copied to clipboard

Feature Request: Query contacts by label and return labels in contact/chat endpoints

Open javiermatias opened this issue 7 months ago • 2 comments

🎯 Problem Statement

Welcome!

  • [x] Yes, I have searched for similar requests and did not find a complete solution for this use case.

What type of feature?

Functionality

What is the motivation for the request?

I am using Evolution API with a WhatsApp instance that already has business labels such as:

  • New customer
  • Order complete
  • Follow up

Today I can:

  • list all labels with GET /label/findLabels/{instance}
  • add/remove a label with POST /label/handleLabel/{instance}
  • list contacts with POST /chat/findContacts/{instance}
  • list chats with POST /chat/findChats/{instance}

However, I cannot retrieve the label associations of my contacts.

In practice, this means:

  1. I can see the labels that exist in the account
  2. I can see the contacts/chats that exist in the account
  3. But I cannot know which contact has which label

This makes it difficult to build CRM, segmentation, automation, campaign targeting, and customer status sync using Evolution API.

Current behavior

findContacts and findChats do not return a labels field for each contact/chat.

Also, the where filter in findContacts appears limited to fields like:

  • _id
  • id
  • pushName
  • remoteJid

There is no documented way to filter by label, for example:

{
  "where": {
    "label": "Order complete"
  }
}

### 💡 Proposed Solution

Add support for reading label associations between WhatsApp contacts/chats and labels.

A good solution would be to implement one or more of the following:

1. Include labels in existing contact/chat endpoints

Extend these endpoints:
- `POST /chat/findContacts/{instance}`
- `POST /chat/findChats/{instance}`
- optionally `GET /chat/findChatByRemoteJid`

So each returned contact/chat can include a `labels` array, for example:

```json
{
  "remoteJid": "[email protected]",
  "pushName": "John Doe",
  "labels": [
    {
      "id": "13",
      "name": "Order complete",
      "color": "5"
    },
    {
      "id": "1",
      "name": "New customer",
      "color": "1"
    }
  ]
}


### 🔄 Alternatives Considered

_No response_

### 📊 Priority

Low - Nice to have

### 🧩 Component

None

### 🎯 Use Case

Build CRM, segmentation, automation, campaign targeting, and customer status sync using Evolution API.

### 📝 Additional Context

_No response_

javiermatias avatar Apr 29 '26 04:04 javiermatias

Hi! Great suggestion. Quick question: are the labels actually being applied and visible on your WhatsApp app (mobile/web)?

I ask because the /label/handleLabel endpoint returns success here ("add": true), but the tag is simply not applied on the device.

We did some debugging and found that Evolution is forcing the JID format (@s.whatsapp.net) under the hood, while WhatsApp multi-device now requires the LID format (@lid) for label manipulation. Even if we send the LID directly in the JSON payload, Evolution's internal formatting overwrites it back to JID, causing a false positive.

Is it working completely fine for you on the actual device, or are you just getting the true response from the API without it syncing to WhatsApp?

willzins avatar Apr 29 '26 15:04 willzins

Quem poderia focar nisso?

TiagoGouvea avatar May 13 '26 15:05 TiagoGouvea