Commit a5f56bac authored by Gabriel's avatar Gabriel

Agrega un try-catch para capturar errores de conexion con sendinblue

parent 6de9840e
...@@ -31,6 +31,7 @@ crisp.CrispClient.on("message:send", async function (message) { ...@@ -31,6 +31,7 @@ crisp.CrispClient.on("message:send", async function (message) {
}); });
async function enviarUserAListaSendingblue(website_id, session_id, listId){ async function enviarUserAListaSendingblue(website_id, session_id, listId){
try{
let crispUsrData = await crisp.getCrispData(website_id, session_id); let crispUsrData = await crisp.getCrispData(website_id, session_id);
let nombreCompleto = crispUsrData['nickname']; // ej: "Lucas Mariano | Rodriguez" let nombreCompleto = crispUsrData['nickname']; // ej: "Lucas Mariano | Rodriguez"
let nombres = nombreCompleto.split("|")[0].slice(0, -1); let nombres = nombreCompleto.split("|")[0].slice(0, -1);
...@@ -40,4 +41,7 @@ async function enviarUserAListaSendingblue(website_id, session_id, listId){ ...@@ -40,4 +41,7 @@ async function enviarUserAListaSendingblue(website_id, session_id, listId){
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment