Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
node_crisp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web
node_crisp
Commits
b4325415
Commit
b4325415
authored
Nov 24, 2021
by
Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Agrega mensaje de error
parent
8d10330c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
index.js
index.js
+7
-2
No files found.
index.js
View file @
b4325415
...
...
@@ -8,6 +8,7 @@ const sendinblue = require('./endpoints/sendinblue.js');
const
WEBSITE_ID_IPS_TURNOS_BAJO_DEMANDA
=
config
.
get
(
'crispWebsiteIdIpsTurnosBajoDemanda'
);
const
WEBSITE_ID_TURNOS_PROGRAMADOS
=
config
.
get
(
'crispWebsiteIdIsTurnosProgramados'
);
const
REINICIAR
=
'REINICIAR'
;
crisp
.
CrispClient
.
plugin
.
getConnectAccount
()
.
then
(
account
=>
{
...
...
@@ -21,7 +22,7 @@ crisp.CrispClient.on("message:updated", async function (message) {
})
crisp
.
CrispClient
.
on
(
"message:send"
,
async
function
(
message
)
{
if
(
message
.
content
.
toUpperCase
()
===
'REINICIAR'
){
if
(
message
.
content
.
toUpperCase
()
===
REINICIAR
){
await
crisp
.
updateUserData
(
message
.
website_id
,
message
.
session_id
,
{});
}
let
siguientePaso
=
await
crisp
.
getSiguientePaso
(
message
.
website_id
,
message
.
session_id
);
...
...
@@ -36,7 +37,11 @@ crisp.CrispClient.on("message:send", async function (message) {
}
darSiguientePaso
(
message
,
message
.
website_id
,
message
.
session_id
)
.
catch
((
ignorar
)
=>
{})
//Ignorar error cuando el usuario escribe un mensaje en lugar de usar el picker, o viceversa
.
catch
((
error
)
=>
{
console
.
log
(
`Error al procesar el mensaje del usuario:
${
error
}
`
);
crisp
.
sendTextMessage
(
message
.
website_id
,
message
.
session_id
,
`Ocurrió un error al procesar su respuesta. Por favor, verifique los datos ingresados y reintente. Si quiere comenzar desde el inicio, escriba
${
REINICIAR
}
.`
)
})
});
async
function
darSiguientePaso
(
message
,
website_id
,
session_id
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment