Send New Products Alerts Using Klaviyo For Saved Search Terms

This set of workflows and theme code allows your email subscribers to receive alerts for new products matching their specific keywords. When a new product is launched, the workflow checks against subscribers’ saved search terms and triggers an event in Klaviyo if there’s a match. This event initiates a Klaviyo Flow, sending a personalized email to subscribers about the new product. Enhance customer engagement and drive sales by keeping your subscribers informed about the products they care about most.

Watch the demo

Example: Search results page with subscribe form

Example: Search results page with subscribe form

Form code

And here’s the code that you would need to drop into the Search section in your theme:

<div class="page-width">
  <h2>Get email alerts when new products match this search</h2>
  
  <form id="mesa-form" style="max-width: 15em;"></form><script src="https://mymesa.site/kalen-jordan-dev/forms/new-product-alerts-form-to-subscribe-to-klaviyo.js"></script>
</div>

Example: Account page showing saved searches

Example: Account page showing saved searches

Account Liquid code

And here’s the code that you would need to drop into the Customer Account section in your theme:

<div class="customer account">
  <h2>Saved Search Alerts</h2>
  <ul id="mesa-saved-searches">

  </ul>
</div>

<script type="text/javascript">
  fetch('https://webhooks.getmesa.com/v1/kalen-jordan-dev/webrequest/65b8f60ffaa1a163ec2430b9/65b8f6135286116c286cdbe5.json?apikey=pobbFlA9BN73tE4gkbUsb5DLnZnwfIKi8g8UtM7U&[email protected]')
  .then(response => {
    if (!response.ok) {
        throw new Error('Network response was not ok');
    }
    return response.json(); // Use this for JSON responses
  })
  .then(data => {
    console.log(data);
    let wrapper = document.getElementById('mesa-saved-searches');
    let deleteUrl = "https://webhooks.getmesa.com/v1/kalen-jordan-dev/webrequest/65bba936e752db311c73465b/65bba936e752db311c73465d.json?apikey=pobbFlA9BN73tE4gkbUsb5DLnZnwfIKi8g8UtM7U";
    for (let row of data.search_terms) {
      wrapper.innerHTML += `
        <li>
          ${row.term} - <a href="${deleteUrl}&key=${row.key}" target="_blank">delete</a>
        </li>
      `;
    }
  })
  .catch(error => {
    console.error('There was a problem with your fetch operation:', error);
  });
</script>

Workflow 1: Subscribe form

workflow steps: Subscribe form

Workflow 2: When new product created, fire Klaviyo events

workflow steps: When new product created, fire Klaviyo events

Workflow 3: Get existing saved searches

workflow steps: Get existing saved searches

Workflow 4: Delete existing saved search term

workflow steps: Delete existing saved search term

Klaviyo Flow

Klaviyo Flow example

Questions about this workflow demo? Contact:

Kalen Jordan

MESA Service Partner

What you should do next

Whenever you’re ready…follow these 4 simple steps to get started:

  1. Add MESA to your Shopify store. The best way to get started is by adding the MESA app from the Shopify App store. Every plan includes the first 7-days free so you can be assured your workflow is running properly.
  2. Questions? Contact Kalen Jordan. MESA Service Partners can help personalize workflows or make any automations your business requires.
  3. If you know another merchant who’d enjoy reading this, share it with them via LinkedIn, YouTube, Twitter, or Facebook.

Automate anything and get more from your apps.
For free.

Start free trial
background: abstract lines

Automate everything with MESA

Make any workflow and get more from your existing apps.

Try MESA for free, 7-day trial included.