top of page

How to Add Email Automation on Wix Using Velo

  • Writer: Wix Crafters
    Wix Crafters
  • Apr 28
  • 4 min read

🎯 Introduction

Email automation transforms how businesses communicate with their customers. For Wix website owners, automating emails means saving time, improving customer engagement, and increasing sales without manual effort. Whether you want to send welcome messages, order confirmations, appointment reminders, or follow-ups, email automation ensures your audience receives timely, relevant information.


Imagine a new visitor signing up on your site and instantly receiving a warm welcome email. Or a customer completing a purchase and getting an immediate order confirmation. You can even remind clients about upcoming appointments or nudge them with follow-up emails after a week. These automated touches build trust and encourage repeat business.


This post guides you through setting up a complete email automation system on Wix using Velo, Wix’s powerful development platform. You will learn how to create triggered emails, send personalized messages, schedule reminders, and handle follow-ups efficiently.



Eye-level view of a computer screen showing Wix Velo code editor with email automation script
Setting up email automation using Wix Velo code editor


🛠️ What You Will Build


By following this tutorial, you will create an automated email system that covers key customer interactions:


  • Welcome email sent immediately when a new member signs up.

  • Order confirmation email triggered right after a purchase.

  • Appointment reminder email sent 24 hours before the scheduled time.

  • Follow-up email delivered 7 days after a purchase to encourage engagement.


This system uses Wix Triggered Emails combined with Velo event hooks and scheduled jobs. It offers a practical way to keep your customers informed and engaged without manual intervention.


✅ Prerequisites


Before starting, ensure you have the following ready:


  • Wix Dev Mode enabled on your site to access Velo features.

  • Wix Triggered Emails set up in your Wix Dashboard.

  • Wix Automations configured for follow-up emails (optional but recommended).

  • Basic knowledge of JavaScript to customize event hooks and scheduled jobs.


Having these in place will make the setup smoother and allow you to customize the automation to your needs.


📦 Step 1 — Set Up Triggered Email Template


Start by creating the email templates that Wix will send automatically:


  1. Open your Wix Dashboard and navigate to Customer Management > Triggered Emails.

    • `{name}` for the recipient’s name

    • `{orderNumber}` for order details

    • `{date}` for appointment or purchase dates

    • `{amount}` for order totals

  2. Click Create New Template.

  3. Design your email content using Wix’s editor. Include dynamic variables such as:

  4. Save and publish the template. Make sure it is not left in draft mode.

  5. Copy the emailId assigned to this template; you will need it in your Velo code.


Using dynamic variables personalizes each email, making your messages feel tailored and professional.


🎨 Step 2 — Welcome Email on Member Signup


Send a warm welcome message as soon as someone registers on your site:


  1. In your Velo backend, open the `members.js` file.

  2. Use the `members.onMemberCreated` event hook to trigger the email.

  3. Call `triggeredEmails.emailMember` with the welcome email’s `emailId` and pass variables like the member’s name and registration date.


Example snippet:


```javascript

import { triggeredEmails } from 'wix-crm-backend';

import wixUsers from 'wix-users-backend';


$w.onReady(() => {

wixUsers.onMemberCreated(async (member) => {

await triggeredEmails.emailMember('welcomeEmailId', member._id, {

variables: {

name: member.contactDetails.firstName,

registrationDate: new Date().toLocaleDateString()

}

});

});

});

```


This sends a personalized welcome email automatically, helping new members feel valued from the start.


💻 Step 3 — Order Confirmation Email


Confirm purchases with an immediate email after checkout:


  1. Use the `ecommerce.onOrderCreated` event hook in your backend code.

  2. Pass order details such as order number, items, and total amount as variables.

  3. Send a copy to your admin email using `triggeredEmails.emailContact` for internal tracking.


Example:


```javascript

import { triggeredEmails } from 'wix-crm-backend';

import { orders } from 'wix-ecommerce-backend';


orders.onOrderCreated(async (order) => {

await triggeredEmails.emailMember('orderConfirmationEmailId', order.buyerInfo.contactId, {

variables: {

orderNumber: order._id,

items: order.lineItems.map(item => item.name).join(', '),

}

});


await triggeredEmails.emailContact('orderConfirmationEmailId', 'admin@example.com', {

variables: {

orderNumber: order._id,

buyerName: order.buyerInfo.firstName

}

});

});

```


This keeps customers informed and your team updated on new orders.


⏰ Step 4 — Scheduled Reminder with Wix Jobs


Remind clients about upcoming appointments automatically:


  1. Create a scheduled job in the Wix Jobs panel.

  2. Query your bookings collection for appointments scheduled for the next day.

  3. Loop through the results and send reminder emails to each client using the triggered email template.


Example job code:


```javascript

import wixData from 'wix-data';

import { triggeredEmails } from 'wix-crm-backend';


export async function sendAppointmentReminders() {

const tomorrow = new Date();

tomorrow.setDate(tomorrow.getDate() + 1);

const start = new Date(tomorrow.setHours(0, 0, 0, 0));

const end = new Date(tomorrow.setHours(23, 59, 59, 999));


const results = await wixData.query('Bookings')

.between('appointmentDate', start, end)

.find();


for (const booking of results.items) {

await triggeredEmails.emailMember('appointmentReminderEmailId', booking.contactId, {

variables: {

appointmentDate: booking.appointmentDate.toLocaleString(),

service: booking.serviceName

}

});

}

}

```


Scheduling reminders reduces no-shows and improves customer satisfaction.


🔗 Step 5 — Follow Up Email


Encourage repeat business with a follow-up email sent after purchase:


  • Use Wix Automations to trigger an email 7 days after an order.

  • Alternatively, create a scheduled job that queries orders older than 7 days where a `followUpSent` flag is false.

  • Send the follow-up email and update the flag to avoid duplicates.


Example scheduled job snippet:


```javascript

import wixData from 'wix-data';

import { triggeredEmails } from 'wix-crm-backend';


export async function sendFollowUpEmails() {

const sevenDaysAgo = new Date();

sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);


const results = await wixData.query('Orders')

.lt('orderDate', sevenDaysAgo)

.eq('followUpSent', false)

.find();


for (const order of results.items) {

await triggeredEmails.emailMember('followUpEmailId', order.contactId, {

variables: {

name: order.buyerName,

orderNumber: order._id

}

});


await wixData.update('Orders', {

_id: order._id,

followUpSent: true

});

}

}

```


This keeps your brand top of mind and encourages customers to return.


🐛 Common Issues


| Issue | Cause | Solution | Notes |

|---------------------|------------------------------------------|-----------------------------------------------|--------------------------------|

| Email not sending | Template is in draft mode | Publish the triggered email template | Check template status in Wix |

| Variables showing blank | Variable names mismatch | Verify variable names match exactly | Case-sensitive |

| Duplicate emails | Missing sent flag in collection | Add a boolean field to track sent emails | Prevents repeated sends |

| Job not running | Scheduled job not enabled or errors | Enable job and check logs for errors | Use Wix Jobs panel for status |


Checking these common pitfalls helps maintain smooth email automation.



 
 
 

Comments


bottom of page