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
2f7d06eb
Commit
2f7d06eb
authored
Aug 25, 2021
by
Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reordena metodos en index.js
parent
85968716
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
index.js
index.js
+12
-9
No files found.
index.js
View file @
2f7d06eb
...
...
@@ -7,20 +7,17 @@ const pasos = require('./handlers/pasos_is_turnos_programados.js');
const
is
=
require
(
'./endpoints/is.js'
);
const
sendinblue
=
require
(
'./endpoints/sendinblue.js'
);
crisp
.
CrispClient
.
on
(
"message:updated"
,
async
function
(
message
)
{
darSiguientePaso
(
message
,
message
.
website_id
,
message
.
session_id
);
})
async
function
darSiguientePaso
(
message
,
website_id
,
session_id
)
{
let
siguientePaso
=
await
crisp
.
getSiguientePaso
(
message
.
website_id
,
message
.
session_id
);
let
userData
=
await
crisp
.
getUserData
(
website_id
,
session_id
);
handlers
[
siguientePaso
](
message
,
userData
,
website_id
,
session_id
);
}
const
WEBSITE_ID_IPS_TURNOS_BAJO_DEMANDA
=
config
.
get
(
'crispWebsiteIdIpsTurnosBajoDemanda'
);
const
WEBSITE_ID_TURNOS_PROGRAMADOS
=
config
.
get
(
'crispWebsiteIdIsTurnosProgramados'
);
crisp
.
CrispClient
.
userProfile
.
get
().
then
(
function
(
myProfile
)
{
console
.
log
(
`El chatbot esta escuchando eventos (profile name:
${
myProfile
.
first_name
}
)`
);
});
crisp
.
CrispClient
.
on
(
"message:updated"
,
async
function
(
message
)
{
darSiguientePaso
(
message
,
message
.
website_id
,
message
.
session_id
);
})
crisp
.
CrispClient
.
on
(
"message:send"
,
async
function
(
message
)
{
if
(
message
.
content
.
toUpperCase
()
===
'REINICIAR'
){
await
crisp
.
updateUserData
(
message
.
website_id
,
message
.
session_id
,
{});
...
...
@@ -34,6 +31,12 @@ crisp.CrispClient.on("message:send", async function (message) {
await
darSiguientePaso
(
message
,
message
.
website_id
,
message
.
session_id
);
});
async
function
darSiguientePaso
(
message
,
website_id
,
session_id
)
{
let
siguientePaso
=
await
crisp
.
getSiguientePaso
(
message
.
website_id
,
message
.
session_id
);
let
userData
=
await
crisp
.
getUserData
(
website_id
,
session_id
);
handlers
[
siguientePaso
](
message
,
userData
,
website_id
,
session_id
);
}
async
function
enviarUserAListaSendingblue
(
website_id
,
session_id
,
listId
){
try
{
let
crispUsrData
=
await
crisp
.
getCrispData
(
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