Use Liquid in Beefree SDK for Email Personalization
This recipe explains how you can use Liquid in Beefree SDK to support advanced email personalization options for your end users.
Overview
This project showcases how to configure Beefree SDK's email editor with Liquid templating for dynamic and personalized email content. Built with React and the @beefree.io/sdk npm package, it's designed for developers and teams who need to customize Beefree SDK's email builder for end users who need to create sophisticated and highly personalized email campaigns that include conditional content and product loops.
This project is designed for:
Email Developers who need advanced personalization features
Marketing Teams creating dynamic, data-driven campaigns
Developers integrating advanced email functionality into their applications
Agencies building advanced custom email solutions for clients
Reference the project code in the beefree-liquid-email-personalization GitHub repository.
The video provides a visual example of the demo and how Display Conditions, Content Dialog, and Merge Tags are integrated on the frontend.
Getting Started
This section includes what you need to get started with the project.
Prerequisites
Node.js (v16 or higher)
npm or yarn
Beefree SDK credentials
Installation
Clone the repository:
Install dependencies:
Set up environment variables:
Start the development servers:
Open your browser to
http://localhost:3000
Development
The application uses:
Vite: Fast React development server
React: Modern UI framework
@beefree.io/sdk: Official Beefree SDK npm package
Proxy Server: Backend for authentication and API calls
The React app runs on port 3000 and proxies API calls to the backend server on port 3001.
Configuration
The main configuration is in src/App.jsx. Key areas you can customize:
Merge Tags: Add your custom data fields in the
MERGE_TAGSarrayDisplay Conditions: Create conditional logic for your use cases in
getDisplayUseCases()Custom Rows: Define your pre-built rows in the
rowsConfigurationContent Dialogs: Build custom user interfaces in
makeContentDialog()
Additional Resources
For questions and support:
Check the Beefree SDK documentation
Review the Liquid documentation
What's Included
This section lists what's included within this project.
React Application: Modern React-based email editor
Beefree SDK Integration: Using the official
@beefree.io/sdknpm packageLiquid Templating: Support for dynamic content and personalization
Display Conditions: Conditional content based on customer data
Custom Rows: Pre-built email templates with Liquid integration
Content Dialogs: Custom modals for enhanced user experience
Merge Tags: Drag-and-drop personalization fields
Product Loops: Dynamic product recommendations and abandoned cart items
File Structure
This project has the following file structure.
Liquid Overview
Liquid is a template language created by Shopify that allows you to create dynamic content by embedding simple logic and variables into your templates. It's widely used in email marketing for personalization and conditional content.
Key Liquid Features in this Project
The following list shows a few examples of Liquid used in this project.
Variables:
{{ customer.first_name }}Conditionals:
{% if customer.is_vip %}...{% endif %}Loops:
{% for product in products %}...{% endfor %}Filters:
{{ product.price | money }}Comments:
{% comment %}...{% endcomment %}
Why Liquid for Email?
Liquid is particularly well-suited for email personalization because it:
Supports complex conditional logic
Handles loops for dynamic content (products, recommendations)
Provides built-in filters for formatting
Is language-agnostic and widely supported
Integrates well with CRM and e-commerce platforms
Beefree SDK
Beefree SDK is a JavaScript library that provides a complete email editor experience. It's designed to be embedded into web applications, offering a visual drag-and-drop interface for creating professional email campaigns. This project uses the official @beefree.io/sdk npm package for modern React integration.
Key Capabilities
Visual Editor: Intuitive drag-and-drop interface
Responsive Design: Mobile-first email creation
Template Library: Pre-built templates and components
Custom Content: Support for custom rows and modules
API Integration: Suite of different APIs for extending the builder's functionality
Multi-language: Language-agnostic implementation
Beefree SDK and Liquid
The combination of Beefree SDK and Liquid creates a powerful email personalization platform:
Visual Editing: Users can design emails visually while incorporating dynamic content
Real-time Preview: See how personalization will look with sample data
Flexible Logic: Complex conditional content and loops
Scalable: Handle complex personalization rules
Developer-Friendly: Easy to integrate and customize
Project Implementation
This section outlines and describes the Beefree SDK and Liquid integration.
Beefree SDK Configuration
The beeConfig includes merge tags, display conditions, content dialogs, and custom modals. The following code snippet shows an example of how these features come together in the React implementation:
Merge Tags Integration
Merge tags provide personalization fields that can easily be added to email designs by end users on the frontend:
Display Conditions
Display conditions allow for conditional rules to be wrapped around rows within designs inside of the email builder. The following code snippet displays an example of conditional rules implemented within this project.
Custom Content Dialog
The content dialog provides a custom modal for selecting display conditions:
Customization Guide
This section discusses how you can customize the code within this project to experiement with adding your own dynamic content use cases.
Creating Custom Modals
The following code shows an example custom modal that integrates the Beefree SDK content dialog:
Adding New Merge Tags
To add new merge tags for different data sources:
Custom Display Conditions
Create new display conditions for different use cases:
Frontend Personalization Examples
Reference the following resources to see advanced personalization examples and tutorials for end users of your application.
Product loops using merge tags and display conditions.
Hide or show content using display conditions.
Dynamic content using for loops.
Last updated
Was this helpful?

