How to add Alvas to a flow in Klaviyo
Step 1 - Integration Mode
Inside the Alvas platform, you should go -> Emails.
Click on an email, and go into Texts.
Now you should turn on Integration Mode by flipping the "Integration Mode" switch:
Once the switch is flipped, your screen will look like this:
In the middle of your screen, you can see the URL, Headers, and Payload.
Step 2 - Add Webhook and Wait
You should now go to the tab with your Klaviyo flow, and open the flow editor.
For this example, I will show you a Browse Abandoned flow, yet it could be any other event-triggered flow.
A simple flow would look something like this:
You should add a Webhook and a 10-minute wait like this:
Note you will need 1 webhook for each email template that you want to personalize using Alvas.
Step 3 - Configuring the Klaviyo webhook
Now you should go back into Alvas and click on the Destination URL - which will copy it to your clipboard.
Then you should insert it into the "Destination URL" inside the Klaviyo webhook.
And similarly, you should do the same with the JSON Body.
Replace all the JSON code with what you've copied like this:
Finally, click save on the webhook.
Step 4 - Adding webhook Headers
On the right menu of the webhook, you can see input fields for a Header Key and Value.
You should now copy the Header Key from Alvas.
It will always have this value:
Then paste it into the Header Key input field inside the Klaviyo Webhook.
Now, do the same for the Header Value.
And paste it into the value input field.
When you've done that, remember to click "Save" on the webhook.
Step 5 - Send test request
Now you can preview the webhook Payload, and see the data you are going to send over to Alvas.
To do this, click on the "Preview" button in the right menu of the Webhook settings.
When you do that you see a pop-up with all the event data.
Scroll all the way to the bottom of the pop-up window, where you will see an example payload.
Here you should check that all data is present.
Note - the profile_id for some accounts will not be present. That is fine - you should leave it empty if it's not displayed. All other data points should be populated.
If you're having trouble seeing other data points, please read this guide.
When you've confirmed that all data is present, click on the "Send Test Request" button.
You should see a green bar saying "Successfully sent webhook".
When that happens, head over to the Alvas platform, and go -> Logs.
Here you will see a new log being generated.
If you encounter issues when sending the log, or get a 701 error inside Alvas, it's likely due to the JSON body in the Klaviyo not being configured correctly.
Typically, it happens for stores that are not using Shopify as their CMS.
We've made a guide on how to fix that, and you can see it here.
Step 6 - Add Mergetags
Now, the AI will write an email any time a person triggers the Webhook step.
Then we need to insert these texts into the email inside Klaviyo, and for that you need to add mergetags to the email.
Turn on integration mode.
Then for the Subject Line click "Copy Mergetag".
Go into the flow in Klaviyo and paste it into the Subject Line field for the email below the webhook.
Now do it again for the Preview Line.
Copy the Mergetag from Alvas.
And paste it into Klaviyo.
Remember to save the email in Klaviyo.
After adding the Subject and Preview line, you should open the HTML editor inside Klaviyo.
Then go back into Alvas and copy the mergetag for the Headline.
And inside the HTML editor, you should replace the former headline with the mergetag.
Continue replacing the entire email with mergetags.
To ensure that it works, you can preview the email by clicking "Preview" in the top hand right side.
Step 7 - Add Tracking
Inside the template where you've just added Mergetags, go up to the URL and copy the Message ID that is shown after "/message/".
The Message ID is always 6 characters and can be a mix of letters and numbers.
Then go into the email in Alvas and to the Self Learning tab.
And paste the Message ID into the Alvas Message ID.
Save the email, and you've completed this step.
Next step: Prompting
After adding Alvas to your Klaviyo flow, you should start prompting Alvas, to make the emails have your desired message.
You can follow this guide.