Hello,
I have setup two triggered emails with variables. I am able to easily send the first email, but I need to send a second one at the same time and it will have to be from the backend as the current session contactId is being used by the first email. Thank you to @Asiia for pointing that out here: Send triggered emails to multiple contacts | Velo by Wix What I did was setup a new contact for the site owner and got the contactId of that contact then I wanted to set it up to send them the second triggered email with all the variables at the same time as the first. Here is my frontend code, which works great to trigger an email based on inputs I setup.
//Creates a new contact then send triggered email
const contactInfo = {
name: { first: $w("#name").value , last: $w("#lastName").value},
emails: [ { email: $w("#email").value } ]
};
contacts.appendOrCreateContact(contactInfo)
.then((result) => {
let contactId = result.contactId
console.log(contactId, "this is the contact ID")
triggeredEmails.emailContact('TriggeredEmailQuote', contactId, {
//These are the variables in the triggered email I have setup already
variables: {
TotalPrice: $w("#priceTotal").value,
Description: $w("#description").value,
Regular: $w("#numberRegular").value,
Small: $w("#numberSmall").value
}
})
This is a good example but not sure how to use the front-end variables. Triggered Emails to Contacts (2020) | Velo by Wix However, I am not sure where to even begin to send a second triggered email to the site owner with the variables included as the backend cannot use $w inputs. The second triggered email is created already and uses the same variables but needs to go to an email I define. I did create a contact for the site owner and got their contactId that I defined using Let ownerEmail = 'ex123456789...' instead but no idea where to begin with this in the backend. Any help would be greatly appreciated. I read through documentation and watched videos and am very lost on this. Thanks so much in advance.