Question:
Unable to get trigger emails working at all
Product:
WixEditor/Velo
What are you trying to achieve:
[Explain the details of what you are trying to achieve. The more details you provide, the easier it is to understand what you need.]
What have you already tried:
Multiple walkthroughs and instruction guides
Additional information:
I constantly get the error the following error:
email error Not Found: the requested item no longer exists.
Item exists in dataset:
Logs from running in preview:
succesful save of site member in dataset
member exists, send email
email error Not Found: the requested item no longer exists.
Trigger email snippet:
triggeredEmails.emailMember('Enquire', <enter-member-id-here>, {
variables: {
email: <enter-value-here>,
SITE_URL: <enter-value-here>
}
});
My code snippet:
import { triggeredEmails } from "wix-crm-frontend";
import { currentMember } from "wix-members-frontend";
$w.onReady(function () {
$w("#submit").onClick(async () => {
$w("#siteMembersConnect").onAfterSave(async () => {
console.log('succesful save of site member in dataset')
const member = await currentMember.getMember();
if (member) {
console.log('member exists, send email')
const userId = member._id;
triggeredEmails
.emailMember("Enquire", userId, {
variables: {
email: $w("#email").value,
},
})
.then(() => {
console.log('email sent')
})
.catch((err) => {
console.error('email error', err)
});
}
});
});
});