Paragraph AddOn
Overview
The Paragraph AddOn type allows you to insert text paragraphs with formatting and merge tags. This is ideal for providing dynamic, personalized text content or pre-formatted text blocks to users.
Prerequisites
Before implementing a Paragraph AddOn in your code, you must first create the addon in the Beefree SDK Developer Console. Take the following steps to complete this:
Log into the Developer Console and navigate to your application.
Create a new Custom AddOn and select Paragraph as the type.
Configure the addon with a unique handle (for example,
my-paragraph-addon).Choose your implementation method (Content Dialog or External iframe).
Save the addon configuration.
Content Object Schema
This section discusses the Paragraph AddOn's object schema. Understanding this schema is a core part of successfully implementing a Custom Paragraph AddOn type.
Visit the complete Unified Schema in GitHub to see a comprehensive reference on how to structure data for all Custom Addons
Required Structure
The Paragraph AddOn schema centers on the html property which contains your text content with HTML markup. Optional styling properties like color, bold, italic, and padding allow you to pre-style text for brand consistency. The optional mergeTags array enables personalization by defining placeholders that get replaced with recipient-specific data at send time.
Basic Example
This minimal example demonstrates the simplest paragraph insertion with just HTML content. The html property contains standard paragraph markup that will render in the email. Users can further style and edit the text after insertion using the editor's sidebar controls.
With Styling
This example shows a styled paragraph with pre-configured text formatting and colors. By setting properties like bold, color, and padding, you ensure consistent brand styling across paragraphs without requiring users to manually apply formatting. This pattern is particularly useful for maintaining visual standards in email templates.
With Merge Tags
This advanced example demonstrates personalization through merge tags, which are placeholders in your text that get replaced with recipient-specific data when emails are sent. The html contains merge tags (like @first_name), and the mergeTags array defines what these represent and their preview values. The preview values show in the editor, while actual values are substituted by your email sending platform at send time.
Content Dialog Implementation
This section covers how to implement a Custom Paragraph AddOn using the Content Dialog method. It includes code snippets for three different scenarios:
Scenario 1: Pre-defined text content
Scenario 2: With personalization
Scenario 3: With user input
Pre-defined text content
The Content Dialog method enables programmatic paragraph insertion through a JavaScript handler. When users drag your paragraph addon onto the stage, this handler is immediately invoked and resolves with predefined text content. This pattern works perfectly for static text blocks that don't require user input, providing instant insertion of formatted paragraphs with consistent styling.
With Personalization
This pattern demonstrates how to create personalized text content using merge tags. By defining a set of merge fields, you enable dynamic content that changes for each email recipient. This is particularly powerful for creating personalized greetings, account-specific information, or custom messaging based on recipient data. The handler immediately resolves with the text and merge tag definitions, which your email platform will process at send time.
With User Input
This advanced pattern shows how to let users create or edit text content before insertion. By opening a custom text editor interface, users can compose their message, potentially select from available merge tags, and configure styling. The handler waits for user confirmation before resolving, providing a flexible workflow that combines user control with automated formatting and merge tag support.
Iframe Implementation
This section discusses how to implement the Custom Paragraph AddOn using the Iframe implementation method. It includes the core concepts you need to understand to successfully implement Paragraph AddOns using an Iframe workflow.
Conceptual Flow
The Iframe method provides complete UI flexibility by loading your custom web application inside the Beefree editor. Your iframe communicates with Beefree through postMessage events, following a specific protocol. This approach is ideal for rich text editors, template selectors, or sophisticated interfaces where you need full control over text composition, formatting, and merge tag insertion before adding the paragraph to the email.
Required postMessage Communication
Your iframe must implement the standard postMessage protocol to integrate with Beefree. First, notify Beefree when your iframe is loaded and specify dialog dimensions. Listen for the "init" message to receive editor context. When the user finishes creating their paragraph, send "onSave" with your paragraph object including any merge tags. If the user cancels, send "onCancel" to close without inserting. This bidirectional communication ensures seamless integration.
1. Send "loaded" when your iframe is ready:
2. Listen for "init" and "load" messages from Beefree:
3. Send "onSave" with paragraph data:
4. Send "onCancel" if user cancels:
Simple Iframe Example
This complete HTML example demonstrates a functional text editor interface that integrates with Beefree. It includes the full postMessage protocol implementation, a simple textarea for text input, merge tag insertion capability, and proper save/cancel handling. Users can compose text and optionally insert personalization merge tags. You can expand this basic example with rich text editing, formatting toolbar, or template selection for more sophisticated text creation.
Understanding Merge Tags
Merge tags allow personalization by acting as placeholders in your text:
The previewValue is what displays in the editor preview, while the actual values are substituted by your email sending platform when emails are sent.
Last updated
Was this helpful?

