Implementing a notification flow on Klaviyo can be more complex than on Shopify flows, but with the power of API keys, you can reproduce the same scenario.
To send a notification, you need to send a POST request to the jericommerce API, including the customer's email and the content of the notification.
Here's a step-by-step guide to create the action on Klaviyo flows:
1. Create a webhook action on Klaviyo.
2. On the webhook "Settings card" add the send-push endpoint as the destination URL. Replace the {programId}
parameter with your program ID, which you can find in the Jericommerce settings under Settings > Technical > Program Information
https://api.jericommerce.com/v1/programs/{{program_id}}/send-push
3. In the headers section, add your API key to authenticate the request. Go to Settings > Technical > API Keys create a new key or use an existing one, and paste the value in the Value field, with "api-key" in the Key field.
4. Now, you can complete the body with the customer information and the content information. The body is an array of notifications, and each one should have three keys:
- Email: The customer's email where you want to send the push notification, which you can retrieve from the user's profile that triggered this flow.
- Header: This is the title visible on the back of the wallet pass.
- Body: The long content of the push notification
here a body example:
1[{
2 "email": "{{ person.email|default:'' }}",
3 "header": "Welcome!",
4 "body": "Welcome to our awesome loyalty program!",
5 "link": "https://my-shop.com"
6}]
It is important to keep in mind that the body should be an array of objects, even when sending a single push notification.
For 3rd party systems, like Klaviyo, you could use our variables system, see the details on our post about variables.
This means that you could add as header, body or link some variable.
Klaviyo already have similar template variables, as we have and use the {{ variable_name }}
to encapsulate the variables.
For this reason, we already support another capsule style, which is <% variable_name %>
.
Both have the same functionality.
The on-device variables still using only one kind of format that is %%variable_name%%
Take a look at an example of using both types of variables in a push notification:
1[{
2 "email": "{{ person.email|default:'' }}",
3 "header": "Welcome <%name%>!",
4 "body": "Explore our latest collection!",
5 "link": "%%multiPass%%"
6}]