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

Typebot integration sends lid and not jid

Open Ben-Avrahami opened this issue 1 month ago • 21 comments

Welcome!

  • [x] Yes, I have searched for similar issues on GitHub and found none.

What did you do?

When a user sends a message from a Linked Device (Web/Desktop), the remoteJid variable passed to Typebot contains the @lid identifier (e.g., 123456@lid) instead of the standard phone number JID (@s.whatsapp.net).

Since the Typebot integration currently hardcodes the prefilledVariables (as seen in the Documentation), it does not pass the senderPn or remoteJidAlt.

those are the values that the documentation is stating that are being sent to typebot from Evolution-api

const prefilledVariables = { remoteJid: "JID of the contact", pushName: "Contact's name", instanceName: "Name of the instance", serverUrl: "API server URL", apiKey: "Evolution API key", ownerJid: "JID of the number connected to the instance" };

Impact: This renders the native integration unusable for any workflow that requires the user's actual phone number (e.g., looking up a customer in a CRM, sending data to n8n/Webhooks, or authenticating users). There is currently no way to retrieve the actual phone number inside Typebot when the incoming message is from an @lid source.

What did you expect?

Please add senderPn (or remoteJidAlt) to the prefilledVariables object sent to Typebot. This would allow us to access the actual phone number regardless of whether the user is on a phone or a linked device.

What did you observe instead of what you expected?

I observed that when a message when the remoteJid variable passed to Typebot contains the internal @lid identifier (e.g., user_id@lid) instead of the standard phone number JID ([email protected]).

Because the native integration does not pass the senderPn variable (or remoteJidAlt), I am left with no way to retrieve the user's actual phone number inside the Typebot flow.

I expected the integration to either:

Normalize the remoteJid to the standard phone number format, OR

Pass the senderPn variable to Typebot so we can manually retrieve the correct number from Typebot.

Screenshots/Videos

No response

Which version of the API are you using?

Environment:

Version: 2.3.6

Integration: Typebot (Native)

What is your environment?

Linux

Other environment specifications

No response

If applicable, paste the log output

No response

Additional Notes

No response

Ben-Avrahami avatar Nov 24 '25 09:11 Ben-Avrahami

I'm having this problem too

Bonilhajvv avatar Nov 24 '25 11:11 Bonilhajvv

Mesmo problema aqui

maestropsi avatar Nov 24 '25 21:11 maestropsi

Mesma coisa aqui!

gustauobr avatar Nov 25 '25 00:11 gustauobr

PT: Eu resolvi com uma expressão no N8N, nela identifico se o remoteJid vem com @lid, se vier, utiliza o campo remoteJidAlt, se não vier e for @whatsapp.net ele passa o nó pra frente.

EN: I solve this using an expression in N8N. In it, I identify if the remoteJid comes with @lid. If it does, I use the remoteJidAlt field; if it doesn't and is @whatsapp.net, I pass the node to the next page.

code:

{{ ( $('Webhook EVO').item.json.body.data.key.remoteJid.endsWith('@lid') ? $('Webhook EVO').item.json.body.data.key.remoteJidAlt : $('Webhook EVO').item.json.body.data.key.remoteJid ) .toString() .replace(/[\n\r\t ]+/g, '') }}

FernandoBolzan avatar Nov 25 '25 13:11 FernandoBolzan

Eu resolvi com uma expressão, nela identifico se o remoteJid vem com @lid, se vier, utiliza o campo remoteJidAlt, se não vier e for @whatsapp.net ele passa o nó pra frente.

Segue ccódigo: {{ ( $('Webhook EVO').item.json.body.data.key.remoteJid.endsWith('@lid') ? $('Webhook EVO').item.json.body.data.key.remoteJidAlt : $('Webhook EVO').item.json.body.data.key.remoteJid ) .toString() .replace(/[\n\r\t ]+/g, '') }}

this is possible with n8n, but here the problem is with typebot, it is not possible to do it since typebot only receives this data currently const prefilledVariables = { remoteJid: "JID of the contact", pushName: "Contact's name", instanceName: "Name of the instance", serverUrl: "API server URL", apiKey: "Evolution API key", ownerJid: "JID of the number connected to the instance" };

Ben-Avrahami avatar Nov 25 '25 14:11 Ben-Avrahami

Estou com o mesmo problema

raphael0627f avatar Nov 25 '25 15:11 raphael0627f

mesmo problema aqui

marlonvinicius avatar Nov 25 '25 20:11 marlonvinicius

mesmo problema aqui

lucascampuus avatar Nov 26 '25 12:11 lucascampuus

Mesmo problema aqui

kasambr avatar Nov 26 '25 13:11 kasambr

Também… mesmo problema aqui!

DanielBelorini avatar Nov 26 '25 14:11 DanielBelorini

Mesmo problema.

cristiandigisat-hub avatar Nov 26 '25 14:11 cristiandigisat-hub

Estou com o mesmo problema, inicialmente utilizando o o typebot as mensagens do robô não iam por conta do @lid consegui corrigir isso porém com o "Stop bot from me" marcado, quando interajo com o cliente a sessão não muda para pausada, fica aberta e o robô continua atuando, alguém passou por isso e conseguiu resolver?

I'm having the same problem. Initially, using TypeBot, the bot's messages weren't going through because of the @lid attribute. I managed to fix that, but with "Stop bot from me" checked, when I interact with the client, the session doesn't change to paused; it stays open and the bot continues to act. Has anyone else experienced this and managed to solve it?

GustavoCPrado avatar Nov 26 '25 19:11 GustavoCPrado

Estou com o mesmo problema, inicialmente utilizando o o typebot as mensagens do robô não iam por conta do @lid consegui corrigir isso porém com o "Stop bot from me" marcado, quando interajo com o cliente a sessão não muda para pausada, fica aberta e o robô continua atuando, alguém passou por isso e conseguiu resolver?

I'm having the same problem. Initially, using TypeBot, the bot's messages weren't going through because of the @lid attribute. I managed to fix that, but with "Stop bot from me" checked, when I interact with the client, the session doesn't change to paused; it stays open and the bot continues to act. Has anyone else experienced this and managed to solve it?

Como você fez para resolver?

cristiandigisat-hub avatar Nov 26 '25 19:11 cristiandigisat-hub

Estou com o mesmo problema, inicialmente utilizando o o typebot as mensagens do robô não iam por conta do @lid consegui corrigir isso porém com o "Stop bot from me" marcado, quando interajo com o cliente a sessão não muda para pausada, fica aberta e o robô continua atuando, alguém passou por isso e conseguiu resolver? I'm having the same problem. Initially, using TypeBot, the bot's messages weren't going through because of the @lid attribute. I managed to fix that, but with "Stop bot from me" checked, when I interact with the client, the session doesn't change to paused; it stays open and the bot continues to act. Has anyone else experienced this and managed to solve it?

Como você fez para resolver?

Fiz alteração no arquivo: src/api/integrations/chatbot/base-chatbot.service.ts

ANTES: number: remoteJid.split('@')[0]

DEPOIS: number: remoteJid.includes('@lid') ? remoteJid : remoteJid.split('@')[0]

Com isso o typebot passou a responder normalmente.

Lembra de rebuildar e reiniciar o EvolutionAPI depois.

GustavoCPrado avatar Nov 26 '25 20:11 GustavoCPrado

Estou com o mesmo problema, inicialmente utilizando o o typebot as mensagens do robô não iam por conta do @lid consegui corrigir isso porém com o "Stop bot from me" marcado, quando interajo com o cliente a sessão não muda para pausada, fica aberta e o robô continua atuando, alguém passou por isso e conseguiu resolver? I'm having the same problem. Initially, using TypeBot, the bot's messages weren't going through because of the @lid attribute. I managed to fix that, but with "Stop bot from me" checked, when I interact with the client, the session doesn't change to paused; it stays open and the bot continues to act. Has anyone else experienced this and managed to solve it?

Como você fez para resolver?

Fiz alteração no arquivo: src/api/integrations/chatbot/base-chatbot.service.ts

ANTES: number: remoteJid.split('@')[0]

DEPOIS: number: remoteJid.includes('@lid') ? remoteJid : remoteJid.split('@')[0]

Com isso o typebot passou a responder normalmente.

Lembra de rebuildar e reiniciar o EvolutionAPI depois.

Amigo, estou lutando com este erros a semanas. Fiquei um pouco confuso onde está este arquivo src/api/integrations/chatbot/base-chatbot.service.ts? Via docker eu consigo acessar ele?

elizeufranca avatar Nov 26 '25 23:11 elizeufranca

Estou com o mesmo problema, inicialmente utilizando o o typebot as mensagens do robô não iam por conta do @lid consegui corrigir isso porém com o "Stop bot from me" marcado, quando interajo com o cliente a sessão não muda para pausada, fica aberta e o robô continua atuando, alguém passou por isso e conseguiu resolver? I'm having the same problem. Initially, using TypeBot, the bot's messages weren't going through because of the @lid attribute. I managed to fix that, but with "Stop bot from me" checked, when I interact with the client, the session doesn't change to paused; it stays open and the bot continues to act. Has anyone else experienced this and managed to solve it?

Como você fez para resolver?

Fiz alteração no arquivo: src/api/integrations/chatbot/base-chatbot.service.ts ANTES: number: remoteJid.split('@')[0] DEPOIS: number: remoteJid.includes('@lid') ? remoteJid : remoteJid.split('@')[0] Com isso o typebot passou a responder normalmente. Lembra de rebuildar e reiniciar o EvolutionAPI depois.

Amigo, estou lutando com este erros a semanas. Fiquei um pouco confuso onde está este arquivo src/api/integrations/chatbot/base-chatbot.service.ts? Via docker eu consigo acessar ele?

Consegue, só entrar no container e ir dentro da pasta do evolution, depois disso procurar o arquivo no caminho que passei.

GustavoCPrado avatar Nov 27 '25 11:11 GustavoCPrado

remoteJidAlt

Same problem here

dujobi-contato avatar Nov 27 '25 12:11 dujobi-contato

I had the same issue. I downgraded to version v2.3.4 and the problem stopped happening.

leonardomnds avatar Nov 27 '25 12:11 leonardomnds

I had the same issue. I downgraded to version v2.3.4 and the problem stopped happening.

Funcionou! maravilha. Obrigado. Tanks

elizeufranca avatar Nov 27 '25 15:11 elizeufranca

I had the same issue. I downgraded to version v2.3.4 and the problem stopped happening.

What happened? You received jid for everyone? What do you mean the problem stopped happening

Ben-Avrahami avatar Nov 27 '25 17:11 Ben-Avrahami

Obrigado @GustavoCPrado !

Aqui funcionou também!

marlonvinicius avatar Nov 27 '25 17:11 marlonvinicius

no meu conteiner não tem esse arquivo, o mais perto que achei foi evolution/dist/api/integrations/chatbot dentro dessa pasta tem varios arquivos mas nao tem esse base-chatbot.service.ts

srvelososantos avatar Dec 02 '25 01:12 srvelososantos

Image

@srvelososantos, Dependendo da sua instalação... provavelmente no diretório /evolution/dist/api/integrations/chatbot do seu container, vai ver que tem alguns arquivos, semelhantes a este da imagem anexada.

Esse arquivo não aparece no container porque o build remove o código-fonte TypeScript. O .ts original está no repositório, não dentro do dist. No container só existe o resultado compilado/minificado, que vira vários bundles .js dentro de evolution/dist/api/integrations/chatbot. O base-chatbot.service.ts é transformado e incorporado nesses bundles, então ele deixa de existir como arquivo separado.

Você até consegue editar na mão o arquivo base-chatbot.service.js que seria o .js minificado do base-chatbot.service.ts, porém, isso não é recomendado e nada prático (Mas resolve, por um tempo). Melhor solução, na minha opinião, é tratar direto na imagem e depois subir para o hub e usar ela, para se caso, precisar parar ou recriar o container não ter que ficar editando esse arquivo novamente.

DanielBelorini avatar Dec 02 '25 02:12 DanielBelorini

Eu só não entendi por onde que eu edito esse arquivo .ts, eu preciso clonar o repositório do evolution-api ?

srvelososantos avatar Dec 02 '25 12:12 srvelososantos

Mesmo problema aqui! Quando o contato é @LID, simplesmente não identifica a resposta do cliente.

@GustavoCPrado Fiz a edição do parâmetro em todas as linhas que encontrei no base-chatbot.ts. Um exemplo ficou assim:

await new Promise((resolve) => { setTimeout(async () => { await instance.textMessage( { number: remoteJid.includes('@lid') ? remoteJid : remoteJid.split('@')[0], delay: settings?.delayMessage || 1000, text: message, linkPreview, }, false, ); resolve(); }, delay); });

Rebuildei a imagem, subi pro HUB e fiz um novo Deploy.

Estou esquecendo de algo?

willDullius avatar Dec 04 '25 13:12 willDullius

@willDullius eu fiz a mesma coisa, agr o numero pode aparecer ou na variável remoteJid ou remoteJidAlt do webhook, só tratar no seu código. Comigo ta dando certo agora.

srvelososantos avatar Dec 04 '25 19:12 srvelososantos

Mesmo problema aqui! Quando o contato é @lid, simplesmente não identifica a resposta do cliente.

@GustavoCPrado Fiz a edição do parâmetro em todas as linhas que encontrei no base-chatbot.ts. Um exemplo ficou assim:

await new Promise((resolve) => { setTimeout(async () => { await instance.textMessage( { number: remoteJid.includes('@lid') ? remoteJid : remoteJid.split('@')[0], delay: settings?.delayMessage || 1000, text: message, linkPreview, }, false, ); resolve(); }, delay); });

Rebuildei a imagem, subi pro HUB e fiz um novo Deploy.

Estou esquecendo de algo?

Lembrou de rebuildar e reiniciar o EvolutionAPI?

GustavoCPrado avatar Dec 04 '25 22:12 GustavoCPrado

Pessoal, consegui corrigir também o problema do EvolutionAPI com TypeBot que não estava identificando o stop from me.

Quando a conversa caia no typebot ele identificava o @lid nas sessões, mas a conversa não considerava o @lid, ai mesmo um humano interagindo o robô não parava de atual.

GustavoCPrado avatar Dec 05 '25 00:12 GustavoCPrado

I saw a new version is released, with a suggested fix, hope the fix will work

Ben-Avrahami avatar Dec 07 '25 08:12 Ben-Avrahami

I saw a new version is released, with a suggested fix, hope the fix will work

Have you used it before? If so, can you say if the @lid problems were resolved in Typebot?

  • Typebot not responding to @lid numbers
  • Typebot's StopFromMe doesn't work for @lid

GustavoCPrado avatar Dec 08 '25 13:12 GustavoCPrado