Hi all:
I am having issues with the emailContact function. For some emails, it’s not working with the 401 error " contactId does not match current session contact (401) ".
My idea is to create a form where the visitor enters his name and email to get a coupon. I don’t want visitors to signup for the site for this.
I am creating the contact before sending the email, but still no luck:
wixCRM.createContact({
“firstName” : $w( ‘#txtNombre’ ).value,
“lastName” : $w( ‘#txtAppellido’ ).value,
“emails” : [$w( “#txtEmail” ).value]
})
.then((contactId) => {
console.log( "contactId : " + contactId);
//bunch of other validations i make before deciding to send the email
wixCRM.emailContact( 'S8Q6ivl' , contactId, {
variables: {
fecha_desde: fechaD,
fecha_hasta: fechaH,
descripcion_cupon: desc,
nro_cupon: results.items[ 0 ].codCupon
}
}). **catch** ((err) => {
console.log( "Error al Enviar mail: " + err);
});
});
I’ve checked and the contact was created, I am getting a contactId, so I don’t get why I cannot send the email.
Thanks and regards,