Giter VIP home page Giter VIP logo

codigoencasa / bot-whatsapp Goto Github PK

View Code? Open in Web Editor NEW
2.2K 53.0 761.0 17.97 MB

馃 Crear Chatbot WhatsApp en minutos. 脷nete a este proyecto OpenSource (Typescript Version Pronto)

Home Page: https://bot-whatsapp.netlify.app

License: MIT License

JavaScript 13.77% Shell 0.02% TypeScript 80.96% Dockerfile 5.24%
bot dialogflow chatbot whatsapp-bot mongodb mysql nodejs chatgpt docker hacktoberfest

bot-whatsapp's People

Contributors

andresayac avatar arcanoix avatar aurik3 avatar bandhiyahardik avatar c4rlos-moran avatar cheveguerra avatar danielcasta0398 avatar devrlbusiness avatar enrique-holguin avatar github-actions[bot] avatar gonzalito87 avatar gregoriotecnico avatar hchumpitaz avatar hkong31 avatar jcdevsoft avatar jhonarias13 avatar jlferrete avatar leifermendez avatar leifermendezfroged avatar lisandroprada avatar marianarolfo avatar nachoestevo avatar ozzyoss77 avatar rodrimarchese avatar ronadames avatar trystan4861 avatar vicente1992 avatar william-monroy avatar yond1994 avatar zamphiropolos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bot-whatsapp's Issues

Error recibiendo mensajes correctos de "ciertos" usuarios.

El bot est谩 funcionando ok, pero con un usuario de los que est谩n prob谩ndolo, al enviar un simple Hola, por ejemplo, recibe parte del mensaje desde el bot y el servicio cancela con el siguiente mensaje...
Bot-error
Alguna idea???
Muchas gracias, Javier.

Obtener mensajes enviados

Estimado buenas, se puede interceptar los mensajes que envio ? no solo los que me llegan si no los que puedo enviar a mano.

corrup zip ?

hola @leifermendez haciendo test a la app me he encontrado con este error he tratado de hacer un mejor seguimiento pero no le he dado con el chiste, sabes alguna raz贸n o soluci贸n? me gustaria saber que piensas sobre el error. al principio pensaba que era por el flujo de chats "solo eran dos", luego pense que eran las imagenes o algo asi pero no lo son.
error bot

No consigo guardar la session en ./session.json

Hola

Estuve revisando el material y el codigo, pero no consigo guardar la session en el ./session.json, o no se si es que la funcionalidad del MULTI_DEVICE, limita la posibilidad de guardar la sesssion, ya que debbugeando el codigo encuentro que el session no esta obteniendo ningun valor para guardar en el SESSION_FILE_PATH.

Esta funcion en pocas palabras no esta haciendo nada:

client.on('authenticated', (session) => {
    sessionData = session;
    if(sessionData){
        fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) {
            if (err) {
                console.log(`Ocurrio un error con el archivo: `, err);
            }
        });
    }
});

Quedo muy atento ma sus comentarios.

Saludos

Error al conectat bot

Hola Leifer, segu铆 paso por paso el 煤ltimo video del bot en youtube y me salta el siguiente error luego de escanearlo con el telefono. En el tel茅fono figura como si hubiera un dispositivo conectado (Mac OS) pero en VSC me salta el siguiente error. Soy algo novato con node con lo cual quizas este cometiendo algun error muy simple.
WhatsApp Image 2022-03-29 at 11 42 35 AM
PD: Me encanto tu contenido, saludos

Error al leer QR con WA Bussines

Hola,

 Si escaneo el c贸digo con WA bussines el tel茅fono lo vincula bien pero sale el siguiente error en la terminal y no se crea el archivo de session.jon.

 WA normal si funciona.

Ver QR http://localhost:3004/qr
(node:4775) UnhandledPromiseRejectionWarning: Error: Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.
at LegacySessionAuth.getAuthEventPayload (/Users/sulivan/Desktop/ChatBot/node_modules/whatsapp-web.js/src/authStrategies/LegacySessionAuth.js:57:24)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Client.initialize (/Users/sulivan/Desktop/ChatBot/node_modules/whatsapp-web.js/src/Client.js:217:34)
(node:4775) 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:4775) [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.

Captura de pantalla 2022-03-08 a las 13 12 57

Error al usar api/send

Hola Leifer,saludos, de antemano te agradezco por el proyecto, esta excelente, tengo un error al tratar de usar la ruta api/send, al parecer tiene que ver con el client, pero no puedo dar con el, me podrias ayudar con esto por favor.

Te dejo el error que aparece en consola:

El server esta listo por el puerto 3000
/var/www/html/Node/bot-whatsapp/controllers/send.js:50
client.sendMessage(number, message);
^

TypeError: Cannot read properties of null (reading 'sendMessage')
at Timeout._onTimeout (/var/www/html/Node/bot-whatsapp/controllers/send.js:50:12)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)

Node.js v17.9.0

Gracias, excelente tu trabajo, sigue asi....

Guardar Sesi贸n - undefined

Hola, he ejecutado el c贸digo tal y como viene de la rama Master, ha funcionado!
Lo 煤nico que no llego a entender, es por que no guarda la sessi贸n, he puesto un console log y me da el resultado de undefined.
app.js -> linea 180
client.on('authenticated', (session) => { sessionData = session; console.log('DATOS SESION: ' + sessionData); if(sessionData){ fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) { if (err) { console.log("Ocurrio un error con el archivo: ", err); } }); } });

驴C煤al puede ser el error? 驴Que no estoy viendo?

Bot revienta si recibe un mensaje de voz

Dado

Sistema Operativo Windows 10
Hardware:...
Browser: Google Chrome Versi贸n ...
...
Datos de entrada: ...

  • El usuario envia un mensaje de voz el bot revienta

**Al parecer no es posible salvar los mensajes de voz recibidos en controllers/save
instale de nuevo el modulo mime-db pero el problema continua

Implementar en Modo Producci贸n

Hola Leifer, como est谩s?

Mi nombre es Andres, estoy intentando lanzar a producci贸n tu bot pero me devuelve error, aclaro que tengo poco conocimiento de programaci贸n...

Te comento los pasos;

Estoy en Linode:

  1. Con Ubuntu 20.04 LTS lanzado los siguientes comandos en el root@localhost:

sudo apt-get update
sudo apt-get upgrade
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
npm --version
sudo apt-get install git
git clone https://github.com/leifermendez/bot-whatsapp.git

  1. Despu茅s me dirijo a la carpeta bot-whatsapp, estando en ella ejecuto los siguientes comando para instalar las librer铆as que comentas:

npm install
cp .env.example .env
npm i express --save
npm i moment --save
npm i exceljs --save
npm i whatsapp-web.js --save
npm i qrcode-terminal --save
npm i mime-db --save

  1. Ejecuto npm start y me devuelve el siguiente error:

[email protected] start /root/bot-whatsapp
node ./app.js

No tenemos session guardada
events.js:377
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (net.js:1331:16)
at listenInCluster (net.js:1379:12)
at Server.listen (net.js:1465:7)
at Object. (/root/bot-whatsapp/app.js:219:8)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1358:8)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 3000
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node ./app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-21T15_11_24_651Z-debug.log
root@localhost:~/bot-whatsapp#

Cual podr铆a ser la soluci贸n?
Andr茅s
隆Muchas gracias!

Intentando tu ejemplo de dialogflow

Hola,

Intentando tu ejemplo de Dialog Flow, cuando escribo hola, no recibo la respuesta de dialgo flow

Recibo en consola el siguiente texto

"Listo para escuchas mensajes
Client is ready!
BODY hola"

En mi whatsapp no recibo respuesta.

Gracias,

Hugo

No consigo respuesta mediante dialogflow

Hola:
Lo primero enhorabuena por su desarrollo.
Le comento el problema.
Conseguimos que funcione mediante JSON , pero quisiera integrarlo mediante dialogflow.
Creamos en agente, importamos y copiamos las claves, aplicamos los permisos, nos aparece el intent Default Welcome Intent
Creamos otros, pero no conseguimos respuesta en el Whatapp, mientras que si lo asignamos con JSON, si que funciona.

Es posible que sea el archivo .env

