This is what I have existing
Wix code
wixCRM.createContact({
“firstName”: $w(‘#text1860’).text,//first name of exixting user from login contact list to help wix recognise the user
“emails”: [$w(‘#text1861’).text],//email of this existing user from login contact list to help wix recognise the user
})
.then((contactId) => {
wixCRM.emailContact(“Successful Subscription”, contactId, {
“variables”: {
“contact.Name.First”: $w(‘#text1858’).text, // Username
“invoice-number”: itemrr.reference,
“preview-link”:wixLocation.to(pdfUrl),//the pdf link
}
})
.then(() => {
$w('#text1861').show()
$w('#text1861').text ="An Email has been sent to your Email Address - "+ $w('#text1861').text// do something after the email was sent
})
.catch((err) => {
$w('#text1861').show()
$w('#text1861').text ="Failed to send Email to - "+ $w('#text1861').text// handle the error if the email wasn't sent
});
});
}
})
Email code
Payment was Received for Your Invoice
Hi ${contact.Name.First} ,
You have successfully purchased an A.I. Subscription Plan,
Sub-Ref-Id #${invoice-number}.
Please contact us if you’d like any further assistance.
Many thanks,
View Invoice // connected to preview-link
Please what am I doing wrong as this doesn’t work