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
a5f56bac
Commit
a5f56bac
authored
Aug 18, 2021
by
Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Agrega un try-catch para capturar errores de conexion con sendinblue
parent
6de9840e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
index.js
index.js
+12
-8
No files found.
index.js
View file @
a5f56bac
...
@@ -31,13 +31,17 @@ crisp.CrispClient.on("message:send", async function (message) {
...
@@ -31,13 +31,17 @@ crisp.CrispClient.on("message:send", async function (message) {
});
});
async
function
enviarUserAListaSendingblue
(
website_id
,
session_id
,
listId
){
async
function
enviarUserAListaSendingblue
(
website_id
,
session_id
,
listId
){
let
crispUsrData
=
await
crisp
.
getCrispData
(
website_id
,
session_id
);
try
{
let
nombreCompleto
=
crispUsrData
[
'nickname'
];
// ej: "Lucas Mariano | Rodriguez"
let
crispUsrData
=
await
crisp
.
getCrispData
(
website_id
,
session_id
);
let
nombres
=
nombreCompleto
.
split
(
"|"
)[
0
].
slice
(
0
,
-
1
);
let
nombreCompleto
=
crispUsrData
[
'nickname'
];
// ej: "Lucas Mariano | Rodriguez"
let
apellidos
=
nombreCompleto
.
split
(
"|"
)[
1
].
substring
(
1
);
let
nombres
=
nombreCompleto
.
split
(
"|"
)[
0
].
slice
(
0
,
-
1
);
let
email
=
crispUsrData
[
'email'
];
let
apellidos
=
nombreCompleto
.
split
(
"|"
)[
1
].
substring
(
1
);
let
phone
=
crispUsrData
[
'phone'
];
let
email
=
crispUsrData
[
'email'
];
let
phone
=
crispUsrData
[
'phone'
];
console
.
log
(
nombres
,
apellidos
,
email
,
phone
);
console
.
log
(
nombres
,
apellidos
,
email
,
phone
);
sendinblue
.
saveContactToList
(
email
,
nombres
,
apellidos
,
phone
,
listId
);
sendinblue
.
saveContactToList
(
email
,
nombres
,
apellidos
,
phone
,
listId
);
}
catch
(
e
)
{
console
.
log
(
`Hubo un error al intentar enviar el usuario a la lista de sendinblue. Error:
${
e
}
`
);
}
}
}
\ No newline at end of file
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