billbarsch / myzap Goto Github PK
View Code? Open in Web Editor NEWFree Open Source Whatsapp Api
Free Open Source Whatsapp Api
Como eu poderia enviar para mais de um numero dentro do sendFile. Quero passar um array de numeros e disparar.
Gostaria de efetuar um client.sendFile multiplo dentro do metodo. Alguem pode ajudar?
static async sendFile(sessionName, number, filePath, fileName, caption) {
var session = Sessions.getSession(sessionName);
if (session) {
if (session.state == "CONNECTED") {
var resultSendFile = await session.client.then(async (client) => {
console.log(filePath);
return await client.sendFile(number + '@c.us', filePath, fileName, caption);
});//client.then(
return { result: "success" };
} else {
return { result: "error", message: session.state };
}
} else {
return { result: "error", message: "NOTFOUND" };
}
}
i'm trying to scan the qr code from my smartphone, but it doesn't recognize it, what should i do?
Como enviar arquivos grandes (maiores que 100Kb). Quando envia o base64, aparece erro de parsing devido ao tamanho.
After QR scan status has not change
So Sentmessage and sendfile is not working
Estou tentando rodar o projeto no Windows sem sucesso.
Tenho instalado o node na máquina e npm.
Os passos que fiz:
git clone https://github.com/billbarsch/myzap.git
cd myzap\
npm install
cp .env-example .env
node index.js
Iniciou o projeto com o código Venon.
No navegador acessei a URL:
http://localhost:3333/start?sessionName=session1
Resultado:
{"result":"success","message":"STARTING"}
No navegador acessei a URL:
http://localhost:3333/qrcode?sessionName=session1&image=true
Resultado:
Mostra o QrCode mas ao tentar ler ele no celular a mensagem é:
Não foi possível ler o código. Certifique-se de que você está no em web.wthatsapp.com e faça a leitura novamente.
Parece que ele desconecta na minha instância atual no Chrome que estava aberta.
No terminal fica assim:
new qrcode updated - session.state: QRCODE
Será que fiz algo de errado?
Será que faltou algo?
Consigo deixar mais de um numero ativo no mesmo app? Exemplo de um SAAS q outros users disparam mensagens automáticas para seus clientes. Vi q no payload tem a questão la session1... seria essas sessions?
Existe a possibilidade de rodar sessoes no whatsapp web e outra pelo venom, quando tenta abrir whatsappweb, derruba o venom, alguem sabe alguma solucao ?
Primeiro parabéns pelo projeto, ótima iniciativa;
Utilizei o Dockerfile pra build do projeto, gerei a image e o container, sobe na porta correta (3333), consigo até criar a session com sucesso, mas quando gero o QR code a leitura não é feita pelo whatsapp, como se este não fosse o QR Code correto, não consigo autenticar pra seguir...alguma sugestão?
Please help
First error "WAPI is not defined"
npm update venom-bot
And http://localhost:3333/start?sessionName=session1
qrcode...session1
(node:23872) UnhandledPromiseRejectionWarning: TypeError: session.qrcode.replace is not a function
at /home/venom/myzap/index.js:45:49
at Layer.handle [as handle_request] (/home/venom/myzap/node_modules/express/lib/router/layer.js:95:5)
at next (/home/venom/myzap/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/venom/myzap/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/venom/myzap/node_modules/express/lib/router/layer.js:95:5)
at /home/venom/myzap/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/home/venom/myzap/node_modules/express/lib/router/index.js:335:12)
at next (/home/venom/myzap/node_modules/express/lib/router/index.js:275:10)
at jsonParser (/home/venom/myzap/node_modules/body-parser/lib/types/json.js:110:7)
at Layer.handle [as handle_request] (/home/venom/myzap/node_modules/express/lib/router/layer.js:95:5)
(Use node --trace-warnings ...
to show where the warning was created)
(node:23872) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:23872) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Tenho recebido a mensagem (algumas vezes) como STARTING, tanto na função de start como na de status. Já testei em localhost e em servidor cloud e ambos se comportam da mesma forma. Mesmo aguardando horas, a mensagem continua a mesma.
Quando está nesta situação, o qrcode também retorna assim, não permitindo a conclusão do processo.
Alguma dica de como resolver?
Quando tento enviar qualquer menssagem com a variavel message?number=55***********&message=oi, recebo a mesagem Cannot GET /message
Bom dia,
poderia me tirar uma duvida ?
Apos ler o QR code , a sessao pareece que nao inicia de imediato no terminal aparece
session.status: inChat , porem ao tentar enviar a mensagem ele da erro QRcode , somente apos uns 3 minutos aparece no terminal as msgs abaixo e ai consigo enviar a mgs , isso acontece na versao antiga que salva os tokens localmente tanto nessa nova atualização que salva na nuvem , como eu poderia resolver isso ?
usou isso no create: null
sessions.js:129
session.state: OPENING
sessions.js:166
session.state: PAIRING
sessions.js:166
tem jsonbinio_secret_key
sessions.js:139
session.state: CONNECTED
sessions.js:166
gravando token na nuvem...
sessions.js:142
{"dados do tokem aqui "}
sessions.js:158
starting...session3
index.js:40
session.state: CONNECTED
sempre que tento fazer um envio de mensagem de texto ele me retorna esse erro, como consigo corrigir isso?
UnhandledPromiseRejectionWarning: Error: Evaluation failed: Error: wid error: invalid wid: @c.us
{
"result": "error",
"message": "QRCODE"
}
mesmo sendo feito a leitura do QRCode e passando o sessionName no método sendText
Direto acontece isso, porém habilitando os logs das mensagens recebidas, aparece as informações recebidas, ou seja, na realidade já está conectado porém o status fica travado como QRCODE, alguém já passou por isso e conseguiu resolver de alguma forma ?
`- Status da sessão: notLogged
Eu consigo parear numa boa, mas quando uso o sendText, me retorna este erro:
UnhandledPromiseRejectionWarning: Error: Evaluation failed: Referen
ceError: WAPI is not defined
Alguém sabe como resolver ?
Alguem pode me ajudar, sou iniciante
`Error:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp.node'
Run "npm rebuild --verbose sharp" and look for errors
Consult the installation documentation at https://sharp.pixelplumbing.com/install
Search for this error at https://github.com/lovell/sharp/issues
at Object. (/home/ademir_mess/myzap/node_modules/venom-bot/node_modules/sharp/lib/constructor.js:34:9)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/ademir_mess/myzap/node_modules/venom-bot/node_modules/sharp/lib/index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:778:30)
`
"Fiz a instalação do zero e execultei o node index.js...apos
resultado:
root@taj:/home/taj/myzap# node index.js
Http server running on port 3000
Apos isso fui no browser e coloquei
http://localhost:3000/start?sessionName=session1
resultado:
For more info visit: https://github.com/orkestral/venom/blob/master/Update.md
Sou leigo no assunto mas acho que deu erro alguem pode me ajudar?
Boa tarde, como faço para pegar o status separado da função initSession...
Via Callback Status Session do venom-bot...
Alguem sabe o motivo da excessão ao iniciar uma nova sessão?
Comecou a ocorter após atualização do projeto.
session == false
newSession.state: STARTING
(node:8501) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
at createError (/downloads/myzap/node_modules/axios/lib/core/createError.js:16:15)
at settle (/downloads/myzap/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/downloads/myzap/node_modules/axios/lib/adapters/http.js:260:11)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:8501) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:8501) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:8501) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
at createError (/downloads/myzap/node_modules/axios/lib/core/createError.js:16:15)
at settle (/downloads/myzap/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/downloads/myzap/node_modules/axios/lib/adapters/http.js:260:11)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:8501) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
I can read the QRCode, however this message appears in console and do not accept POST commands
new qrcode updated - session.state: QRCODE
- Compilation Mutation
- Compilation Mutation
- Injecting Sibionte...
(node:25468) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: WAPI is not defined
at eval (eval at waitForPredicatePageFunction (:2:23), <anonymous>:5:29)
at eval (eval at waitForPredicatePageFunction (:2:23), <anonymous>:6:27)
at onRaf (__puppeteer_evaluation_script__:49:35)
at pollRaf (__puppeteer_evaluation_script__:42:15)
at waitForPredicatePageFunction (__puppeteer_evaluation_script__:7:22)
at ExecutionContext._evaluateInternal (/home/ubuntu/myzap/node_modules/puppeteer/lib/ExecutionContext.js:102:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
-- ASYNC --
at ExecutionContext.<anonymous> (/home/ubuntu/myzap/node_modules/puppeteer/lib/helper.js:94:19)
at WaitTask.rerun (/home/ubuntu/myzap/node_modules/puppeteer/lib/DOMWorld.js:404:71)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:25468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:25468) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
new qrcode updated - session.state: QRCODE
nao manjo de js, mas entendo um pouco de linux. a meu ver está tudo rodando normalmente. mas ao tentar fazer scan do qr code usando a chamada:
http://localhost:3333/qrcode?sessionName=session1&image=true
acaba nao escaneando. nao da mensagem de erro nenhuma no whatsapp do celular. simplesmente não escaneia.
alguém com o mesmo problema?
Seria interessante se tivesse uma opção para definir o retorno da mensagem para cada sessão.
Sessão um post webhook ao receber mensagem.
Seria o Básico para fazer qualquer coisa!
Olá,
Fiz a instalação como esta no tutorial, assisti ao vídeo quando executo o node inde.js o Venom não é carregado, fica apenas informando server running on port 3333 e eu não consigo executar comando algum.
Instalei no ubuntu 20.04
Grato.
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
Amigo passando por um erro aqui
a rota de start está ok! o venom sobe fica atualizando a qrcode.
masquando chamo a rota:
http://localhost:3001/qrcode?sessionName=minhasessao&image=true
tá passando por isso ai não? se passou puder me da um ajuda! valeu
(node:1) UnhandledPromiseRejectionWarning: ReferenceError: qrcodeResult is not defined
node-myzap | at app.get (/index.js:45:17)
node-myzap | at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
node-myzap | at next (/node_modules/express/lib/router/route.js:137:13)
node-myzap | at Route.dispatch (/node_modules/express/lib/router/route.js:112:3)
node-myzap | at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
node-myzap | at /node_modules/express/lib/router/index.js:281:22
node-myzap | at Function.process_params (/node_modules/express/lib/router/index.js:335:12)
node-myzap | at next (/node_modules/express/lib/router/index.js:275:10)
node-myzap | at jsonParser (/node_modules/body-parser/lib/types/json.js:110:7)
node-myzap | at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
node-myzap | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
node-myzap | (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Faço a instalação, mas ao chegar no passo ( npm install ) apresenta o seguinte erro:
node install.js
Downloading Chromium r818858 - 132.1 Mb [====================] 100% 0.0s
Chromium (818858) downloaded to /root/myzap/node_modules/puppeteer/.local-chromium/linux-818858
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
E após isso, se executar o ( node index.js) trava na mensagem abaixo:
Http server running on port 3333
Como posso resolver?
Toda vez que tento enviar um PDF da erro
static async sendFile(sessionName, number, base64Data, fileName, caption) { try { var session = Sessions.getSession(sessionName); if (session) { if (session.state == "QRCODE") { var resultSendFile = await session.client.then(async (client) => { var folderName = fs.mkdtempSync(path.join(os.tmpdir(), session.name + '-')); var filePath = path.join(folderName, fileName); fs.writeFileSync(filePath, base64Data, 'base64'); console.log(filePath); return await client.sendFile('+55' + number + '@c.us', filePath, fileName, caption); });//client.then( return { result: "success" }; } else { return { result: "error", message: session.state }; } } else { return { result: "error", message: "NOTFOUND" }; } } catch (err) { console.log(err); } }
o Erro é este
erro:true filename:'a.pdf' me:{ …} mimeType:'application/pdf' status:'' text:'oi' to:{…} type:'FileFromBase64'
Alguem ja passou por isso?
how to get existing group id ???
https://github.com/joaosouz4/express-zapapi
Segue repo para analise.
Hello,
I've found a bug: Close Session is Not Working.
Não estou conseguindo enviar mensagem.
Sintaxe:
http://localhost:3333/sendText?sessionName=1&number=559xxxxxxxx&text=oi
Abro o browser via debug e tento enviar via POST mas a mensagem nunca chega no destino...
Alguma ideia?
Obrigado
Grupo do WhatsApp está lotado! Favor abrir outro grupo por favor!
Boa tarde amigos.
Ao iniciar a sessão, o retorno é CONNECTED.
Ao buscar o QRCODE, o retorno é false
Alguém está passando por isso? Sabem como me ajudar?
{
"result": "success",
"message": "CONNECTED",
"qrcode": false
}
After scanning QRCode it says:
UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: WAPI is not defined
at eval (eval at waitForPredicatePageFunction (:2:23), <anonymous>:5:29)
at eval (eval at waitForPredicatePageFunction (:2:23), <anonymous>:6:27)
at onRaf (__puppeteer_evaluation_script__:49:35)
at pollRaf (__puppeteer_evaluation_script__:42:15)
at waitForPredicatePageFunction (__puppeteer_evaluation_script__:7:22)
at ExecutionContext._evaluateInternal (/root/Workspace/Whatsapp/myzap/myzap/node_modules/puppeteer/lib/ExecutionContext.js:102:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
-- ASYNC --
at ExecutionContext.<anonymous> (/root/Workspace/Whatsapp/myzap/myzap/node_modules/puppeteer/lib/helper.js:94:19)
at WaitTask.rerun (/root/Workspace/Whatsapp/myzap/myzap/node_modules/puppeteer/lib/DOMWorld.js:404:71)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:22829) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:22829) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Bom dia pessoal, tudo bem ?
Poderiam em indicar a hospedagem que usam pois já tentei hospedar com várias diferentes mas nenhuma delas tem as dependências e não vão instalar. Já tentei KingHost e Umbler mas nada até agora.
Obrigado pela atenção.
Mais alguem problema na rota close ? Ao acessar ela, fica carregando pra sempre, ai é necessario encerrar o processo direto no terminal linux
Estou fazendo chamadas get, mas no respondem. Só as Post,
Alguma idéia do que pode ser?
Envio: http://localhost:3333/getAllChatsNewMsg
Retorno: Cannot GET /getAllChatsNewMsg
Agradeço.
Estou com problemas para enviar audio, quando gravo o áudio no client side com javascript e converto ele para base64 quando envio para o servidor ele entende como documento, na teoria eu acredito que o problema seja na codificação do do formato quando faço a gravação do áudio na web, consegue me ajuda ?
Existe algum endpoint para confirmar caso o qrcode seja lido? alguma maneira de testar ou devo criar este endpoint?
Gostaria de deixar um bot administrando um grupo meu!
E gostaria que ele desse ban para quem falar certas palavras...
Erro ao tentar enviar uma mensagem simples
(node:1333) UnhandledPromiseRejectionWarning: TypeError: client.sendMessageToId is not a function
at session.client.then (/home/leandro/myzap/sessions.js:200:41)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1333) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
Existe alguma limitação de arquivos para serem enviados?
Só estou conseguindo enviar arquivos com uns 100kb, precisave enviar 1,2Mb
I cant send message after scan qrcode.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.