mosaddik.dev
All posts

How to create a Triggered Email in Wix, step by step with screenshots

Mosaddik Billah 8 min read

Wix TutorialsWix Velo

Letter tiles spelling the word email on a grey surface
Photo by Miguel Ángel Padriñán Alba on Unsplash
On this page
  1. 1. Turn on code for your site
  2. 2. Open Triggered Emails in the dashboard
  3. 3. Add a sender
  4. 4. Create a new email
  5. 5. Add variables for the personal parts
  6. 6. Set the email ID and copy the snippet
  7. 7. Send it from your code
  8. Quick fixes

Triggered Emails are how a Wix site sends its own emails from code: a welcome note after a sign-up form, a confirmation with the visitor’s details in it, a follow-up after a booking. The code part is short. Getting the email ready in the dashboard is where people get stuck, because the menu is hidden until you turn on code, and Wix asks for a few things in a particular order.

This guide walks through that dashboard part, one screen at a time. I made a fresh, blank Wix Studio site to take these screenshots, so what you see is exactly what a new site looks like. Click any screenshot to open it full size and step through the rest with the arrow keys.

When you’re done, you’ll have a published email with an ID you can call from code. The code itself is in the companion post, how to send emails from Wix with Velo.

1. Turn on code for your site#

Triggered Emails live under Developer Tools in the dashboard, and that menu only appears once the site has code turned on. On a new site it isn’t there at all, and going to the page directly says “This page isn’t available”.

Open your site in the editor and:

  1. Click the { } icon in the left toolbar. On a new Wix Studio site this opens the AI Code Assistant; click Start Coding Manually at the bottom of the panel. (In the classic Wix Editor, turn on Dev Mode in the top menu instead.)
  2. The code panel opens, and Developer Tools now appears in its menu.
The Wix Studio editor with the code panel open: the { } icon in the left toolbar is marked 1 and the Developer Tools menu item is marked 2
1. The { } code icon. 2. Developer Tools appears once code is on.

You don’t need to write any code yet. Turning it on is enough for the dashboard menu to show up.

2. Open Triggered Emails in the dashboard#

Go to your site’s dashboard. In the left menu, open Developer Tools → Triggered Emails. (You can also get there from the editor: Developer Tools in the code panel, then Triggered Emails.)

On a site that has never sent one, you’ll see a notice saying you need to add a sender first. That’s the next step.

The Triggered Emails page in the Wix dashboard: the Triggered Emails menu item under Developer Tools is marked 1 and the Add Sender button is marked 2
1. Developer Tools → Triggered Emails. 2. Add Sender.

3. Add a sender#

Click Add Sender. Wix fills in your account name and login email, which usually isn’t what you want customers to see. Change them:

  • Sender’s name: your business name. This is the “From” name in the inbox.
  • Reply-to email: where replies should go. Use an address on your own domain if you have one; Wix warns that Gmail or Yahoo addresses are more likely to end up in spam or promotions.
The Add sender dialog with the Sender's name field marked 1, the Reply-to email field marked 2 and the Save button marked 3
1. Sender’s name. 2. Reply-to email. 3. Save.

Click Save. Wix then emails a short confirmation code to the reply-to address. Copy it from that inbox (check spam if it doesn’t show up within a minute), paste it in, and click Confirm.

The Confirm email address dialog with the code field marked 1 and the Confirm button marked 2
1. Paste the code from the email. 2. Confirm.

A site has one sender unless you upgrade its email marketing plan, and every Triggered Email uses it.

4. Create a new email#

Back on the Triggered Emails page, click New Campaign at the top right. The email editor opens with a starter template. Two things to change straight away:

The Triggered Email editor with the subject line Edit link marked 1 and the body text block marked 2
1. Edit the subject line. 2. The body text, where the variables will go.

Click Edit next to the subject line. Write a subject, and a short preview text: the grey line most inboxes show after the subject. Then Save.

The Edit the subject and preview text dialog with the Subject line field marked 1, Preview text marked 2 and Save marked 3
1. Subject line. 2. Preview text. 3. Save.

5. Add variables for the personal parts#

Variables are the bits your code fills in when it sends the email: the visitor’s name, what they signed up for, a link. Click the body text to edit it, type your message, and wherever a personal value goes, click + Add Variable in the left panel.

The Add a dynamic variable dialog with the Variable name field marked 1, the Fallback value field marked 2 and the Add button marked 3
1. Variable name, used in code. 2. Fallback value. 3. Add.

For each variable:

  1. Variable name: what your code will call it. Keep it short, with no spaces, like name or interest_area. Write it down; you’ll need to spell it exactly the same way in code.
  2. Fallback value: what to show if the code doesn’t send a value. With the fallback there, a missing name reads “Hi there” instead of “Hi ,”. Fallbacks work in the email body but not in the subject line.

The variable appears in the text as ${name}. In this example the message is “Hi ${name}, thanks for signing up! We’ll send you news about ${interest_area}.”

The email text with two variables inserted: the Add Variable link is marked 1, the name variable is marked 2 and the interest_area variable is marked 3
1. + Add Variable. 2 and 3. The variables, shown as ${name} and ${interest_area}.

Click Apply to keep the text, and change the heading and anything else you like. Preview & Test at the top sends a test copy to your own inbox, which is worth one click to see it on your phone. Then click Save & Continue at the top right.

The finished email with the heading Welcome aboard and the Save and Continue button marked 1
1. Save & Continue.

6. Set the email ID and copy the snippet#

The last screen is the one your code depends on.

The Email ID and code snippet dialog: the Email ID field is marked 1, the Email new contacts tab 2, the Copy button 3 and Save 4
1. Email ID. 2. Who you’ll email. 3. Copy the snippet. 4. Save.
  1. Email ID. Wix gives it a random ID like VZT5sBu. Change it to something readable, such as newsletter_signup. This is the name you’ll use in code, so pick it now; changing it later means changing your code too.
  2. Who you want to email. Email new contacts is for anyone who fills in a form. Email site members is for logged-in members. The snippet changes to match.
  3. Copy the snippet. It lists every variable in the email, so it’s a handy check that the names are what you meant. (This template also had a SITE_URL variable built in, from the link in its footer.)
  4. Save.

The email now shows as Published in the list, with its ID.

The Triggered Emails list showing the new email with status Published marked 1 and email ID newsletter_signup marked 2
1. Published. 2. The email ID your code will use.

7. Send it from your code#

With the email published, sending it is a single function call: you pass the email ID, the ID of the contact to send it to, and a value for each variable.

JavaScript
triggeredEmails.emailContact("newsletter_signup", contactId, {
  variables: {
    name: "Sara",
    interest_area: "Velo tips",
  },
});

The snippet Wix generated imports triggeredEmails from 'wix-crm'. The current Velo reference uses 'wix-crm-frontend' in page code and 'wix-crm-backend' in backend code, which is what I use. Where the contact ID comes from, how to call this from a form, and why an email sometimes doesn’t arrive are all covered in how to send emails from Wix with Velo.

Quick fixes#

  • No Developer Tools in the dashboard: code isn’t on for this site yet. Go back to step 1.
  • The confirmation code never arrives: check spam, then use Send again, or Edit Details if the address has a typo.
  • A variable shows up empty in the email: the name in code doesn’t match the template exactly. interestArea and interest_area are different variables.
  • Drafts don’t send. If you clicked Save as Draft, open the email and finish with Save & Continue.

If you’d rather have this set up and wired into your forms for you, I do Wix Velo development.

Comments