DEFAULT_MESSAGE=false
SAVE_MEDIA=true
PORT=3000
DATABASE=none ---- probamos tambien con KEEP_DIALOG_FLOW -- con dialogflow nos da un fallo
LANGUAGE=es
SQL_HOST=
SQL_USER=
SQL_PASS=
SQL_DATABASE=
KEEP_DIALOG_FLOW=true
MULTI_DEVICE=true

No damos en el problema .
Que podemos estar haciendo mal?

Sesion Guardada

Antes que nada Leifer, sos un Crack, Maestro...!!! Te felicito por tu contenido creo que nos sirve de mucho a personas que venimos aprendiendo programacion y soluciones practicas.

Tengo una duda, estoy usando Multidivice=True, sin embargo al parar el servicio y volverlo a correr, me pide nuevamente que escanee el codigo y no queda la Sesion Guardada

Ayuda con lo anterior!

Problemas con Dialogflow

Hola @leifermendez tengo un problema. A la hora de colocar en el archivo .env.example el par谩metro para usar dialogflow y cuando quiero usarlo, en consola me sale el error :

BODY: "palabra que escribo en WhatsApp"
{ lastStep: null }

Tengo bien las conexiones, coloqu茅 muy bien y cuidadosamente los datos en chatbot-account.json pero sigue sin funcionar.

Te agradezco una ayudita, muchas gracias.

intentando correrlo en UBUNTU

Hola buenas.

Lo intente correr en un Ubuntu siguiendo tus instrucciones y em da el siguiente error.

sead@SEAD:~/Chatbot/bot-whatsapp$ npm i
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"})

audited 453 packages in 3.194s

26 packages are looking for funding
run npm fund for details

found 3 moderate severity vulnerabilities
run npm audit fix to fix them, or npm audit for details
sead@SEAD:~/Chatbot/bot-whatsapp$

sead@SEAD:~/Chatbot/bot-whatsapp$ npm run start

[email protected] start /home/sead/Chatbot/bot-whatsapp
node ./app.js

/home/sead/Chatbot/bot-whatsapp/adapter/mysql.js:9
const key = response.?option_key || null
^

SyntaxError: Unexpected token ?
at Module._compile (internal/modules/cjs/loader.js:723:23)
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/sead/Chatbot/bot-whatsapp/adapter/index.js:1:31)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node ./app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/sead/.npm/_logs/2022-03-04T13_01_07_370Z-debug.log
sead@SEAD:~/Chatbot/bot-whatsapp$

sead@SEAD:/.npm/_logs$ cat 2022-03-04T13_01_07_370Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]
prestart: [email protected]
6 info lifecycle [email protected]start: [email protected]
7 verbose lifecycle [email protected]
start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]start: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/sead/Chatbot/bot-whatsapp/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle [email protected]
start: CWD: /home/sead/Chatbot/bot-whatsapp
10 silly lifecycle [email protected]start: Args: [ '-c', 'node ./app.js' ]
11 silly lifecycle [email protected]
start: Returned: code: 1 signal: null
12 info lifecycle [email protected]start: Failed to exec start script
13 verbose stack Error: [email protected] start: node ./app.js
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/sead/Chatbot/bot-whatsapp
16 verbose Linux 5.13.0-30-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start"
18 verbose node v10.19.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: node ./app.js
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
sead@SEAD:
/.npm/_logs$

Excelente repo, gracias!

Cuando recibo un mensaje de Grupos de WhatsApp se rompe la conexi贸n y se detienen los procesos. Alguien sabe como resolver este issue? Grupos de WhatsApp: Los Mensajes que envian en los Grupos tumba la conexion. Sabe alguien Ignorar los "msj de grupos" o solucionar este Issue?

Error: Evaluation failed: Error: wid error: invalid wid: 18299948875-1620841531@[email protected]
at new c (https://web.whatsapp.com/bootstrap_qr.8e365468263647825bd5.js:69:26446)
at Object.s [as createWid] (https://web.whatsapp.com/bootstrap_qr.8e365468263647825bd5.js:69:30732)
at puppeteer_evaluation_script:2:53
at ExecutionContext._evaluateInternal (C:\dev\bot-whatapp-dbjson\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ExecutionContext.evaluate (C:\dev\bot-whatapp-dbjson\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
at async Client.sendMessage (C:\dev\bot-whatapp-dbjson\node_modules\whatsapp-web.js\src\Client.js:594:28)

(reading 'Socket')

Saludos Leifer

Tengo Varios dias probando tu codigo y todo estaba bien, hoy por la madrugada ya no me dejo escanear el codigo qr, en el telefono si hace la secion pero aparece un error que no se interpretar.

error

Hola Leifer Dialogflow error

Versi贸n de "whatsapp-web.js": "^1.16.5" Actualizada
Ahora se perdi贸 la comunicaci贸n con el servicio de Google. Genere una nueva chatbot-account pero igual, no se si deba actualizar tambi茅n los m贸dulos.

Integrar con API's

Hola, ser铆a genial poder conectarlo a API's que regresen informaci贸n, por ejemplo para un ecommerce que puedan preguntar el status de un pedido, en el c贸digo llamar a una api y en la respuesta tener algo tipo: Hola {NOMBRE} el status de tu pedido es {STATUS}
Para lo que se deber铆a pedir el nombre, guardarlo y despu茅s consultar la API del status y reemplazar esas variables del response por los valores
Se me ocurre que en el response.json se agregue un nuevo campo que se llame por ejemplo: request y sea una url que pida una respuesta tipo https://laapi.com/id=IDSTORE&order=123123
O no se, algo as铆 se me ocurre que ser铆a genial

Error en /api/send

Hola Leifer, c贸mo est谩s? Mi nombre es Nicol谩s y te agradezco una vez m谩s por tus grandiosos videos y repos.

Estoy teniendo un error al enviar desde postman a https://localhost:3000/api/send mediante POST.

(node:6428) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of null at cleanNumber (C:\xampp\htdocs\bot-whatsapp\controllers\handle.js:8:21) at Timeout._onTimeout (C:\xampp\htdocs\bot-whatsapp\controllers\send.js:31:14) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) (Usenode --trace-warnings ...to show where the warning was created) (node:6428) 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:6428) [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.

Sin embargo, la respuesta desde la API es "Enviado!"

Qu茅 puede estar ocurriendo?

Gracias de antemano!

Api, Mensaje Enviado Pero no Se envia

image

Un saludo Leifer, gracias por los aportes, sos un crack, te escribo ya que tengo este inconveniente donde mando el msje desde postman, y me tira de exitoso, pero sale del whatsapp

y en consola me tira esto
image

Ejecuci贸n de metodos GET y de POST recepci贸n de API desde json externo!!

Leifer Mendez, un placer, reci茅n veo tu videos, nuevamente el programa esta genial.
Estoy viendo la posibilidad de aplicar en un paso, un m茅todo GET para sincronizar con una RESTApi y tener
informaci贸n sincronizada desde otra base de datos como mejora.
Imagina el potencial, usando tu bot como intermediario de API's....
Imagino que todo viene ligado a los steps en response, ver茅 si termino de engranar los inital con los verbos api y te mando un pull request luego,

Saludos!!!

Problema, EXCEL

Hola tengo un problema, cuando guarda un chat guarda el mensaje que env铆a el Bot y no el que recibe, si alguien sabe la soluci贸n

Multi-device is not yet supported by whatsapp-web.js

Hola,
He ejecutado el proyecto con 2 dispositivos m贸viles y me ha funcionado sin problema, sin embargo con otros 3 me aparece este error:
'Multi-device is not yet supported by whatsapp-web.js.'

Alguien sabe a que se debe?

Muchas gracias

Deployment en Heroku con errores de Chrome

Leifer, estoy intentando realizar el deployment del chatbot en Heroku, pero tiene problemas para arrancar. El que se queja es el puppeteer y en el log veo el sigiuente mensaje:

"/app/node_modules/puppeteer/.local-chromium/linux-961656/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory"

Hay que agregar algun buildpack adicional?
Gracias, Javier (warpman)

Recibido de emoticons

Que tal, cuando me env铆an un emojis, el proceso se para automaticamente, estoy usandolo con base de datos mysql.

Error in library puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221

I get this error message when receiving a message:

        throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));

rror: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'features')
at Object.window.WWebJS.sendMessage (puppeteer_evaluation_script:92:39)
at puppeteer_evaluation_script:10:45
at ExecutionContext._evaluateInternal (/home/bot/bot-whatsapp-main/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ExecutionContext.evaluate (/home/bot/bot-whatsapp-main/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.sendMessage (/home/bot/bot-whatsapp-main/node_modules/whatsapp-web.js/src/Client.js:594:28)

Crashea al recibir imagen sin texto (Dialogflow)

** Archivo Media Guardado **
C:\Users\Usuario\Desktop\bot\node_modules@grpc\grpc-js\build\src\call.js:31
return Object.assign(new Error(message), status);
^

Error: 3 INVALID_ARGUMENT: Input text not set.
at Object.callErrorFromStatus (C:\Users\Usuario\Desktop\bot\node_modules@grpc\grpc-js\build\src\call.js:31:26)
at Object.onReceiveStatus (C:\Users\Usuario\Desktop\bot\node_modules@grpc\grpc-js\build\src\client.js:180:52)
at Object.onReceiveStatus (C:\Users\Usuario\Desktop\bot\node_modules@grpc\grpc-js\build\src\client-interceptors.js:365:141)
at Object.onReceiveStatus (C:\Users\Usuario\Desktop\bot\node_modules@grpc\grpc-js\build\src\client-interceptors.js:328:181)
at C:\Users\Usuario\Desktop\bot\node_modules@grpc\grpc-js\build\src\call-stream.js:182:78
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
code: 3,
details: 'Input text not set.',
metadata: Metadata {
internalRepr: Map(1) {
'grpc-server-stats-bin' => [
Buffer(10) [Uint8Array] [
0, 0, 87, 70, 32,
0, 0, 0, 0, 0
]
]
},
options: {}
},
note: 'Exception occurred in retry method that was not classified as transient'
}

No detecta Chat de grupos

Hice una prueba para chat de grupos en modo depuraci贸n en la linea:
const listenMessage = () => client.on('message', async msg => {

Api para enviar y leer mensajes

Intente hacer algo, pero tengo que estudiar bien el codigo. Seria genial que tuviera una API REST. La seguridad ya es otro tema, cada quien ve como hace si un token o algo. Pero definitivamente seria bueno una API

ERROR CON DIALOGFLOW

Hace un tiempo trabajaba en este boot, y lo deje por un periodo ahora que lo vuelvo a retomar tengo un error ya actualice a la ultima version y me manda el siguiente error, a alguien le paso lo mismo y que me pueda ayudar plis

(node:12920) UnhandledPromiseRejectionWarning: TypeError: nanoid is not a function
at detectIntent (C:\laragon\www\bot-whatsapp-main\adapter\diaglogflow.js:35:46)
at getDataIa (C:\laragon\www\bot-whatsapp-main\adapter\diaglogflow.js:70:5)
at C:\laragon\www\bot-whatsapp-main\adapter\index.js:61:9
at new Promise ()
at getIA (C:\laragon\www\bot-whatsapp-main\adapter\index.js:55:28)
at bothResponse (C:\laragon\www\bot-whatsapp-main\controllers\flows.js:19:24)
at Client. (C:\laragon\www\bot-whatsapp-main\app.js:63:32)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:12920) 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: 6)
(node:12920) [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.

Ayuda con DialogFlow y el bot

Ya conecte el bot al dialogflow exitosamente y todo funciona perfecto mi problema es que yo quiero hacer que a partir de determinado mensaje se despliegue un Intent el cual le hace una serie de preguntas a traves de Actions and Parameters al usuario y esos datos los vaya almacenando para luego exportarlos a un spreadsheets. Tengo todo armado, cuando pruebo el intent en DialogFlow anda perfecto pero cuando conecto el bot y el Intent comienza a desplegarse, es decir hace la primer pregunta, al contestar el usuario por ejemplo su nombre, el bot en vez de seguir con el intent que ya comenz贸 y los parametros q le siguen, corre el intent que tiene como default cuando no reconoce lo que se le esta contestando, por ende imagino que el problema vendra desde la adaptacion del codigo ya que en el dialogflow todo corre perfecto. Si alguien pudiera ayudarme con esto seria genial. Gracias

Bot贸nes del mensaje por defecto no funcionan

Saludos Leifer,
Me animaste a aprender NodeJS.

Encuentro un problema en la versi贸n actual, cuando se manejan los botones de repuesta por JSON.

  1. las respuestas se convierten a min煤sculas por lo que no las recibe correctamente. Ser铆a necesario actualizar las keywords en initial.json.
  2. al enviar el enlace de youtube y telegram como "media", intenta descargarse y se termina la aplicaci贸n. Solucionado pasando los enlaces como parte de replyMessage.

Dockerizar la app // Cloud

Buenos D铆as!

Para usar el bot en la cloud he intentado usarlo como app en node o docker y siempre da error de puppeter/Chromium,   bien sean en NODE o Docker

Me da el siguiente error.

$ docker run chatbot/chatbot:v9

[email protected] start /app
node ./app.js

El server esta listo por el puerto 3000
(node:21) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
[0331/105305.297443:FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x562ab8347469 base::debug::CollectStackTrace()
#1 0x562ab82adf33 base::debug::StackTrace::StackTrace()
#2 0x562ab82c0d50 logging::LogMessage::~LogMessage()
#3 0x562ab63815db content::ZygoteHostImpl::Init()
#4 0x562ab7e5adf2 content::ContentMainRunnerImpl::Initialize()
#5 0x562ab7e58eb9 content::RunContentProcess()
#6 0x562ab7e5900e content::ContentMain()
#7 0x562ab7eb3fca headless::(anonymous namespace)::RunContentMain()
#8 0x562ab7eb3cd5 headless::HeadlessShellMain()
#9 0x562ab4aa5668 ChromeMain
#10 0x7f407f9002e1 __libc_start_main
#11 0x562ab4aa54aa _start

Received signal 6
#0 0x562ab8347469 base::debug::CollectStackTrace()
#1 0x562ab82adf33 base::debug::StackTrace::StackTrace()
#2 0x562ab8346f71 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f40840710e0 (/lib/x86_64-linux-gnu/libpthread-2.24.so+0x110df)
#4 0x7f407f912fff gsignal
#5 0x7f407f91442a abort
#6 0x562ab83461f5 base::debug::BreakDebuggerAsyncSafe()
#7 0x562ab82c1221 logging::LogMessage::~LogMessage()
#8 0x562ab63815db content::ZygoteHostImpl::Init()
#9 0x562ab7e5adf2 content::ContentMainRunnerImpl::Initialize()
#10 0x562ab7e58eb9 content::RunContentProcess()
#11 0x562ab7e5900e content::ContentMain()
#12 0x562ab7eb3fca headless::(anonymous namespace)::RunContentMain()
#13 0x562ab7eb3cd5 headless::HeadlessShellMain()
#14 0x562ab4aa5668 ChromeMain
#15 0x7f407f9002e1 __libc_start_main
#16 0x562ab4aa54aa _start
r8: 0000000000000000 r9: 00007ffc4964df80 r10: 0000000000000008 r11: 0000000000000246
r12: 00007ffc4964f240 r13: 00007ffc4964f258 r14: 00007ffc4964f250 r15: 00002ea200238800
di: 0000000000000002 si: 00007ffc4964df80 bp: 00007ffc4964e1c0 bx: 0000000000000006
dx: 0000000000000000 ax: 0000000000000000 cx: 00007f407f912fff sp: 00007ffc4964dff8
ip: 00007f407f912fff efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

at onClose (/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:237:20)
at Interface.<anonymous> (/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:227:68)
at Interface.emit (events.js:327:22)
at Interface.close (readline.js:424:8)
at Socket.onend (readline.js:202:10)
at Socket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1223:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

(Use node --trace-warnings ... to show where the warning was created)
(node:21) 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:21) [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.

Dockerfile

FROM node:14.1
WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN apt-get update &&
apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2
libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget &&
rm -rf /var/lib/apt/lists/*

Add user so we don't need --no-sandbox.

RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser
&& mkdir -p /home/pptruser/Downloads
&& chown -R pptruser:pptruser /home/pptruser

Run everything after as non-privileged user.

USER pptruser

CMD ["npm","start"]

 Tambi茅n lo intente usar como root pero me pide usar con user seg煤n  https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md


 Alguna sugerencia para correrlo en la nube, lo intente en google cloud, DigitalOcean etc etc

Gracias

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.