The following examples contain JSON payloads that can be sent to Klaviyo instead of email. See this article on how to link Klaviyo for sending notification emails.
You can extend these examples yourself using the Liquid tags Firmhouse provides.
Confirmation email
{%- capture ProductnamesListString -%}
{%- for product in subscription.products -%}
{"title": "{{product.title}}", "ProductImage": "{{product.product_image_url}}", "ProductPrice": "{{product.price}}"};
{%- endfor -%}
{%- endcapture -%}
{% assign ProductnamesList = ProductnamesListString | split:';' | join:"," %}
{
"Name": "{{subscription.name}}",
"ProductnamesList": [{{ProductnamesList}}],
"MarketingConsent": "{{subscription.marketing_opt_in_accepted?}}",
"InvoiceAmount": "{{invoice.amount_price}}",
"LoginUrl": "{{subscription.login_url}}"
}
Upcoming order notice
{%- capture ProductnamesListString -%}
{%- for product in subscription.next_upcoming_products -%}
{"title": "{{product.title}}", "quantity": "{{product.quantity}}", "shipmentdate": "{{product.shipment_date}}"};
{%- endfor -%}
{%- endcapture -%}
{% assign ProductnamesList = ProductnamesListString | split:';' | join:"," %}
{
"Name": "{{subscription.name}}",
"UpcomingProductsList": [{{ProductnamesList}}],
"SelfServiceCenterUrl": "{{project.self_service_center_url}}"
}
Cancellation initiation email
{
"Name": "{{subscription.name}}"
}
Cancellation confirmation email
{
"Name": "{{subscription.name}}"
}
Billing cycle notification
{%- capture ProductnamesListString -%}
{%- for product in subscription.products -%}
{"title": "{{product.title}}", "ProductImage": "{{product.product_image_url}}", "ProductPrice": "{{product.price}}"};
{%- endfor -%}
{%- endcapture -%}
{% assign ProductnamesList = ProductnamesListString | split:';' | join:"," %}
{
"Name": "{{subscription.name}}",
"ProductnamesList": [{{ProductnamesList}}],
"InvoiceAmount": "{{invoice.amount_price}}",
"Paymentmethod": "{{subscription.payment_method}}",
"InvoiceUrl": "{{invoice.pay_now_url}}"
}
Failed payment
{% assign failed_invoices = outstanding_invoices %}
{% assign failedInvoicesCount = failed_invoices | size %}
{%- capture failedInvoicesString -%}
{%- for invoice in failed_invoices -%}
{"number": "{{invoice.number}}", "amount": "{{invoice.amount_price}}", "statusTranslated":
"{{invoice.status_translated}}", "pendingRetriesBoolean": {{invoice.pending_retries?}},
"payNowUrl": "{{invoice.pay_now_url}}" };
{%- endfor -%}
{%- endcapture -%}
{% assign failedInvoicesList = failedInvoicesString | split:';' | join: ", " %}
{
"Name": "{{subscription.name}}",
"paymentAmount": "{{payment.amount_price}}",
"paymentPayNowUrl": "{{payment.pay_now_url}}",
"failedInvoicesCount": "{{failedInvoicesCount}}",
"failedInvoicesList": [{{failedInvoicesList}}]
}
Manual charge notification
{%- capture ProductnamesListString -%}
{%- for product in subscription.products -%}
{"title": "{{product.title}}", "ProductImage": "{{product.product_image_url}}"};
{%- endfor -%}
{%- endcapture -%}
{% assign ProductnamesList = ProductnamesListString | split:';' | join:"," %}
{
"Name": "{{subscription.name}}",
"ProductnamesList": [{{ProductnamesList}}],
"Amount": "{{payment.amount_price}}",
"Description": "{{payment.description}}"
}
Outstanding invoices
{% assign failed_invoices = outstanding_invoices %}
{% assign failedInvoicesCount = failed_invoices | size %}
{%- capture failedInvoicesString -%}
{%- for invoice in failed_invoices -%}
{"number": "{{invoice.number}}", "amount": "{{invoice.amount_price}}", "statusTranslated":
"{{invoice.status_translated}}", "pendingRetriesBoolean": {{invoice.pending_retries?}},
"payNowUrl": "{{invoice.pay_now_url}}" };
{%- endfor -%}
{%- endcapture -%}
{% assign failedInvoicesList = failedInvoicesString | split:';' | join: ", " %}
{
"Name": "{{subscription.name}}",
"failedInvoicesList": [{{failedInvoicesList}}]
}
Invoice reminder
{
"Name": "{{subscription.name}}",
"InvoiceAmount": "{{invoice.amount_price}}",
"InvoiceNumber": "{{invoice.number}}",
"InvoiceUrl": "{{invoice.pay_now_url}}",
"FinalReminder": "{{invoice_reminder.final_reminder}}",
"ReminderNumber": "{{invoice_reminder.reminder_number}}"
}
Self service center login
{
"Name": "{{subscription.name}}",
"Login": "{{subscription.login_url}}"
}