Repository navigation
No está funcionando la solución al bug de remotejid = @lid #2324
Description
Activity
Tambem estou com o mesmo problema
A solução é adicionar um nó de código (JavaScript) no fluxo pra resolver o JID de forma segura, mesmo quando o
remoteJidAltnão vem.O que esse código faz
- Valida se um JID é realmente um WhatsApp válido (
@s.whatsapp.netcom 11 a 15 dígitos). - Primeiro tenta usar o
remoteJid. - Se o
remoteJidfor do tipo@lidou inválido, tenta oremoteJidAlt. - Se nenhum dos dois servir, retorna
null. - No final, ele padroniza a saída, evitando quebrar o fluxo.
Código para o nó Code (JS) no n8n
const jidRegex = /^\d{11,15}@s\.whatsapp\.net$/; const isValidJid = (value) => typeof value === "string" && jidRegex.test(value.trim()); const pickRemoteJid = (json) => { const primary = json?.body?.data?.key?.remoteJid; if (isValidJid(primary)) return { value: primary.trim(), from: "remoteJid" }; const alt = json?.body?.data?.key?.remoteJidAlt; if (isValidJid(alt)) return { value: alt.trim(), from: "remoteJidAlt" }; return { value: null, from: null }; }; for (const item of $input.all()) { const { value, from } = pickRemoteJid(item.json); item.json.remoteJidResolved = value; item.json.remoteJidResolvedFrom = from; item.json.remoteJidIsValid = Boolean(value); } return $input.all();
Como usar depois no fluxo
Após esse nó:
-
Sempre use
remoteJidResolvedcomo JID oficial do cliente -
Pode validar antes com
remoteJidIsValid === true -
Se for
false, você já sabe que veio apenas@lide pode:- Ignorar a mensagem
- Logar para debug
- Tratar como conversa não identificável
Isso elimina o problema do
@lid, evita dependência exclusiva doremoteJidAlte deixa o fluxo bem mais estável.- Valida se um JID é realmente um WhatsApp válido (
renatojuniordw não resolve pois o numero só vem com remoteJid
renatojuniordw não resolve pois o numero só vem com remoteJid
No meu o número aparece em ambos (remoteJid/remoteJidAlt), pesquisando vi pessoas falando que podiam aparece em um ou outro, por isso adicionei está validação.
no meu só aparece remoteJid, testei para 3 numeros
no meu só aparece remoteJid, testei para 3 numeros
Você tá usando qual imagem do evolution? Utilizei uma que só mostrava o remoteJid com @lid, e precisei muda-la para que mostrasse remoteJid e remoteJidAlt.
acabei de resolver mudando a imagem e a versão, rodei evoapicloud/evolution-api:latest
Reacted by Renato BezerraIsso vai resolver. Comece o fluxo a partir deste:
{ "nodes": [ { "parameters": { "httpMethod": "POST", "path": "mensagem-recebida", "options": {} }, "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ -960, 224 ], "id": "9e199461-0f4c-48ee-a544-6536d016f1dd", "name": "Mensagem Recebida", "webhookId": "282cab09-112a-4c89-97a1-8f7663389db8" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "f449fe96-7893-4903-bc88-ef5b5abce3c9", "leftValue": "={{ $json.body.data.key.remoteJid }}", "rightValue": "@lid", "operator": { "type": "string", "operation": "endsWith" } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ -352, 208 ], "id": "53fbf511-e7a0-45e5-98a3-850bce3e7a9b", "name": "Verifica @lid", "alwaysOutputData": false }, { "parameters": { "assignments": { "assignments": [ { "id": "fa705675-b844-4cf1-a23d-868568bdd3fd", "name": "remetente", "value": "={{ $json.body.data.key.remoteJid.split('@') [0] }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -48, 112 ], "id": "45017eba-16d5-4f34-836e-1c3673ddbaa5", "name": "@lid" }, { "parameters": { "assignments": { "assignments": [ { "id": "fa705675-b844-4cf1-a23d-868568bdd3fd", "name": "remetente", "value": "={{ $json.body.data.key.remoteJid.split('@') [0] }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -48, 320 ], "id": "8259c27d-9c9c-4eca-8d5a-7450242555a0", "name": "@whatsapp.net" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "9f76561b-68c6-4faf-8e6d-583850189237", "leftValue": "={{ $json.body.data.key.fromMe }}", "rightValue": "553784110725@s.whatsapp.net", "operator": { "type": "boolean", "operation": "false", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ -704, 224 ], "id": "4b34f529-1f85-4ab0-852c-868c53ed6b36", "name": "Me?", "alwaysOutputData": false }, { "parameters": { "assignments": { "assignments": [ { "id": "fa705675-b844-4cf1-a23d-868568bdd3fd", "name": "remetente", "value": "={{ $json.remetente }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 240, 192 ], "id": "f07252d4-e564-44e7-ab34-ff51ec7bf37a", "name": "Dados" } ], "connections": { "Mensagem Recebida": { "main": [ [ { "node": "Me?", "type": "main", "index": 0 } ] ] }, "Verifica @lid": { "main": [ [ { "node": "@lid", "type": "main", "index": 0 } ], [ { "node": "@whatsapp.net", "type": "main", "index": 0 } ] ] }, "@lid": { "main": [ [ { "node": "Dados", "type": "main", "index": 0 } ] ] }, "@whatsapp.net": { "main": [ [ { "node": "Dados", "type": "main", "index": 0 } ] ] }, "Me?": { "main": [ [ { "node": "Verifica @lid", "type": "main", "index": 0 } ], [] ] } }, "pinData": { "Mensagem Recebida": [ { "headers": { "host": "sistemas-n8n.izzm4q.easypanel.host", "user-agent": "axios/1.10.0", "content-length": "690", "accept": "application/json, text/plain, */*", "accept-encoding": "gzip, compress, deflate, br", "content-type": "application/json", "x-forwarded-for": "172.18.0.1", "x-forwarded-host": "sistemas-n8n.izzm4q.easypanel.host", "x-forwarded-port": "443", "x-forwarded-proto": "https", "x-forwarded-server": "5411e7e6f0d3", "x-real-ip": "172.18.0.1" }, "params": {}, "query": {}, "body": { "event": "messages.upsert", "instance": "ldl", "data": { "key": { "remoteJid": "5521977655252@s.whatsapp.net", "fromMe": true, "id": "3A456053CDADF3FC3B55" }, "pushName": "Loja das Lojas", "status": "SERVER_ACK", "message": { "conversation": "#Jarvis\nAdicione acesso vitalício para\njcsmatta@gmail.com" }, "messageType": "conversation", "messageTimestamp": 1756940767, "instanceId": "7abe36d8-e74b-407c-ad22-2a7d56eb7d5a", "source": "ios" }, "destination": "https://sistemas-n8n.izzm4q.easypanel.host/webhook/mensagem-recebida", "date_time": "2025-09-03T20:06:07.854Z", "sender": "553784110725@s.whatsapp.net", "server_url": "https://sistemas-evolution-api.izzm4q.easypanel.host", "apikey": "C49C1F3B13A9-4B02-95B1-95410D837834" }, "webhookUrl": "https://sistemas-n8n.izzm4q.easypanel.host/webhook/mensagem-recebida", "executionMode": "production" } ] }, "meta": { "instanceId": "b871045089a8444a6a7163962f9f54fc390e770d426ee84b4931263a3abbdf1c" } }
SOLUCIONADO: La última versión de ApiEvolution (v2.3.7) soluciona este bug
Reacted by Luis Fernando Pimentaa versao nova 2.3.7 resolveu o problema do @lid porem o meu sendlist parou, alguem passou por isso tambem?
a versao nova 2.3.7 resolveu o problema do @lid porem o meu sendlist parou, alguem passou por isso tambem?
Me pasa lo mismo y no veo la version 2.3.7
Na evolution 2.3.7 também está acontecendo isso, somente o remoteJid com o lid dentro.
Fala galera! estou com esse problema, no Easypanel a evolution api mostra como ultima versão apenas a v2.3.2 em 12/01/26. não aparece a v2.3.7
Closing as duplicate of #1872 —
@lidhandling meta-issue.See #1872 for tracked symptoms and ongoing work.