[BUG] Endpoint /label/handleLabel retorna sucesso mas não aplica a etiqueta no WhatsApp (Problema JID vs LID)
Welcome!
- [x] Yes, I have searched for similar issues on GitHub and found none.
What did you do?
O endpoint de aplicar etiquetas em contatos (/label/handleLabel) retorna sucesso na requisição ("add": true), porém a tag não é refletida no aplicativo do WhatsApp.
Investigando o comportamento e os logs, foi identificado que o erro ocorre devido à exigência atual do WhatsApp (arquitetura multi-device) de usar o formato LID (@lid) para manipulação de etiquetas, enquanto a Evolution API está forçando o envio em JID (@s.whatsapp.net).
Passos para reproduzir:
Fazer um POST para {{base_url}}/label/handleLabel/{{instance}}
Enviar o body:
JSON { "number": "5551999999999", "labelId": "16", "action": "add" } A API retorna 200 OK com o JID formatado:
JSON [ { "numberJid": "[email protected]", "labelId": "16", "add": true } ]
A etiqueta não é aplicada no celular. Falso positivo.
Teste adicional realizado (A Causa Raiz): Tentei forçar o envio do número já no formato LID no body da requisição (ex: "number": "114087400878253@lid" capturado via webhook de grupo). Ainda assim, a função de formatação interna da Evolution "limpa" a requisição, ignora o @lid e reescreve a saída forçando para @s.whatsapp.net. A biblioteca Baileys processa sem erro, mas o servidor do WhatsApp ignora a ação.
Sugestão de Correção:
A camada de serviço de labels (src/services/whatsapp.service.ts ou label.service.ts) precisa ser ajustada.
Antes de chamar a função do Baileys para aplicar a etiqueta, a Evolution deve consultar/resolver o JID do contato para descobrir o LID correspondente.
Passar o identificador resolvido em @lid para a função de etiquetar do Baileys. Ou, alternativamente, permitir que o endpoint aceite e não sobrescreva a string quando o usuário já enviar com a terminação @lid.
What did you expect?
.
What did you observe instead of what you expected?
.
Screenshots/Videos
.
Which version of the API are you using?
Last, Versão: 2.3.7
What is your environment?
Docker
Other environment specifications
No response
If applicable, paste the log output
No response
Additional Notes
No response
Did you manage to resolve it? I'm having the same unpleasant problem with Chatwoot. It can't be that this only happened to the two of us.
Did you manage to resolve it? I'm having the same unpleasant problem with Chatwoot. It can't be that this only happened to the two of us.
In my case its not in ChatWoot. But check in other issues, a lot of people saying same thing.
I'm having the same problem too.
Problem: WhatsApp stopped reaching Chatwoot even with Evolution connected and the instance paired.
Cause: a webhook set under Settings → Integrations → Webhook was pointing to a firewall-blocked endpoint. Sidekiq went into a retry loop, exhausted its workers, and starved the
processing of new messages from Evolution.
Fix: deleted the webhook under Settings → Integrations. Sidekiq drained and messages came back.
Tip: if messages disappear and the stack looks fine, check the Chatwoot app logs before touching Evolution. Integrations webhooks are blocking — a slow or unreachable destination
kills the whole pipeline.
Poxa, isso é muito necessário.
PR - endpoint syncLabels (não mergeado): https://github.com/EvolutionAPI/evolution-api/pull/2421
I'm having the same problem too.
Olá! Estamos fazendo uma triagem do backlog para reduzir duplicação.
Esta issue reporta o mesmo problema rastreado em #1872. Vamos consolidar as discussões lá para concentrar atenção da maintainer team e evitar fragmentação.
Por favor:
- Acompanhe #1872 para updates
- Adicione lá quaisquer detalhes/logs novos que não estejam no thread original
- Se você acredita que é um problema diferente, comente em #1872 explicando a diferença e podemos reabrir
Obrigado pelo report!