Whatsapp notifications api for traccar

Gyula Mester3 years ago

https://github.com/gyulamester/traccarapi

A WhatsApp API client that connects through the WhatsApp Web browser app
It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.

NOTE: I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe. This project was based on the pedro lopez code, updated api for whatsapp notifications, this project is not linked to whatsapp

Pt

Um cliente WhatsApp API que se conecta por meio do aplicativo de navegador da Web WhatsApp
Ele usa o Puppeteer para executar uma instância real do Whatsapp Web para evitar o bloqueio.

NOTA: Não posso garantir que você não será bloqueado com esse método, embora tenha funcionado para mim. O WhatsApp não permite bots ou clientes não oficiais em sua plataforma, então isso não deve ser considerado totalmente seguro. Este projeto foi baseado no código pedro lopez, api atualizado para notificações do Whatsapp, este projeto não está vinculado ao Whatsapp

Anton Tananaev3 years ago

Looks awesome. Thanks for sharing.

It would be nice if you could update README formatting to properly format config and code.

Gyula Mester3 years ago

sending an update now :) Anton, I've been using it for almost 1 year, it works very well

Wanderson3 years ago

Vou testar, obrigado por compartilhar!

chuflo3263 years ago

Hi when I run: node simple.js
it gives me this error (I have linux)

internal/modules/cjs/loader.js:638
      throw error;
      ^

Error: Cannot find module 'qrcode-terminal'
      at Function.Module._resolveFilename(internal/modules/cjs/loader.js:636:15)
      at Function.Module._load(internal/modules/cjs/loader.js:562:25)
      in Module.require(internal/modules/cjs/loader.js:692:17)
      on request (internal/modules/cjs/helpers.js:25:18)
      at Object.<anonymous> (/home/gpcamp/traccarapi/simple.js:7:16)
      at Module._compile (internal/modules/cjs/loader.js:778:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
      in 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)

Any Suggestion?

Gyula Mester3 years ago

run in docker, the image is ready

docker pull jcvn/apiwhatsnew

chuflo3263 years ago

I'm sorry but I didn't understand you

LeMrTee3 years ago

Hi.. Can you assist me setup the repo on my server? i always get this error when i try to run node simple.js

Interceptor WhatsApp Rodando na porta 8080
(node:2828775) UnhandledPromiseRejectionWarning: Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (961656).
    at ChromeLauncher.launch (/var/www/html/traccarapi/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:110:27)
(node:2828775) 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:2828775) [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.```
Gyula Mester3 years ago

update by typing npm install

Gyula Mester3 years ago

include in xml / Traccar

web,sms org.traccar.sms.HttpSmsClient http://localhost:8080/enviar? {"destino": "{phone}","mensagem": "{message}", "token": "8s8d9s9fs991"} 60
chuflo3263 years ago

Hello, I managed to run the software, but I don't know how to make it work with traccar.
I did a test from the web: http://ip:8080/enviar?destino={3mi numero}&mensagem={mensaje}&token=8s8d9s9fs991
gives me
Send attempt with invalid token via GET

Gyula Mester3 years ago

open the token file and get the correct key

chuflo3263 years ago

Hello here I have the result of the command: docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jcvn/apiwhatsnew 1.1 6f893eb9dabf 7 weeks ago 1.74GB
but maybe I'm doing something wrong running the image. maybe you can help me

Gyula Mester3 years ago

when running, enter docker terminal run npm update, need to update. find me on Insta by my name that I see a remote access

henry beltran3 years ago

I think this error its about the whatsapp update multidevice:

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFile (node:fs:2106:5)
    at Client.<anonymous> (/root/traccarapi/simple.js:160:6)
    at Client.emit (node:events:394:28)
    at Client.initialize (/root/node_modules/whatsapp-web.js/src/Client.js:223:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_INVALID_ARG_TYPE'

after scan the qr code, result this error

Somebody have the same issue?