Commit 0fd49a6d authored by Sebastián Long's avatar Sebastián Long

Finish sendinblue-error

parents 6de9840e 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
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