Send survey answers to Klaviyo with Shopify Flow

Shopify Flow can send a customer's answer to Klaviyo as an event on their profile. Zenith starts the workflow, Flow looks up the order to find the customer's email, and Klaviyo's Track an Event action sends the answer to your Klaviyo account. This guide sends the answer to How did you hear about us?, and the same steps work for any other question.

Before you start

  • A Flow workflow that starts on Zenith's trigger. If you have not made one yet, follow steps 1 to 3 of setting up Shopify Flow for Zenith, then come back here for step 4.
  • Klaviyo's Shopify app, installed and connected to your Klaviyo account.
  • Your Klaviyo public API key, from Settings, API keys in Klaviyo. A private key is not needed.

Add the Klaviyo steps

  1. Keep one question

    Click + under the trigger and choose Condition. Set it to check that question is equal to the question you want to send to Klaviyo, typed exactly as your survey shows it (for example, How did you hear about us?). Add every step below on the path where the condition is true. Zenith starts a workflow for each question a customer answers or skips, so this is what limits it to one event per order. To send other questions too, such as your NPS question, repeat this workflow for each one, with its own event name.

  2. Look up the order

    Click +, choose Action and search for Get order data. Set Maximum number of orders to 1. Under Shopify API search query string, choose Advanced, and in Edit query enter id:{{orderId}}. This finds the order the survey was answered on, which is where the customer's email comes from.

  3. Loop over the order

    Click +, choose Action and add For each loop (iterate). Under Items, choose Get order data. Get order data always hands back a list, even of one order, and the loop is how the next step reads it.

  4. Send the event to Klaviyo

    Under Repeat for each item, click +, choose Action and search for Track an Event, the one from Klaviyo. Fill it in: Klaviyo Public API Key is your public key, Event Name is a name for the event (for example, Zenith: How did you hear about us), Customer Email Address is {{getOrderDataForeachitem.email}}, and Event Properties and Customer Properties are the two blocks below.

  5. Turn it on

    Click New Workflow to give it a name, then click Turn on workflow.

The properties to paste

Event Properties, the answer, any comment and the order, on the event:

{"answer": {{answer | json}}, "comment": {{comment | json}}, "order_id": {{orderId | json}}}

Customer Properties, the answer saved on the customer's profile:

{"heard_about_us": {{answer | json}}}

Paste each variable ending in | json as it is, without quotes around it. | json adds the quotes itself, and it keeps a quote mark in a customer's answer from breaking the properties. Every other field is in the variables table, and any of them can go in the same way.

What to do with it in Klaviyo

  • Segment by answer. Create a segment on what someone has done, choose Zenith: How did you hear about us at least once, then click the filter icon on that row to add answer equals, for example, Instagram. The filter is on that icon, not in the count field.
  • See it on the profile. The Customer Properties block saves the answer as heard_about_us on the customer's Klaviyo profile, beside the event.
  • Start a flow from the event. A Klaviyo flow can be triggered by the event. For a follow-up after a low NPS score, build a second workflow the same way with the condition set to your NPS question and its own event name, then filter the Klaviyo flow on the answer property. The score arrives as text, such as "3".

What to know

  • Without the condition, one event per question. The workflow runs once for every question a customer answers or skips, so a customer who answers three questions sends three events.
  • An empty comment arrives as n/a. An answer without a comment sends "comment": "n/a".
  • Events can take a minute or two to appear on the profile in Klaviyo.
  • Zenith cannot see your workflows. If events stop arriving, check the workflow in Flow itself.

Privacy

Zenith never receives or sends the customer's email. Your own workflow looks it up inside Shopify and sends it, with the answer, to your Klaviyo account. Your privacy policy should cover sending survey answers to Klaviyo.

Install Zenith from the Shopify App Store