Once your event payloads are configured in Firmhouse, it's time to build the corresponding Klaviyo flows so your customer can get their emails.
Create Klaviyo metrics
Each event & payload in Firmhouse will have a corresponding metric and mailing flow in Klaviyo. To build the email flows, we must first create the metrics in your Klaviyo account.
The easiest way to create the metrics is by sending a test event from Firmhouse to Klaviyo. To do this, open your Firmhouse Email configuration page, select one of the templates, and click on Send test event to Klaviyo. We'll use the Upcoming Order Notice email as an example.
Provide your email address in the popup that appears and click Send test event to Klaviyo.
After you send the test event, you should be able to see a new API metric in your Klaviyo dashboard:
We can now use this metric to create a mailing flow.
Set up your email flow
Create a new flow
In your Klaviyo dashboard, navigate to Flows and select "Create flow":
You will be prompted to select a template or build your own. You'll need to select Build your own and provide a relevant name.
Once you submit the name, you can configure your email flow.
Configure the flow trigger
As a first step, let's link our new metric to this flow. You will find the metric in Your metrics section on the right side of the screen:
Once you select the trigger, you will be asked if you want to add any filters to it. You won't need to, so you can skip this step. Confirm and save the configuration in the popup that appears.
Add an email to your flow
To add an email to your flow, drag and drop the email block from the left-hand menu of the screen and link it to your trigger.
Now, we're ready to configure your email, from the Subject line to the most minor content details.
Email name - this is an internal value that will help you and your team identify the template when viewing your entire template list;
Subject line - the subject of your email, which the customers will see in their inbox;
Preview text - the preview text the customers will see in their inbox;
Skip recently emailed profiles - make sure to disable this feature so that all your emails get sent to your customers;
Template - Finally, let's select/build and customize the email template. Click on Select template and move on to the next section to learn more about customizing it.
Customize the email template
The first step to making an email your own is selecting and customizing your email template template. You could have your own template library, select one of the options available in Klaviyo or create a blank email.
In our case, we will select a template from the Klaviyo library.
Once you select your template, Klaviyo will open the email editor so you can adjust the content to your own use case. This is the moment to add your own images, branding and copy to the email to make it your own.
Remember that test trigger we sent from Firmhouse? It will come in handy now to help you inject dynamic data into your email! Let's open the Preview & test menu to see our event properties:
These are the test values you sent over from Firmhouse that can be injected into your email template. When you hover over a property, you can copy it with one click to insert it into your template.
Insert simple values
Let's take the name as an example. To make the email more personable, we want to use the name on the first email line. We would just have to copy the value from our trigger and paste it into the email template.
Use URLs
Similarly, we will want to add a button that sends the customer to the Self Service Center so they can manage their subscription. I will use the SelfServiceCenterUrl property to do that:
Parse event property lists
There are certain properties that can be more complex to work with, like a products (or invoices) list. In these cases we will need to loop over all the items in the event property to display them all.
Let's take the UpcomingProductList as an example.
I want to display all the products in this list in my email so that the customer knows which products they will receive with their next shipment. To do this, I will use the Content repeat function in Klaviyo.
In my case, I will add a new text block in my email and configure the Content repeat rules to loop over the items in the event.UpcomingProductsList (my list name from the event properties). To make it easier to access the properties for each element in the list, I will give it the alias item.
In my text element, I will want to display the product names and quantities. I will use the item alias (the one I just set) to access both properties, with an "x" in between.
Upon opening the email preview again, we can see the email with all the dynamic values we inserted:
You can consult the Klaviyo documentation learn more about How to use event data to personalize email and SMS flows.
Go live with your new flow
Once you've finished editing your template, you can set your flow to live. Back on your flow page, simply change the status of the email or use the Review and turn on feature to let the flow be triggered by all events sent from Firmhouse.