Triggered Email not sent

Question:

Hello everyone

I created 2 “triggered emails” which must be sent to a very specific customer in my database at 2 very specific times: after registration and after validation of their reservation.
When the customers enters their data, they are saved in a collection called “Mes Clients”. At this time, I would like this same customer to receive the triggered email that I named: “EnregistrementValide”. (to the email saved in “MesClients” Collection corresponding)
My PB: customer data is well recorded in my “MyClients” collection(mail, LAstName, Firstname, etc…) , but the email is not sent to them.
Can you help me please?

My (important) fields :

  • lastName
  • firstName
  • email
  • EnvoiMailClt : My dataset (MesClients)

P.S : i watched some videos on the web and i found some solutions : but don’t work, and i don’t really understand them.

Thank you in advance

Product:
Wix EDITOR

What are you trying to achieve:
Send a triggered email.

**Here the code i use : **

$w(“#EnvoiMailClt”).onReady(() => {
$w(“#EnvoiMailClt”).onAfterSave(() => {

    wixCRM.createContact({
        "firstName": $w('#firstName').value,
        "lastName": $w("#lastName").value,
        "emails": [$w("#email").value]

    }).then((contactId) => {

        triggeredEmails.emailContact('EnregistrementValide', contactId, {
            variables: {
                firstName: session.getItem("firstName"),
                lastName: session.getItem("lastName"),
                email: session.getItem("email")

            }
        });
    });
    //
});


//$w("#firstName, #lastName, #email").onInput(() => {
    session.setItem("firstName", $w("#firstName").value)
    session.setItem("lastName", $w("#lastName").value)
    session.setItem("email", $w("#email").value)
//})

})

If your email is using an NPM then its because all the npm’s are down across Wix.

Thanks.
Effectively, i used to send mails by sendgrid (It worked fine), but since a few weeks, thats is not possible anymore. … So i try to use triggered emails.
So… what to do?

I’m not sure what ‘triggered emails’ you’re referring to so not sure how to help.
I heavily rely on sendgrid npm’s so this Wix issue is hurting. I built a ‘fetch’ work around as a bandaid.

Edit: Nevermind, I see from your code you’re using Wix CRM backend which I’m not familiar with. Perhaps the issue Wix is having with npms is affecting that as well? Not sure.

Is it creating the contact at all?

You are trying to create after the dataset saves —— at which point anything connected to a dataset input will get reset and erased.

Ao the logic order of your code is mixed up.

OnBefore save, validate that all required inputs have been filled out, then create contact, then save form, send trigger email. You can pass the variables you need within the chain of code. You don’t need to be using storage.

1 Like

Thanks a lot for you help

1 Like