Skip to content

No está funcionando la solución al bug de remotejid = @lid #2324

Description

@erikam-stack

Closing as duplicate of #1872 — @lid handling meta-issue.

See #1872 for tracked symptoms and ongoing work.

Activity

  1. JeanLDev commented on Dec 17, 2025

    @JeanLDev

    Tambem estou com o mesmo problema

  2. renatojuniordw commented on Dec 17, 2025

    @renatojuniordw

    A solução é adicionar um nó de código (JavaScript) no fluxo pra resolver o JID de forma segura, mesmo quando o remoteJidAlt não vem.

    O que esse código faz

    • Valida se um JID é realmente um WhatsApp válido (@s.whatsapp.net com 11 a 15 dígitos).
    • Primeiro tenta usar o remoteJid.
    • Se o remoteJid for do tipo @lid ou inválido, tenta o remoteJidAlt.
    • 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 remoteJidResolved como JID oficial do cliente

    • Pode validar antes com remoteJidIsValid === true

    • Se for false, você já sabe que veio apenas @lid e pode:

      • Ignorar a mensagem
      • Logar para debug
      • Tratar como conversa não identificável

    Isso elimina o problema do @lid, evita dependência exclusiva do remoteJidAlt e deixa o fluxo bem mais estável.

  3. JeanLDev commented on Dec 18, 2025

    @JeanLDev

    renatojuniordw não resolve pois o numero só vem com remoteJid

  4. renatojuniordw commented on Dec 18, 2025

    @renatojuniordw

    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.

  5. JeanLDev commented on Dec 18, 2025

    @JeanLDev

    no meu só aparece remoteJid, testei para 3 numeros

  6. renatojuniordw commented on Dec 18, 2025

    @renatojuniordw

    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.

  7. JeanLDev commented on Dec 18, 2025

    @JeanLDev

    acabei de resolver mudando a imagem e a versão, rodei evoapicloud/evolution-api:latest

  8. thallesmitchell commented on Dec 19, 2025

    @thallesmitchell

    Isso 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"
      }
    }
  9. erikam-stack commented on Dec 19, 2025

    @erikam-stack
    Author

    SOLUCIONADO: La última versión de ApiEvolution (v2.3.7) soluciona este bug

  10. marcosserg12 commented on Dec 20, 2025

    @marcosserg12

    a versao nova 2.3.7 resolveu o problema do @lid porem o meu sendlist parou, alguem passou por isso tambem?

  11. palma001 commented on Dec 28, 2025

    @palma001

    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

  12. gmarruda commented on Dec 29, 2025

    @gmarruda

    Na evolution 2.3.7 também está acontecendo isso, somente o remoteJid com o lid dentro.

  13. IsaacFSantos commented on Jan 12, 2026

    @IsaacFSantos

    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

  14. abdulsametkarakayali commented on Sep 3, 2026

    @abdulsametkarakayali

    Had the same symptom described here (remoteJid = @lid with no working
    fallback). Turned out remoteJidAlt was completely missing from the
    message key in my case, not just unresolved — that's what was crashing
    createConversation.

    Submitted a fix: #2718

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions