codigoencasa / bot-whatsapp Goto Github PK
View Code? Open in Web Editor NEW馃 Crear Chatbot WhatsApp en minutos. 脷nete a este proyecto OpenSource (Typescript Version Pronto)
Home Page: https://bot-whatsapp.netlify.app
License: MIT License
馃 Crear Chatbot WhatsApp en minutos. 脷nete a este proyecto OpenSource (Typescript Version Pronto)
Home Page: https://bot-whatsapp.netlify.app
License: MIT License
En la version actual no permite iniciar sesi贸n cuando escaneo el QR,
client.on('authenticated', (session) => {
session is undefined
Estimado buenas, se puede interceptar los mensajes que envio ? no solo los que me llegan si no los que puedo enviar a mano.
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.
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
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.
PD: Me encanto tu contenido, saludos
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.
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....
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?
Sistema Operativo Windows 10
Hardware:...
Browser: Google Chrome Versi贸n ...
...
Datos de entrada: ...
**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
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:
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
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
[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!
Que tal Leifer, soy relativamente nuevo en la programacion, como puedo correr el bot en Cpanel, junto con la base de datos Mysql, gracias.
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
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?
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!
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.
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.logprestart: [email protected]
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]
6 info lifecycle [email protected]start: [email protected]start: unsafe-perm in lifecycle true
7 verbose lifecycle [email protected]
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/binstart: CWD: /home/sead/Chatbot/bot-whatsapp
9 verbose lifecycle [email protected]
10 silly lifecycle [email protected]start: Args: [ '-c', 'node ./app.js' ]start: Returned: code: 1 signal: null
11 silly lifecycle [email protected]
12 info lifecycle [email protected]start: Failed to exec start script/.npm/_logs$
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:
Excelente repo, gracias!
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)
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.
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
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) (Use
node --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!
CHANGELOG.md
README.md
vos me diras leifer, gracias
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!!!
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
Hola, estuve investigando y con la nueva version de WA ya no se puede guardar la sesi贸n por culpa de lo de multidispositivos, https://github.com/pedroslopez/whatsapp-web.js/issues/1292#issuecomment-1059706855
Ahora siempre que hago cambios en mis archivos para probar tengo que leerlo siempre porque no guarda el session.json, espero puedas ayudarnos porque apenas estoy entendiendole a node
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
buenas tardes,me podrias apoyar para implementarlo en node-red,instale el whatsappbot para node-red, y me sale este error:Error while starting Whatsapp client "session": Failed to launch the browser process!
/home/pi/.node-red/node_modules/puppeteer/.local-chromium/linux-756035/chrome-linux/chrome: 22: Syntax error: "(" unexpected
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
gracias por el apoyo
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)
Que tal, cuando me env铆an un emojis, el proceso se para automaticamente, estoy usandolo con base de datos mysql.
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)
** 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'
}
Hice una prueba para chat de grupos en modo depuraci贸n en la linea:
const listenMessage = () => client.on('message', async msg => {
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
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.
Error de whatsapp-web.js
Cannot read properties of undefined (reading 'Socket')
Al recibir el audio, al recibir el bot deja de funcionar.
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
Saludos Leifer,
Me animaste a aprender NodeJS.
Encuentro un problema en la versi贸n actual, cuando se manejan los botones de repuesta por JSON.
Hola leifer, soy facundo, te hable por youtube, aca te dejo el programa para que lo veas
README.md
CHANGELOG.md
no me deja subir otros archivos como hago?
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/*
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser
&& mkdir -p /home/pptruser/Downloads
&& chown -R pptruser:pptruser /home/pptruser
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
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.