Triggered Email error!

Hi, for some reason when using the triggered email function it sends an error that says:

“contactId does not match current session contact”

Is this a known bug? Is there a workaround for this?

Thanks!

What triggered email option are you using, to contacts, to members, on form submission etc and what code have you got set up and where does it error up.

https://support.wix.com/en/article/corvid-tutorial-sending-a-triggered-email-to-contacts
https://support.wix.com/en/article/corvid-tutorial-sending-a-triggered-email-to-members
https://support.wix.com/en/article/corvid-tutorial-sending-an-email-on-form-submission

Hi!

I am using wixCrrm.emailContact from: import wixCrm from ‘wix-crm-backend’; As I was told working with the crm backend doesn’t requiere to have the user currently logged in.

This is the code I set up for testing purposes:

$w.onReady(function () {

});

export function image22_click(event) {
  myBackendFunction();
}

import wixCrm from 'wix-crm-backend';

export function myBackendFunction() {
 let contactId = "2522edba-7a99-4a02-a191-a9eb5fb10fdd"

  wixCrm.emailContact("receta", contactId)
    .then( () => {
      console.log("Enviado!");
    } )
    .catch( (err) => {
      console.log(err);
    } );
}

It errors up in the preview console but now it sends this error:

TypeError: Cannot read property ‘emailContact’ of undefined

Any ideas?

For starters your code is all over the place, imports need to be at the top of your code then followed by the page’s onReady function.
https://www.wix.com/corvid/reference/$w.html#onReady

See here for the Wix CRM Backend api reference.
https://www.wix.com/corvid/reference/wix-crm-backend.html

Also, make sure that you do have a backend function setup as indicated in your code too.