All pages
Powered by GitBook
1 of 16

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Introduction to Beefree

Welcome to the Beefree SDK technical documentation! This page discusses what Beefree SDK is and outlines resources you can use to get started with integrating our no-code embeddable builders.

What is Beefree SDK?

Beefree SDK is an embeddable no-code builder that gives your end users the freedom to design stunning emails, landing pages, and popups—without writing a single line of code. It’s easy to configure, intuitive to personalize, and built to scale with your needs—whether you're a startup or an enterprise. Built with both developers and end users in mind, it’s designed to integrate easily into your application, scale as your product grows, and provide a flexible, white-label design experience.

For developers, Beefree SDK is easy to work with. You can personalize the design experience by adding simple configuration parameters. Want to enable or disable a feature? Just check a box in the Developer Console, hit save, and the changes are immediately reflected on the frontend. No complicated setup required.

For your end users, Beefree SDK is an intuitive drag-and-drop editor with everything end users need to bring their creative ideas to life—whether they’re creating an email campaign, a landing page, or an attention-grabbing popup. Content blocks like titles, images, lists, tables, buttons, and more are all available right out of the box.

Beefree SDK includes the following features and more:

  • Email builder: A creation environment that helps end users quickly create beautiful emails. This environment supports your end users in following email creation best practices recommended by industry experts.

  • Page builder: A creation environment that empowers end users to build visually stunning landing pages. They can use a landing page as a link for a call-to-action (CTA) inside emails, to embed forms and capture information, or to create standalone pages.

  • Popup builder: The that provides end users with the tools they need to build compelling popups that capture attention.

This site discusses the technical capabilities of Beefree SDK, and how to embed it into your web application. To learn more about the end user experience, and how your end users will interact with Beefree SDK on the frontend of your application, reference the . Markdown files for this guide are available in this , which you can clone and use as a starting point for building a knowledge base for your end users.

If you'd like to test the drag-and-drop user experience and explore how easy it is to customize the editor but aren't quite ready to spin up your own test application, our is the best place for you to get started. This simple, public implementation of the Beefree SDK helps you to:

  • Experience how easy it is for your end users to create designs using the intuitive, drag-and-drop editor UI

  • Easily test UI customizations (like , rearranging or , or applying )

  • Explore how you can to make it editable, and

Check out the following public demo apps built with v0, Lovable, and Replit:

  • is a demo application built with that simulates how Beefree SDK's no-code drag-and-drop email builder and editor can be integrated into your web application. The demo application includes static dashboards for campaign performance (open rate, click rate, conversion rate, and revenue), campaign breakdown, and subscriber information. Click the following link to access Email Builder by Beefree SDK:

  • is a demo application built with to simulate how Beefree SDK integrates within a Martech application's ecosystem. Click the following link to access Marketing Buddy:

  • is a demo application built with

Take the following steps to get started with Beefree SDK in a few minutes:

  1. Create an account to access the and obtain your credentials.

  2. to get started. Beefree SDK offers a generous Free plan that includes each builder type mentioned in the previous section.

  3. Create an application and .

Note: Visit the for a comprehensive list of features and the plan type they correspond to.

Reference Quickstart Guides specific to your tech stack:

Learn more about our three embeddable builders.

In addition to our drag-and-drop editors, we also offer a standalone application, which can be used alongside any of the builders. The File Manager is designed to simplify the organization and management of digital assets. It is an image and document management user interface that can be launched as a standalone application. This allows your customers to quickly upload or manage assets, without having to load one of the builders.

Learn more about our and .

We have a whole library of handy sample code to help you get started with basic Beefree SDK implementations and also learn how to put more advanced features to work. You can check out the available sample code or head straight to .

Learn more about Beefree SDK through . Explore , , and .

The Beefree SDK technical documentation is available at docs.beefree.io/beefree-sdk and in the .

You can contribute feedback to the documentation in one of the following ways:

  • On docs.beefree.io/beefree-sdk use the Was this helpful? emoji option on the right hand side of each page. After selecting an emoji, you'll have the option to submit written feedback on what you'd like to see in the documentation. This feedback goes directly to the documentation team and is integrated frequently.

  • Creating a pull request using the . Use this option in the event you find a typo, broken link, or small fix.

Configuration Reload

Overview

When you load a Beefree application inside the host application, you pass a configuration object with multiple sections that define the characteristics of the UI, UX, and available elements. However, there are cases when you may want to reload this configuration without the need to reload the Beefree application. In these cases, you can use a specific event to update the configuration while the editor is open.

Use cases

With this event, you can make on-the-fly changes to the user experience. For example:

  • Updating available categories for Saved rows

  • Refreshing a for authorization

  • Changing for the current user

  • Updating settings for the editor’s

You can load the configuration changes via a new instance event. Here’s an example:

AI-generated templates: With both Simple Schema and the Convert endpoints, you can build a custom AI-generated content creation experience (for assets such as emails, landing pages, or popups) for your end users.

  • AI Writing Assistant: A helpful AI assistant to help end users write their design content.

  • File manager: A tool to manage media assets (images, PDFs, and so on).

  • Template catalog: A design template catalog that integrates industry best practices to support end users in quickly getting across the finish line with their creations and achieving quick design wins.

  • API offering: Extend the functionality of any of the builders with our comprehensive suite of APIs.

  • to simulate how Beefree SDK can be integrated into an email building and editing application. Click the following link to access Email Design Buddy:
    Clone the beefree-sdk-sample-client repository, which includes the code for email and popup builder implementations.
  • Add your credentials, the Client ID and Client Secret from step three, inside the placeholders in the code.

  • Once the email builder, or popup builder, depending on which environment you chose, opens, you can start experimenting with the SDK's configuration by customizing the configuration parameters in the beeConfig section of the code.

  • You can also customize the SDK's configuration inside the Developer Console under the Application configuration section of the application you created.

  • Explore Beefree SDK

    Beefree SDK Playground

    Demo Apps

    Start a Simple Implementation

    Quickstart Guides by Framework

    Beefree SDK's Embeddable Builders

    File Manager

    Developer Essentials

    Sample Code

    Videos

    Contribute to the Docs

    no-code email
    no-code landing page
    popup builder is a no-code environment
    White Label End User Guide
    GitHub repository
    Playground
    moving the sidebar
    grouping content tiles
    Custom CSS
    import existing HTML
    export designs into HTML, image, or PDF formats
    Visit the Playground →
    Email Builder by Beefree SDK
    v0
    https://v0-email-builder-beefree-sdk.vercel.app/
    Marketing Buddy
    Lovable
    https://beefree-sdk-demo-app-marketing-buddy.lovable.app/
    Email Design Buddy
    Developer Console
    Create a new subscription
    obtain your Client ID and Client Secret
    Beefree SDK pricing page
    React No-code Email Builder
    Vue.js No-code Email Builder
    Angular No-code Email Builder
    Django Beefree SDK Demo
    File Manager
    File Manager
    File Storage Options
    here
    GitHub
    videos
    Tutorials
    Spotlight Sessions
    Case Studies
    beefree-sdk-docs GitHub repository
    beefree-sdk-docs GitHub repository
    Cover
    Email Builder
    Cover
    Page Builder
    Cover
    Popup Builder
    Replit
    https://email-design-buddy-beefree-sdk.replit.app/

    How it works

    Custom header
    Advanced permissions
    Content defaults
    
    var newConfig = {
      advancedPermissions: {
        // new permissions
      }
    }
    
    bee.loadConfig(newConfig)
    

    Create an Application

    Learn how to create an application within the Beefree SDK Developer Console.

    Overview

    In this article, we will discuss how to sign up for an account in the Beefree SDK Developer Console, create an application, and obtain your Client ID and Client Secret.

    This article will cover steps for the following processes:

    • Sign up for an account in the Developer Console

    • How to create an application

    The first step to experimenting with and embedding Beefree SDK's visual builders is to.

    Take the following steps to sign up for a Beefree SDK account:

    1. Navigate to the .

      1. Complete the required fields to create an account.

      2. Once the form is complete, click Sign up to embed Beefree SDK.

    1. Check your inbox and verify your email address.

      1. Once it is successfully verified, you'll be redirected to the . Enter your email and password to login.

    2. You'll be redirected to a page with an active free subscription called MyFirstSubscription. Under this subscription, there are four applications you can activate: Email Builder, Page Builder, Popup Builder, and File manager. You can activate one or all of them if you'd like.

    Once that’s done, you will be able to . Your dashboard will look like the following image.

    You will have the option to activate any or all of the following applications:

    Take the following steps to create an application:

    1. Click the Activate button that corresponds with the application you'd like to create.

    2. Type in a name for your new application.

    3. Click Create.

    Your application will look like the following in the dashboard once it is activated:

    You have successfully created an application. Now, you can enter the application Details and obtain your Client ID and Client Secret.

    Click on your application's Details button to view your Client ID and Client Secret. Use these to authenticate when you initialize it.

    With your Client ID and Client Secret, you can use our to experiment with a simple integration of Beefree SDK. You can also get started with .

    Reference the following related topics to learn more about customizing your applications, creating development instances, and referencing sample code.

    Inside the Beefree Developer Console, you have the option to regenerate the Client Secret for your application. To regenerate your application's Client Secret, take the following steps:

    1. Log in to the .

    2. Navigate to the application you'd like to update the Client Secret for.

    3. Click on the application's Details button.

    1. Navigate to Application keys within the application's details.

    2. Click Regenerate to generate a new Client Secret.

    1. You will be prompted to a modal and asked to confirm your application's name.

    2. Complete the App Name field and click Regenerate to complete the action.

    Your new Client Secret is now available and ready to use. Your old Client Secret will expire 24 hours after creating the new one. Ensure you replace it in all the necessary environments prior to its expiration.

    • Create

    Migrating from another provider to Beefree SDK

    Helpful tips for migrating from another content creation platform to the Beefree SDK

    If you are thinking of moving from a different content creation platform to the Beefree SDK, know that you are in good hands. Thousands of applications have been using our embeddable content builders since 2014, which means that our team has encountered a large variety of scenarios and guided customers like you through all sorts of migrations. We're here to help.

    We're known for providing a high level of support, which includes everything from the detailed technical docs that you are reading on this site, , and all the way to dedicated Slack channels for . We will learn about your business with an initial consultation followed by meetings with solution engineers, and set you up with an extended proof-of-concept period that allows you to get everything ready for your migration.

    If your users have created a library of designs in your legacy tool, we know one of the key questions is always: "How do I get existing designs into Beefree without having to ask my users to recreate them from scratch?"

    We've got you covered here:

    Your customers' existing designs will not need to be recreated from scratch in the Beefree builder. You can leverage the to take standard HTML emails and turn them into our proprietary JSON format.

    For a quick introduction to the benefits of this handy tool, see HTML Importer API: From HTML to Beefree-ready JSON in seconds.

    If you have legacy email designs created with MJML, our team can help you convert them into Beefree SDK JSON for loading in our editor. Reach out to our customer support team to learn more about the migration process.

    The process of switching content creation platform is particularly easy for those migrating from Unlayer. We have developed a tool that can help bulk-import your customers' designs: simply provide us with the Unlayer JSON files, and we'll convert them on our end to Beefree-compatible JSON documents, which your customers will be able to edit with the Beefree editor.

    Please reach out to our team to learn more about the process.

    Expert support

    Importing existing designs

    Migrate any email HTML to the Beefree SDK with the HTML Importer API

    extensive sample code
    Enterprise customers
    HTML Importer API

    Migrate MJML templates to Beefree SDK

    Migrating designs from Unlayer

    Click the Activate button corresponding to the application type you'd like to start experimenting with. Once it is activated, you'll notice Client ID appears.

  • Click Details to obtain your Client Secret and add any Application configurations you'd like to start exploring.

  • Sign up for a Developer Console account

    Important: Keep in mind that Beefree SDK will not charge you for using the Free plan. However, there are charges related to UIDs, CDN overages, and using the HTML Importer API. Ensure you add a credit card on file if you plan on using the HTML Importer API, or exceeding the thresholds for UIDs and CDN usage. Reference the Usage-based fees article for more information on thresholds.

    How to create an application

    Obtain your Client ID and Client Secret

    Regenerate Client Secrets

    This feature applies to paid plan types.

    For 24 hours after regenerating a new Client Secret, you will temporarily have access to two Client Secrets—your old one and your new one. After 24 hours, you will only have access to the new Client Secret for your application.

    Obtain your client secret and client id
    sign up for a Beefree SDK account
    Beefree SDK sign up page
    Log in page
    log into the Beefree SDK Console
    Email Builder Application
    Page Builder Application
    Popup Builder Application
    File manager Application
    Sample Code
    your own implementation of Beefree SDK
    Beefree SDK Console
    development applications
    Configuration parameters
    Server-side options
    Sample code

    Development Applications

    Learn about the different environments available through Beefree SDK and how to get started to with each.

    Development Applications

    Development applications are available with any Beefree SDK paid plan.

    What is a Development Application?

    A development application is a child application that is linked to your parent application within the Beefree SDK console. The purpose of these child applications is to create development, QA, or any other type of applications that you can merge your application’s changes to prior to pushing them to production. This empowers you to test new features, even on a higher plan, within a controlled environment prior to releasing them to your application’s end users.

    How to Create a Development Application

    You can create a development application within your Beefree SDK console. Prior to creating a development application, ensure you have a paid plan with Beefree SDK. Development applications are only available on paid plans.

    To create a development application, take the following steps:

    1. Log in to your

    1. Create a new application

    1. Navigate to your dashboard where the new application is located

    2. Click the + next to Add a development instance

    1. Type in the name of your development application, for example “development environment” or “QA environment”

    1. Click Create

    2. View the new development application available in your Beefree SDK dashboard

    There are multiple benefits to utilizing development applications. A few of these benefits are the following:

    • Merge and test changes to your application prior to releasing them to your end users.

    • Create an environment for different contributors in your development cycle, for example QA Engineers, frontend developers, backend developers, and so on.

    • Access next tier Beefree SDK features in your development applications.

    Consider the information outlined in this section when working with development applications.

    Beefree SDK lets you explore higher-tier features in your development environment for testing purposes. However, these features cannot be deployed to production unless they are included in your current subscription plan.

    To use higher-tier features in production, you must .

    Development apps inherit the same plan that your production app is on. If you wish to test features that are available on a higher plan, go the application details and click “CHANGE PLAN” in the upper right.

    While setting up a development application is a feature on paid plans, please note that still apply. If, in your development application, you're using any of the Beefree SDK features that generate usage-based fees, that usage will count towards your plan's monthly allotment. You'll be charged usage-based fees if your usage (across production and development applications) exceeds your plan's allotment. . You can view usage statistics for your development applications by logging into the , locating the development application you are working with, and looking at the Statistics widget on the application details page.

    Naming conventions

    Overview

    Here is a list of terms used frequently throughout the Beefree SDK technical documentation. Things can get a bit tricky when embedding a software application within another software application, so this page is an attempt to create as much clarity as possible. We hope we find it useful. If anything sounds confusing or if you have any suggestions for improvement, please contact us.

    Frequently used terms

    • Beefree SDK A toolkit that includes white-label, no-code builders for emails, landing pages, and popups. The toolkit also provides a range of components, APIs, sample code, and support services to help you seamlessly integrate into your software a content creation workflow that your customers will love.

    • Beefree SDK subscription A subscription to the Beefree SDK. There are different , starting with a Free plan. Once you have a subscription, you can create one or more Beefree applications.

    • Beefree application An instance of any of the no-code tools that can be embedded in your software. They include:

      • Email Builder

      • Page Builder

    • Beefree SDK Console A multi-user administration panel where you can sign up for a Beefree SDK subscription, manage the subscription, and create and configure a Beefree application within a subscription.

    • Production application An instance of a Beefree application used in your production environment.

    • Development application An instance of a Beefree application used for development, QA or staging environments. You can create multiple, development applications under a production application.

    • Host application Your software application, which will host one or more Beefree applications.

    • Beefree system The backend system that interacts with your Beefree application to provide services such as application authorization.

    • Content Services API A set of in the Beefree system that allow you to perform a variety of tasks connected to the implementation of a content creation workflow.

    Manage Subscriptions

    This feature is visible to Beefree SDK account Owners.

    Manage Subscriptions in the Console

    We understand that each company has its own unique needs. For that reason, we offer the flexibility of adding multiple Beefree SDK subscriptions within the Developer Console. Through this option, you can take advantage of multiple subscriptions to our product for your teams, business units, and so on.

    How to Add a New Subscription

    You can create an additional subscription within the Beefree SDK Developer Console.

    To achieve this, take the following steps:

    1. Log in to the Beefree SDK Developer Console

    2. Navigate to your dashboard

    3. Click Add new subscription on the upper right-hand side of the screen

    4. Type a name for your next subscription and click Next

    5. Choose a plan and click Select plan

    6. Confirm the plan you selected

    7. Finalize your additional subscription

    Manage Users

    Learn how to manage users within the Beefree SDK Developer Console.

    Manage users in the Console

    You can invite additional users to your Beefree SDK Console. To do so, select Manage users from the personal menu in the top right corner of the screen.

    The user that initially created the account is identified as the Account Owner and can add users from this page.

    Additional users will be identified as Admins.

    Note: It's currently not possible to limit which applications users can see within the Developer Console.

    The Account Owner has the following additional privileges, compared to Admins:

    • Add, edit or delete users, as described above.

    • Turn on , using tokens provided by mobile apps like Google Authenticator or Authy. 2FA can be enabled either for specific users, or account-wide from the Settings & Security section in the personal area ().

    • Change the company’s name, also in Settings & Security.

    Set up two-factor authentication

    Setting up two-factor authentication will keep your developer account extra secure. Two-factor authentication means that users will need to provide two different identifications to log in to their : their regular login credentials, and a token generated by a two-factor authentication app.

    When 2FA is set up, users will need to:

    • download a two-factor authentication app to their mobile device (e.g. , , , and others);

    How the UID parameter works

    is based on the concept of unique users of the editor. A unique user is one that is identified by a unique UID, as described below. The system counts unique UIDs within a billing period, and resets the count to zero at the start of the next billing period.

    The UID parameter:

    • Is an alphanumeric string passed to Beefree SDK throughout the .

    • Can contain letters from a to z (uppercase or lowercase), numbers and the special characters “_” (underscore) and “-” (dash).

    Popup Builder
  • File Manager

  • subscription plans
    API methods
    Image 1.0 Add New Subscription Button within the Developer Console
    two-factor authentication
    learn how to set up 2FA for your account
  • Make sure that you pass a string, not a numeric value. So even if your UID is a number, pass "12345" and not 12345.

  • The UID should not be Personal Data, as indicated in the Beefree SDK License Agreement. Further information about how your use of a Beefree SDK service relates to the EU’s General Data Protection Regulation (GDPR) may be found here. Our Privacy Policy, which describes the processing activities carried out by Beefree SDK as Data Controller, is available here.

  • It uniquely identifies a user of the application. When we say “uniquely”, we mean that:

    1. It will be counted as a unique user for monthly billing purposes.

    2. Images (and other files) used by the user when creating and editing messages will be associated with it and not visible to other users (when using the default storage).

    It’s entirely up to you, as the host application, to determine when to use a new UID at the time you initialize the editor for your users. In 99% of the cases: one UID = one CLIENT ACCOUNT in your application. Sub-users of a client account typically share the same UID.

    A quick example to help you visualize this.

    • We use the UID in the File Manager to identify where images will be stored

    • You typically don’t want client ABC to see client XYZ’s images

    • So you will use a certain UID for client ABC and another UID for client XYZ

    • If there are 5 users within client ABC account in your application, however, it’s OK that they see the same images, since they are likely collaborating on the same emails or landing pages, so you don’t need to use a different UID: all 5 will share the same UID.

    UIDs in production are counted separately from UIDs in a development application. For example, if you have the following UID in both a production and development application, the unique UID will be counted twice toward your plan's allotment.

    In this scenario, Beefree SDK will treat these as two distinct users, and count this UID twice—once for each environment. Reference Usage-based fees for more information on Beefree SDK plan types and their corresponding uid allotments.

    Properties

    Pricing for Beefree SDK
    server-side authorization process

    Unique identifier

    Users, sub-users and client accounts

    Development Applications

    Important: If you use a unique uid across multiple development applications, it will only be counted once. Similarly, if you use a unique uid across multiple production applications, it will only be counted once.

    uid: 'test1-clientside' // production uid and development application uid

    Create as many child development applications linked to your parent production environment as you’d like.

    Note: This creates a production environment for your application.

    Benefits of Development Applications

    Important Considerations

    Testing next-tier features in your development application

    Usage-based fees on development applications

    Beefree SDK Developer Console
    upgrade to the appropriate plan
    usage-based fees
    Learn more about usage-based fees
    Beefree SDK Developer Console
    Beefree SDK Console Dashboard with an Example QA Environment Development Application
    use their device and the app to generate a token and log in.

    If you’re an account owner (i.e. the user who created the Beefree SDK account), you may require all account users to use two-factor authentication to log in. To do so, go to the Setting & Security section in your personal area and enable Require two-factor authentication at login.

    After saving the setting, you will be prompted to scan a QR code with a 2FA application to generate a security token to complete the setup.

    When this setting is ON:

    • every user will need to enter an authentication token, generated with a 2FA mobile app, to log into the account;

    • when you create a new user, the 2FA toggle will be set to ON by default.

    When adding or editing a user, you may also decide to turn on or off 2FA for that user, in order to:

    • turn on 2FA, when 2FA is OFF at the account level;

    • turn off 2FA, when 2FA is ON at the account level.

    If 2FA is OFF at the account level, additional users, i.e. admins, can turn on 2FA for themselves, for their peace of mind. They can go to the “Profile” section of their personal area and turn it on.

    Overview

    Beefree SDK Console
    Authy
    Google Authenticator
    Authenticator Plus

    Setup for Account owners

    Setup for Account admins

    Note: Instead, if 2FA is ON at the account level, admins cannot turn it off from the “Profile” page and must contact their account owner.

    Debugging the Beefree SDK Editor

    Overview

    The debug parameter in the beeConfig is an optional object that enables internal debugging features within the Beefree SDK editor. It's designed to help developers inspect configurations, translations, and data structures more easily during development.

    How to Use

    You can pass the debug parameter directly in your beeConfig object when initializing the editor. Alternatively, you can set or update it live using the loadConfig method—no need to refresh the editor.

    Example (in beeConfig):

    Set it live (no refresh needed):

    The debug parameter in the Beefree SDK configuration accepts the following parameters:

    • all (boolean): Enables all available debug options (inspectJson and showTranslationKeys). Use this during heavy debugging sessions.

    • inspectJson (boolean): Adds an eye icon in the toolbar that allows you to inspect the specific JSON used for that element. Useful for understanding how your configuration is being rendered.

    The debug parameter is particularly helpful in the following scenarios:

    • You're troubleshooting UI rendering issues tied to configuration JSON.

    • You need to inspect what exact data is being used for rows/modules.

    • You're working on translations and want to ensure correct keys are being used.

  • showTranslationKeys (boolean): Replaces localized strings with their translation keys throughout the UI. This is especially helpful when debugging i18n issues or checking for missing .

  • const beeConfig = {
      debug: {
        all: true,                 // Enables all debug features
        inspectJson: true,        // Shows an eye icon to inspect JSON data for rows/modules
        showTranslationKeys: true // Displays translation keys instead of localized strings
      }
    };
    beeInstance.loadConfig({
      debug: {
        all: true
      }
    });

    Parameters

    When It's Useful

    module/row
    translations

    Workspaces

    Overview

    In user interfaces, a workspace is a parameter that changes the appearance, settings, and widgets available in an builder, to help the user to focus on what matters.

    In Beefree SDK, workspaces are an optional parameter that can be used to provide an experience focused on context and purpose, and to facilitate the outcome of an editing session.

    You can load the builder with a certain workspace, but workspaces can also be changed by the user when editing, on-the-fly.

    Switching between workspaces might change:

    • content visibility on the stage

    • tiles availability in the content tab

    • available previews

    • outputs when saving a content

    • …and more!

    If no workspace is loaded at launch, the builder starts in its “Default” workspace.

    We currently offer 3 additional workspaces, and we are planning to launch more as we evolve BEE and its capabilities.

    These 3 workspaces revolve around the use of AMP content, and are provided so that you can tailor the experience of creating AMP emails in Beefree SDK.

    Here is an overview of the different workspaces and their differences. Please for more information on using AMP in Beefree SDK.

    default
    mixed
    amp_only
    html_only

    Here is an example of loading Beefree SDK with a “mixed” workspace:

    You can implement a workspace selector within your application, so that users can switch between workspaces, by using the loadWorkspace(type) method.

    First, you need to define template files for the workspaces you want to propose, as JSONs:

    Then, you can load those workspaces at runtime:

    And here is how to create a simple select to switch workspace:

    After you load a workspace, the application will trigger one of these three callbacks:

    The additional workspaces for AMP (AMP-only and HTML-only) can become helpful if you want to tailor the user experience of creating AMP emails, by adding:

    • a workflow where users decides if they want to create a standard message or an AMP-powered message (in the first case, AMP components will be hidden in the builder;

    • an option to switch between the HTML and the AMP editing of a message.

    In addition, omitting the workspace, or loading the “default” workspace for certain users, has the effect of disabling AMP for those users, even when AMP content is enabled in the . This way, you can decide to make the feature available to customers of your application:

    • depending on the subscription plan that they are on (i.e. you could push users to a higher plan based on the ability to use AMP);

    • depending on the purchase of an optional feature (same);

    • only if they are “beta” customers, so they see it while keeping it hidden from the rest of your users.

    Installation and Fundamentals

    Learn and understand the core concepts related to how you can install the Beefree SDK npm package, authenticate, and get started with Beefree SDK.

    This page discusses the core concepts related to installing Beefree SDK within your application. These core concepts are the following:

    • Installing the within your application.

    • Understanding the and how to successfully authenticate server-to-server.

    Authorization Process

    The Authorization Process is an important step throughout your . This step validates your Beefree SDK credentials and provides you with a token. Take the steps outlined in this document to ensure you accurately complete the authorization process.

    Prior to getting started with the authorization process, ensure you reference the . Reference both the and the to get the latest information.

    You can install Beefree SDK using either or :

    Using npm

    Using Yarn

    Package Details:

    Content tiles

    HTML content tiles

    HTML & AMP content tiles

    HTML & AMP content tiles

    HTML content

    AMP sidebar properties

    No

    Yes

    Yes

    No

    Available in preview

    HTML content

    HTML & AMP content

    HTML & AMP content

    HTML content

    onSave callback files

    HTML

    HTML & AMP

    HTML & AMP

    HTML

    Loading a template with AMP content

    The onWarning is triggered

    Template loads

    Template loads

    Template loads

    Loading a template with HTML content only

    Template loads

    Template loads

    Template loads

    Template loads

    Availability of the hide on AMP/HTML property

    Not available

    Yes

    Yes

    Yes

    Behavior for hidden for HTML/AMP content

    The onWarning is triggered

    Both are visible

    Only “hidden for HTML” content is visible

    Only “hidden for AMP” content is visible

    Stage message

    HTML content

    HTML & AMP content

    HTML & AMP content

    Available workspaces

    Starting the builder with a workspace

    Switching workspaces

    Workspace callbacks

    Success

    Failure

    Invalid workspace

    Use cases

    refer to this page
    Beefree SDK Console

    HTML content

    
    type ClientConfig = {
      workspace?: {
        type:'default'|'mixed'|'amp_only'|'html_only'
      }
      // ....
    }
    
    const beeConfig: ClientConfig = {
      workspace:{
        type:'mixed'
      }
      // ....
    }
    
    
    //Create the instance 
    function BeePlugin.create(token, beeConfig, (beePluginInstance) => { 
      //.... 
    }
    
    {
      "type":"mixed"
    }
    type Workspace = 'default'|'mixed'|'amp_only'|'html_only'
    
    const req = url => fetch(url).then(r => r.json())
    const loadWorkspace = async (workspace:Workspace) => {
      const { type } = await req(`https://example.com/workspaces/${workspace}.json`)
      beePluginInstance.loadWorkspace(type) 
    }
    <select id="workspace" onchange="loadWorkspace(this.value)">
    <option selected="selected" value="">WORKSPACE</option>
    <option value="default">DEFAULT</option>
    <option value="mixed">MIXED</option>
    <option value="amp_only">AMP_ONLY</option>
    <option value="html_only">HTML_ONLY</option>
    </select>
    //SUCCESS 
    onLoadWorkspace: function (workspace) {
      console.log(`workspace: ${workspace} has been loaded`);
    },
    //FAILURE
    onError: function (error) {
     console.error('error: ', error);
    },
    {
     code: 1400, 
     name: "Invalid workspace type",
     message: "RANDOM : is not a valid workspace",
     details: "Available workspaces are: [ default,mixed,amp_only,html_only ]"
    }
    Adding the required Beefree SDK configuration to your application.

    By the end of this guide, you'll understand the core concepts related to how you can install the package, authenticate, and get started with Beefree SDK. You'll have working a local environment set up on your machine to experiment with.

    For a quick start, visit our React, Angular, and Vue.js Quickstart guides, which each include complete sample code by framework.

    Prior to integrating Beefree SDK, ensure you have completed the following:

    1. Signed up for a Beefree SDK Developer Console account.

      1. Created an application within the Developer Console

      2. Obtained a Client ID and Client Secret for that application

    2. Node.js installed.

    3. A modern web browser (Chrome, Firefox, Safari, Edge).

    This section covers the core concepts for installing Beefree SDK within your application and launching a local environment.

    The concepts covered in this section are the following:

    • npm package installation

    • Authentication Process

    • Beefree SDK Initialization

    You can install Beefree SDK using either npm or yarn:

    Using npm

    Using Yarn

    Package Details:

    • TypeScript Support: Included

    • License: Apache-2.0

    • Repository: Beefree SDK GitHub

    This section discusses the authentication process. It explains important concepts related to how to successfully authenticate using a server-to-server call.

    The secure authentication flow requires a server-to-server call to obtain a JWT token. This process ensures your client credentials remain protected.

    At a high level, the steps you need to take throughout the authentication process are the following:

    1. Secure Credentials

      1. Never expose client_id or client_secret in frontend code.

      2. Store them in backend environment variables (.env).

    2. Backend Proxy Setup

      1. Set up a server-to-server call.

      2. Forward the complete response access_token and v2 to the frontend.

    3. Auth Request from Backend

    • Call Beefree SDK’s loginV2 and include the following required parameters:

      • client_id

      • client_secret

      • uid

    1. Frontend Handling

      1. Fetch token only from your proxy.

      2. Extract access_token from response.

      3. Initialize SDK: new BeefreeSDK(access_token).

    The following table lists and describes the required authentication parameters.

    Parameter
    Type
    Description
    Example

    client_id

    string

    Your application client ID

    "abc123-client-id"

    client_secret

    Example Implementation (Node.js)

    This section discusses how to initialize Beefree SDK.

    Create a container element in your HTML where the editor will render:

    Beefree SDK requires a configuration object with the required container property. Optional parameters are also available to customize the builder, but container is the only required one for initializing Beefree SDK.

    The following code snippet shows an example of this:

    Alternative approach:

    The following table explains the container property.

    Property
    Type
    Required
    Description

    container

    string | HTMLElement

    Yes

    DOM element ID for the editor or the HTML element itself

    Initialize the editor with a template JSON object:

    Reference the beefree-sdk-assets-templates repository in GitHub for example templates.

    The following table lists template management methods that are important for getting started.

    Method
    Description
    Example

    load(template)

    Load new template

    bee.load(newTemplate)

    reload(template)

    Force reload template

    bee.reload(updatedTemplate)

    Implement automatic token refresh to maintain uninterrupted sessions:

    How to use:

    1. Get a fresh token from your backend

    2. Pass it to updateToken()

    Enable real-time collaboration with these additional methods:

    How to use:

    1. Generate a unique session-id on your server

    2. Call join() with the same ID for all collaborators

    Q: Can I use the SDK without server-side authentication? A: While possible for testing, production implementations must use server-side auth for security.

    Q: How do I customize the editor's appearance? A: The SDK supports UI customization through configuration options. While the Configuration parameters provides a high level example, there are several configuration options outlined throughout the comprehensive technical documentation.

    Q: What happens when the token expires? A: When your token expires after 12 hours:

    1. The editor will become unresponsive

    2. You must proactively:

      // 1. Get a fresh token from your backend
      const newToken = await fetch('/refresh-token');
      
      // 2. Update the SDK instance
      bee.updateToken(newToken);
    3. Best practice is to refresh tokens before expiration (recommended at 11 hours)

    Q: Where can I find sample templates? A: Visit our template repository for examples.

    This comprehensive guide covers all aspects of Beefree SDK integration, from initial setup to advanced features.

    Remember to:

    • Always use server-side authentication

    • Implement proper token refresh logic

    • Test thoroughly before production deployment

    • Monitor for Beefree SDK updates and new features

    Introduction

    Authorization process
    npm install @beefree.io/sdk --save
    yarn add @beefree.io/sdk
    POST https://auth.getbee.io/loginV2
    async function initializeBeefreeEditor(templateJson, beeConfig) {
      try {
        const response = await fetch('http://localhost:3001/proxy/bee-auth', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({ uid: 'demo-user' }) // customize UID if needed
        });
    
        if (!response.ok) {
          throw new Error('Failed to fetch token from proxy server');
        }
    
        const { token } = await response.json();
    
        const BeefreeSDKInstance = new BeefreeSDK(token);
        await BeefreeSDKInstance.start(beeConfig, templateJson, "", { shared: false }); // templateJson is your design content
    
      } catch (error) {
        console.error('Error initializing Beefree SDK:', error);
      }
    }
    {
        "access_token": "...",
        "v2": true
    }
    <div id="beefree-sdk-container" style="width: 100%; height: 800px;"></div>
    const config = {
      container: 'beefree-sdk-container' // string
    }
    const containerElement = document.getElementById('beefree-sdk-container')
    const config = {
      container: containerElement // HTML Element
    }
    // After successful initialization
    const template = {
      // Your template JSON here
      // Sample templates available at:
      // https://github.com/BeefreeSDK/beefree-sdk-assets-templates
    };
    
    bee.start(template);
    // Refresh expired token (call before 12-hour expiration)
    bee.updateToken(newToken); 
    // Join a co-editing session
    bee.join({ uid: "user-123" }, "shared-session-id"); 

    Prerequisites

    Core Concepts

    Note: Reference the , , or Quickstart Guides for a guided walkthrough by framework and sample code using a simple implementations.

    Package Installation

    Authentication Process

    Authentication Endpoint

    Required Parameters

    Important Notes:

    • The UID must be consistent between authentication and SDK configuration.

    • Tokens are valid for 12 hours.

    JSON Authorization Response

    Beefree SDK Initialization

    Container Setup

    Configuration Options

    Full Configuration Reference

    Working with Templates

    Loading a Template

    Template Management Methods

    The instance method bee.start(template) does not need to be called immediately after create. In a SPA (Single Page Application) or React app, you can create the editor in a hidden global state but then call the start method when the template is selected and available. The application loads quickly when all steps are completed consecutively. However, by separating the loading workflow into two parts, the end-user will perceive loading in a fraction of the overall time. Remember, if the client_id belongs to a File Manager application, bee.start() can be called without any parameters.

    Additional Features

    Token Refresh Implementation

    Collaborative Editing

    Frequently Asked Questions

    Conclusion

    TypeScript Support: Included

  • License: Apache-2.0

  • Repository: Beefree SDK GitHub

  • Beefree SDK requires the host application to pass a container parameter in the client-side configuration. This is the only required parameters for the configuration.

    The following code sample shows an example of this parameter in the client-side configuration.

    To initialize your instance of the Beefree SDK builder, call the /loginV2 endpoint shown in the sample code below with your Client ID, Client Secret, and UID. The Client ID and Secret are available on the application details page of the Beefree SDK developer portal. UID represents your user as described in How the UID parameter works.

    The Beefree SDK system uses OAuth2 as the authorization framework.

    Reference How the UID parameter works to learn more about UID.

    The following code sample displays an example JSON response.

    The Beefree SDK authorization service will return a temporary access token if the authentication is successful. The client application can use the full response that contains the token to start or refresh a Beefree SDK session.

    The token expires after 5 minutes for security reasons. Beefree SDK will refresh an expired token automatically for 12 hours without re-authenticating the application. Beefree SDK will trigger the onError callback when the token can't be refreshed automatically.

    You can reference /loginV2 examples in the following Quickstart Guides:

    • React

    • Vue

    • Angular

    Ensure to call the authorization endpoint server-side to protect your credentials.

    Once you obtain the token, the configuration parameters object is passed to Beefree SDK to set up your customization options, for example setting the editor’s language to “Spanish”.

    Then, you can use Beefree SDK methods to start your instance and display the editor on your page.

    Beefree SDK will keep this session alive for 12 hours from the login. After 12 hours, you have to manage the token expiration, as follows:

    1. Obtain a new token via the new authorization endpoint.

    2. Inject the token obtained from step one via the updateToken method. Reference examples of this in the following section.

    The following code example shows how to inject the token in the current Beefree SDK instance:

    To automatically handle token expiration scenarios, implement the onError callback in your Beefree SDK configuration. This callback allows you to manage both recoverable and non-recoverable token expiration cases:

    Implementation Notes:

    • Error 5101: Call your backend authorization endpoint to obtain a fresh token, then inject it using the updateToken() method. This maintains the current session without interrupting the user's workflow.

    • Error 5102: You must create a new Beefree SDK instance using the template property from the error data. This ensures no content is lost while addressing critical updates or security fixes.

    • The getToken() function should be your server-side endpoint that calls /loginV2 and returns a new access token.

    For more details on error codes and error handling, see the Error Management section.

    When you set up an onError callback you will get the error object as a parameter.

    From that object, you can grab the code property and use it as explained in the table below.

    Code
    Message
    Detail

    5101

    Expired token cannot be refreshed

    You need to do a new login and update the token in the current Builder instance using updateToken method.

    5102

    Expired token must be refreshed

    You need to do a new login and create a new Builder instance using the new token, and the current JSON template present in this event.

    Example scenarios:

    • The version is outdated

    • Beefree SDK releases a security fix and every client must refresh

    Example error response for unsupported media type Only Content-Type: application/json is allowed.

    Example error response for an invalid UID. Look at the properties of UID parameter.

    Example error response for invalid credentials. Obtain your credentials using the authorization process.

    Example error response for disabled apps. Contact support if you encounter this error.

    This example demonstrates secure, production-ready authentication for the Beefree SDK. It showcases best practices for handling authentication tokens, automatic token refresh, and secure credential management.

    npm install @beefree.io/sdk
    yarn add @beefree.io/sdk

    Authorization Process Overview

    Beefree SDK NPM Package

    Package Installation

    Beefree SDK installation process
    Beefree SDK official npm package
    wrapper
    GitHub repository
    npm
    yarn
    var config = {
        container: 'string'
    }
    POST /loginV2 HTTP/1.1
    Host: auth.getbee.io
    Accept: application/json
    Content-Type: application/json
    {
    “client_id”: YOUR_CLIENT_ID,
    “client_secret”: YOUR_CLIENT_SECRET,
    “uid”: uid of choice
    }
    {
        "access_token": "...",
        "v2": true
    }
    // obtain a new token with a new LoginV2 call
    // update the token in the current Beefree SDK instance
    beeInstance.updateToken(token);
    onError: function (data) {
      const { code, detail, template } = data
      switch (code) {
        case 5101:
          // Token expired and cannot be auto-refreshed
          // Obtain a new token and update the current instance
          const newToken = getToken() // this calls your backend
          editorInstance.updateToken(newToken)
          break
        case 5102:
          // Complete refresh required
          // Re-mount component with the template provided in the data
          // This preserves the user's work while initializing a fresh instance
          break
      }
    }
    {
      "code": 5001,
      "message": "Unsupported media type 'application/x-www-form-urlencoded'",
      "status_code": 415
    }
    {
      "code": 5005,
      "message": "Invalid UID",
      "status_code": 400
    }
    
    {
      "code": 5002,
      "message": "Unable to authenticate with provided credentials.",
      "status_code": 401
    }
    {
      "code": 5003,
      "message": "Application is disabled.",
      "status_code": 403
    }
    

    Beefree SDK Client-side Configuration

    Beefree SDK Server-side Login

    Important: Do not put your Beefree SDK credentials in client-side code.

    Example

    Note: When a refreshable token expires, Beefree SDK receives a and attempts to refresh it automatically. 401 errors are expected and part of the process.

    Handling Token Expiration with onError Callback

    Best Practice: Implement the onError callback to handle token expiration gracefully. Error code 5101 allows you to extend the session, while error code 5102 requires re-initializing the editor with the current template to preserve user changes.

    Error Management

    Error Responses

    Sample code: Secure authentication example

    Ensure client_secret and client_id aren't exposed in the client-side code.

    string

    Your application secret key

    "xyz456-secret-key"

    UID

    string

    Unique user identifier

    "user-12345"

    save()

    Trigger save callback

    bee.save()

    saveAsTemplate()

    Save as template

    bee.saveAsTemplate()

    React
    Angular
    Vue.js
    401 error

    Configuration parameters

    Complete reference guide for all Beefree SDK configuration parameters.

    Overview

    Configuration parameters allow you to customize the Beefree SDK editor to match your application's requirements. This comprehensive guide covers all available parameters, from required settings to advanced customization options.

    How Configuration Works

    When initializing Beefree SDK, you pass a configuration object (beeConfig) that defines the editor's behavior, appearance, and functionality. The configuration is structured with high-level parameters that may contain nested sub-parameters for granular control.

    const bee = new BeefreeSDK(token);
    bee.start(beeConfig, template);

    Complete Configuration Structure

    Here's a comprehensive configuration object showing all available high-level parameters:

    var beeConfig = {
        // REQUIRED PARAMETERS
        container: 'beefree-sdk-container',
        
        // CORE EDITOR SETTINGS
        language: 'en-US',
        autosave: 30,
        trackChanges: true,
        preventClose: false,
        
        // CONTENT CUSTOMIZATION
        specialLinks: [],
        mergeTags: [],
        mergeContents: [],
        
        // APPEARANCE & UI
        sidebarPosition: 'left',
        editorFonts: {},
        defaultColors: [],
        disableColorHistory: false,
        disableBaseColors: false,
        
        // TITLE BLOCK CUSTOMIZATION
        titleDefaultStyles: {},
        titleDefaultConfig: {},
        titleMaxLevel: 'h3',
        
        // WORKSPACE & LAYOUT
        workspace: {
            type: 'default',
            editSingleRow: false
        },
        
        // ADVANCED FEATURES
        commenting: false,
        commentingThreadPreview: true,
        commentingNotifications: true,
        contentDialog: {},
        defaultForm: {},
        rowDisplayConditions: {},
        rowsConfiguration: {},
        advancedPermissions: {},
        hooks: {},
        metadata: {},
        
        // PERMISSIONS & SECURITY
        roleHash: '',
        disableLinkSanitize: false,
        
        // LOADING & PERFORMANCE
        loadingSpinnerDisableOnSave: false,
        loadingSpinnerDisableOnDialog: false,
        
        // CALLBACK FUNCTIONS
        onSave: function(jsonFile, htmlFile, ampHtml, templateVersion, language) {},
        onChange: function(jsonFile, response) {},
        onSaveAsTemplate: function(jsonFile) {},
        onAutoSave: function(jsonFile) {},
        onSend: function(htmlFile) {},
        onLoad: function(jsonFile) {},
        onError: function(errorMessage) {},
        onWarning: function(alertMessage) {},
        onLoadWorkspace: function(workspace) {},
        onFilePickerInsert: function(data) {},
        
        // DEBUGGING & DEVELOPMENT
        debug: {
            all: false,
            inspectJson: false,
            showTranslationKeys: false
        },
        
        // LOCALIZATION
        translations: {}
    };

    Required Parameters

    This parameter is mandatory for Beefree SDK initialization:

    Parameter
    Description
    Type
    • Type: string

    • Default: 'en-US'

    • Description: Sets the editor interface language

    Available Languages:

    Language
    Code
    Language
    Code
    • Type: number | false

    • Default: false

    • Description: Enables automatic saving at specified intervals (in seconds). Set to false

    • Type: boolean

    • Default: false

    • Description: Enables change tracking to monitor template modifications via the onChange callback.

    • Type: boolean

    • Default: false

    • Description: Shows an alert when users attempt to leave the page before saving changes.

    • Type: array

    • Default: []

    • Description: Array of custom link objects for special actions (e.g., unsubscribe links).

    • Type: array

    • Default: []

    • Description: Array of merge tag objects for dynamic content personalization.

    • Type: array

    • Default: []

    • Description: Array of reusable content blocks that can be inserted into templates.

    • Type: string

    • Default: 'left'

    • Options: 'left', 'right'

    • Type: object

    • Default: See Font Management documentation

    • Description: Customizes available fonts in the text toolbar and body settings.

    • Type: array

    • Default: []

    • Description: Array of hex color codes for the default color palette.

    • Type: boolean

    • Default: false

    • Description: Disables the color history feature in color pickers.

    • Type: boolean

    • Default: false

    • Description: Disables the base color palette in color pickers.

    • Type: object

    • Default: {}

    • Description: Default styling for title blocks at different heading levels.

    • Type: object

    • Default: {}

    • Description: Default configuration settings for title blocks.

    • Type: string

    • Default: 'h3'

    • Options: 'h1', 'h2'

    • Type: object

    • Default: {type: 'default'}

    • Description: Configures the editor workspace type and behavior.

    • Type: string

    • Default: 'default'

    • Options: 'default', 'mixed'

    • Type: boolean

    • Default: false

    • Description: Enables single-row editing mode.

    • Type: object

    • Description: Mobile design mode configuration.

    • Type: boolean

    • Default: false

    • Description: Enables collaborative commenting on content blocks and rows.

    • Type: boolean

    • Default: true

    • Description: Shows comment preview popover on the stage.

    • Type: boolean

    • Default: true

    • Description: Enables notifications for new comments in collaborative editing.

    • Type: object

    • Default: {}

    • Description: Configuration for custom content dialogs to exchange data with external systems.

    • Type: object

    • Default: {}

    • Description: Default form structure for form blocks.

    • Type: object

    • Default: {}

    • Description: Enables conditional display logic for email rows.

    • Type: object

    • Default: {}

    • Description: Configuration for row behavior and appearance.

    • Type: object

    • Default: {}

    • Description: Granular permission controls for different user roles.

    • Type: object

    • Default: {}

    • Description: Custom hooks for extending editor functionality.

    • Type: object

    • Default: {}

    • Description: Custom metadata configuration for templates.

    • Type: string

    • Default: ''

    • Description: Alphanumeric identifier for user roles (8-30 characters, no special characters).

    • Type: boolean

    • Default: false

    • Description: Disables URL validation to allow merge tags in links.

    • Type: object

    • Default: SDK default whitelist for both body and head

    • Description: Customizes the HTML Sanitizer's allowed tags, attributes, link protocols, comments, data-* attributes, and ARIA attributes. Configurable independently for the HTML content block (body) and for Custom Head HTML (head). See for the full reference and examples.

    • Type: boolean

    • Default: false

    • Description: Controls loading spinner visibility during save operations.

    • Type: boolean

    • Default: false

    • Description: Controls loading spinner visibility during dialog operations.

    • Type: function

    • Parameters: (jsonFile, htmlFile, ampHtml, templateVersion, language)

    • Description: Called when user saves the template.

    • Type: function

    • Parameters: (jsonFile, response)

    • Description: Called when template content changes (requires trackChanges: true

    • Type: function

    • Parameters: (jsonFile)

    • Description: Called when user saves template as a new template.

    • Type: function

    • Parameters: (jsonFile)

    • Description: Called during automatic save operations.

    • Type: function

    • Parameters: (htmlFile)

    • Description: Called when user triggers send action.

    • Type: function

    • Parameters: (jsonFile)

    • Description: Called when template is loaded into the editor.

    • Type: function

    • Parameters: (errorMessage)

    • Description: Called when errors occur in the editor.

    • Type: function

    • Parameters: (alertMessage)

    • Description: Called when warnings are triggered.

    • Type: function

    • Parameters: (workspace)

    • Description: Called when workspace is successfully loaded.

    • Type: function

    • Parameters: (data)

    • Description: Called when files are inserted via file picker integration.

    • Type: object

    • Default: {all: false, inspectJson: false, showTranslationKeys: false}

    • Description: Debug mode configuration for development.

    • Type: object

    • Default: {}

    • Description: Custom translations to override default interface text.

    • Always validate uid and roleHash on your server

    • Use advancedPermissions to restrict user capabilities based on roles

    • Implement proper authentication before initializing the SDK

    • Set appropriate language based on user preferences

    • Use preventClose: true for important editing sessions

    • Provide meaningful error handling in onError callback

    • Enable debug.all: true during development

    • Use trackChanges: true to monitor template modifications

    • Implement all relevant callbacks for complete functionality

    This comprehensive configuration guide serves as your single source of truth for all Beefree SDK parameters. Most parameters are documented with their type, default value, description, and practical examples to help you customize the editor to meet your specific requirements.

    Danish

    da-DK

    French

    fr-FR

    Swedish

    sv-SE

    Italian

    it-IT

    Polish

    pl-PL

    Portuguese

    pt-BR

    Hungarian

    hu-HU

    Indonesian

    id-ID

    Russian

    ru-RU

    Japanese

    ja-JP

    Korean

    ko-KR

    Chinese

    zh-CN

    Dutch

    nl-NL

    Traditional Chinese

    zh-HK

    Finnish

    fi-FI

    Czech

    cs-CZ

    Romanian

    ro-RO

    Norwegian (BokmĂĄl)

    nb-NO

    Slovenian

    sl-SI

    to disable.
  • Description: Controls the position of the content sidebar.

  • ,
    'h3'
    ,
    'h4'
    ,
    'h5'
    ,
    'h6'
  • Description: Maximum heading level available in title blocks.

  • ,
    'amp_only'
    ,
    'html_only'
  • Description: Determines workspace type for AMP content visibility.

  • ).

    Use commenting features for team collaboration workflows

    Test with different workspace.type values for AMP compatibility

    container

    The ID of the HTML div element that will contain the Beefree SDK editor

    string

    English

    en-US

    German

    de-DE

    Spanish

    Core Editor Settings

    language

    autosave

    trackChanges

    preventClose

    Content Customization

    specialLinks

    mergeTags

    mergeContents

    Appearance & UI Customization

    sidebarPosition

    editorFonts

    defaultColors

    disableColorHistory

    disableBaseColors

    Title Block Customization

    titleDefaultStyles

    titleDefaultConfig

    titleMaxLevel

    Workspace Configuration

    workspace

    workspace.type

    workspace.editSingleRow

    workspace.stage (Mobile Design Mode)

    Advanced Features

    commenting

    commentingThreadPreview

    commentingNotifications

    contentDialog

    defaultForm

    rowDisplayConditions

    rowsConfiguration

    advancedPermissions

    hooks

    metadata

    Security & Permissions

    roleHash

    disableLinkSanitize

    sanitizeRules

    Performance & Loading

    loadingSpinnerDisableOnSave

    loadingSpinnerDisableOnDialog

    Callback Functions

    onSave

    onChange

    onSaveAsTemplate

    onAutoSave

    onSend

    onLoad

    onError

    onWarning

    onLoadWorkspace

    onFilePickerInsert

    Development & Debugging

    debug

    Localization

    translations

    Quick Reference Examples

    Basic Configuration

    Advanced Configuration

    Configuration with Advanced Permissions

    Configuration for Collaborative Editing

    Best Practices

    Security Considerations

    User Experience

    Development Tips

    Custom Sanitize Rules

    es-ES

    specialLinks: [
        {
            name: 'Unsubscribe',
            value: '{{unsubscribe_url}}',
            target: '_blank'
        }
    ]
    mergeTags: [
        {
            name: 'First Name',
            value: '{{first_name}}'
        },
        {
            name: 'Company',
            value: '{{company_name}}'
        }
    ]
    mergeContents: [
        {
            name: 'Footer Content',
            value: '<div>Company footer HTML</div>'
        }
    ]
    editorFonts: {
        fontList: [
            {
                name: 'Arial',
                fontFamily: 'Arial, sans-serif'
            },
            {
                name: 'Custom Font',
                fontFamily: 'CustomFont, Arial, sans-serif',
                url: 'https://fonts.googleapis.com/css?family=CustomFont'
            }
        ]
    }
    defaultColors: ['#ffffff', '#000000', '#95d24f', '#ff00dd']
    titleDefaultStyles: {
        h1: {
            fontSize: '32px',
            fontWeight: 'bold',
            color: '#000000'
        },
        h2: {
            fontSize: '28px',
            fontWeight: 'bold',
            color: '#333333'
        }
    }
    workspace: {
        type: 'default',
        stage: {
            width: '375px',
            height: '667px'
        }
    }
    contentDialog: {
        contentDialogUrl: 'https://your-app.com/content-dialog',
        triggers: ['image', 'link']
    }
    defaultForm: {
        structure: {
            // Form field definitions
        }
    }
    advancedPermissions: {
        components: {
            'bee-button': {
                enabled: true,
                style: false
            }
        },
        rows: {
            enabled: true,
            canAdd: true,
            canDelete: false
        }
    }
    onSave: function(jsonFile, htmlFile, ampHtml, templateVersion, language) {
        console.log('Template saved:', {
            json: jsonFile,
            html: htmlFile,
            amp: ampHtml,
            version: templateVersion,
            lang: language
        });
    }
    debug: {
        all: true,                    // Enables all debug features
        inspectJson: true,           // Shows JSON inspector icon
        showTranslationKeys: true    // Shows translation keys instead of text
    }
    translations: {
        'bee-common-widget-bar': {
            content: 'MODULES'
        }
    }
    var beeConfig = {
        container: 'beefree-sdk-container',
        language: 'en-US',
        onSave: function(jsonFile, htmlFile) {
            console.log('Template saved!');
        },
        onError: function(errorMessage) {
            console.error('Error:', errorMessage);
        }
    };
    var beeConfig = {
        container: 'beefree-sdk-container',
        language: 'en-US',
        autosave: 60,
        trackChanges: true,
        
        // Custom content
        mergeTags: [
            { name: 'First Name', value: '{{first_name}}' },
            { name: 'Company', value: '{{company}}' }
        ],
        
        // UI customization
        sidebarPosition: 'right',
        defaultColors: ['#ffffff', '#000000', '#ff6b6b', '#4ecdc4'],
        
        // Advanced features
        commenting: true,
        workspace: {
            type: 'mixed',
            editSingleRow: false
        },
        
        // Callbacks
        onSave: function(jsonFile, htmlFile, ampHtml, version, lang) {
            // Handle save
        },
        onChange: function(jsonFile, response) {
            // Handle changes
        },
        onError: function(errorMessage) {
            // Handle errors
        }
    };
    var beeConfig = {
        container: 'beefree-sdk-container',
        language: 'en-US',
        
        advancedPermissions: {
            components: {
                'bee-button': {
                    enabled: true,
                    style: true,
                    link: false
                },
                'bee-image': {
                    enabled: true,
                    style: true,
                    alt: false
                }
            },
            rows: {
                enabled: true,
                canAdd: true,
                canDelete: false,
                canMove: true
            },
            settings: {
                bodySettings: true,
                preheader: false,
                subject: true
            }
        },
        
        onSave: function(jsonFile, htmlFile) {
            // Handle save with permissions applied
        }
    };
    var beeConfig = {
        container: 'beefree-sdk-container',
        language: 'en-US',
        
        // Enable collaborative features
        commenting: true,
        commentingThreadPreview: true,
        commentingNotifications: true,
        trackChanges: true,
        
        // User identification for collaboration
        roleHash: 'editor123abc',
        
        // Callbacks for collaboration
        onChange: function(jsonFile, response) {
            // Sync changes with other users
        },
        onSave: function(jsonFile, htmlFile) {
            // Save collaborative changes
        }
    };
    Beefree SDK npm package

    Methods and Events

    Complete reference guide for all Beefree SDK methods, callbacks, and events.

    Overview

    Beefree SDK provides a comprehensive set of methods, callback functions, and events that allow you to control the editor programmatically and respond to user interactions. This guide serves as your single source of truth for all available SDK interactions.

    TypeScript Definitions: For complete type safety and detailed parameter information, reference the official TypeScript definitions: Beefree SDK Types

    How Methods and Events Work

    Beefree SDK is built on an event-driven architecture, a software design pattern where components communicate through events rather than direct method calls. In this architecture, methods are functions you call to trigger actions in the SDK (like saving or loading templates), while events are notifications the SDK sends back to your application when something happens (like content changes or errors). This decoupled approach allows your application to respond to SDK activities asynchronously, making integrations more flexible and scalable. Learn more about event-driven architecture on MDN Web Docs.

    When you initialize Beefree SDK, you get an instance that exposes various methods for programmatic control. Additionally, you can configure callback functions in your beeConfig to respond to user actions and editor events.

    These methods are available on the Beefree SDK instance and allow you to control the editor programmatically.

    • Description: Initializes and starts the builder with optional template data

    • Parameters:

      • templateToLoad (optional): JSON string with template structure

    • Description: Loads a JSON template into the editor

    • Parameters:

      • template: JSON string with template structure

    • Description: Reloads a template without showing a loading dialog (seamless reload)

    • Parameters:

      • template: JSON string with template structure

    • Description: Programmatically triggers the save action

    • Triggers: onSave callback with JSON and HTML files

    • Usage:

    • Description: Programmatically triggers save as template action

    • Triggers: onSaveAsTemplate callback with JSON file

    • Usage:

    • Description: Programmatically triggers the save row action in editSingleRow mode. Use this when the default Toolbar is disabled, and you need to trigger the row-saving flow from a custom UI.

    • Triggers: onSaveRow callback with the row JSON

    • Note: This method is only available when the editor is initialized in

    • Description: Programmatically triggers send action (Email Builder only)

    • Triggers: onSend callback with HTML file

    • Usage:

    • Description: Toggles preview mode on/off

    • Triggers: onTogglePreview callback

    • Usage:

    • Description: Toggles visibility of structure outlines in the editor

    • Usage:

    • Description: Toggles visibility of merge tag sample content

    • Usage:

    • Description: Executes specific editor commands for highlighting, scrolling, focusing, or selecting elements

    • Parameters:

      • command: Object defining the action and target

    • Description: Loads a specific workspace type

    • Parameters:

      • type: Workspace type ('default', 'mixed', 'amp_only', 'html_only')

    • Description: Updates editor configuration dynamically

    • Parameters:

      • config: Configuration object with updated settings

    Consecutive requests, made in a short time, to the beeInstance.loadConfig get debounced so the editor can process each change without loss or side effects.

    Debouncing starts with the second request, allowing instant/reactive behavior when requests arrive separated in time.

    • Usage

    Example without options

    Example with rejectDebounced true

    With rejectDebounced set to true, the second request gets rejected, and the rejection must be handled! This is useful when you want to react only when the config actually changed in the editor.

    The first doesn't get rejected because we start debouncing from the second consecutive request.

    Example with rejectDebounced false

    With rejectDebounced set to false, the second request gets resolved, and there's no need to handle it! Instead of rejecting it, an onWarning event will be fired. This is useful when you don't need to react when the config changes in the editor.

    Keep in mind that the second request will return the same configuration as the first one, since the config update is still in progress.

    File Manager applications have a simplified method set focused on file selection and management workflows.

    Callback functions are configured in your beeConfig and are triggered by user actions or editor events.

    • Trigger: User clicks save button or beeInstance.save() is called

    • Parameters: (jsonFile, htmlFile, ampHtml, templateVersion, language)

      • jsonFile

    • Trigger: User clicks "Save as Template" or beeInstance.saveAsTemplate() is called

    • Parameters: (jsonFile)

      • jsonFile

    • Trigger: Automatic save based on autosave configuration

    • Parameters: (jsonFile)

      • jsonFile

    • Trigger: User clicks the Save button in the default Toolbar while in editSingleRow mode, or beeInstance.saveRow() is called

    • Parameters: (rowJson)

    • Trigger: User clicks send button or beeInstance.send() is called (Email Builder only)

    • Parameters: (htmlFile)

      • htmlFile

    • Trigger: Template content is modified (requires trackChanges: true)

    • Parameters: (jsonFile, response)

      • jsonFile

    • Trigger: Changes made by other users in collaborative editing sessions

    • Parameters: (jsonFile, response)

      • jsonFile: Updated template JSON from remote user

    • Trigger: Template is loaded into the editor

    • Parameters: (jsonFile)

      • jsonFile: Loaded template JSON

    • Trigger: Workspace is successfully loaded

    • Parameters: (workspace)

      • workspace: Workspace configuration object

    • Trigger: Errors occur in the editor

    • Parameters: (errorMessage)

      • errorMessage: Error description string

    • Trigger: Warnings are generated by the editor

    • Parameters: (alertMessage)

      • alertMessage: Warning description string

    • Trigger: Preview button is clicked

    • Parameters: (status)

      • status: Boolean indicating preview state

    • Trigger: Preview is toggled on/off

    • Parameters: (status)

      • status: Boolean indicating preview state

    • Trigger: User navigates between different SDK views

    • Parameters: (view)

      • view: String indicating current view

    • Trigger: Insert button clicked in File Manager applications

    • Parameters: (data)

      • data: Object containing file information

    • Trigger: Cancel/X button clicked in File Manager applications

    • Parameters: None

    • Usage:

    • Trigger: Comments or comment threads change

    • Parameters: (commentData)

      • commentData: Comment information object

    Many SDK methods return promises, allowing for proper async handling:

    • Always implement onError callback for production applications

    • Provide user-friendly error messages

    • Log errors for debugging and monitoring

    • Use onChange judiciously with trackChanges: true

    • Implement debouncing for frequent operations

    • Consider using onAutoSave for background saves

    • Provide feedback for all user actions

    • Use onViewChange to guide users through different modes

    • Implement proper loading states

    • Use onRemoteChange to show real-time collaboration

    • Implement conflict resolution for simultaneous edits

    • Provide clear indicators of other users' activities

    • Reference TypeScript definitions for complete type safety

    • Test all callback implementations thoroughly

    • Use method chaining for complex workflows

    For complete type definitions and IntelliSense support, reference the official types:

    TypeScript Definitions:

    This comprehensive guide covers all available methods, callbacks, and events in Beefree SDK. Use it as your reference for implementing complete editor control and event handling in your applications.


    TypeScript Definitions:

    userInfo (optional): User information object for collaborative features

  • templateInfo (optional): Template metadata

  • options (optional): Additional configuration options

  • Returns: Promise that resolves when editor is ready

  • Usage:

  • Returns: Promise that resolves when template is loaded

  • Usage:

  • Use Cases: Custom undo/redo, real-time content injection

  • Usage:

  • editSingleRow
    mode. Calling it in any other mode will throw an error:
    "This method is only available when in single row edit mode"
    .
  • Usage:

  • Actions: highlight, scroll, focus, select

  • Usage:

  • Triggers: onLoadWorkspace callback

  • Usage:

  • options: An optional object to choose the behaviour

    • rejectDebounced: boolean (default false)

      • If true promises of debounced requests to loadConfig will be rejected and will need to be handled

      • If false promises of debounced requests to loadConfig will be resolved with the current config value

  • Debounce

  • : Template structure as JSON string
  • htmlFile: Rendered HTML output

  • ampHtml: AMP HTML version (if applicable)

  • templateVersion: Template version number

  • language: Template language code

  • Usage:

  • : Template structure as JSON string
  • Usage:

  • : Template structure as JSON string
  • Usage:

  • rowJson: The saved row structure as a JSON string
  • Usage:

  • : Rendered HTML ready for sending
  • Usage:

  • : Updated template JSON
  • response: Change details object with patches and metadata

  • Usage:

  • response: Change details from remote user

  • Usage:

  • Usage:

    Usage:

    Usage:

    Usage:

    Usage:

    Usage:

    Possible Values:

    • 'editor': Main editor view

    • 'preview': Preview mode

    • 'fileManager': File Manager opened

    • 'imageEditor': Image Editor opened

  • Usage:

  • Usage:

    Usage:

    Instance Methods

    Core Methods

    beeInstance.start(templateToLoad, userInfo, templateInfo, options)

    beeInstance.load(template)

    beeInstance.reload(template)

    Control Methods

    beeInstance.save()

    beeInstance.saveAsTemplate()

    beeInstance.saveRow()

    beeInstance.send()

    Preview and View Methods

    beeInstance.togglePreview()

    beeInstance.toggleStructure()

    beeInstance.toggleMergeTagsPreview()

    Advanced Methods

    beeInstance.execCommand(command)

    beeInstance.loadWorkspace(type)

    beeInstance.loadConfig(config)

    File Manager Methods

    Note: For File Manager applications, only beeInstance.start() without parameters is supported.

    Callback Functions

    Save and Template Callbacks

    onSave

    onSaveAsTemplate

    onAutoSave

    onSaveRow

    onSend

    Content Change Callbacks

    onChange

    onRemoteChange

    Loading and Workspace Callbacks

    onLoad

    onLoadWorkspace

    Error and Warning Callbacks

    onError

    onWarning

    Preview and View Callbacks

    onPreview

    onTogglePreview

    onViewChange

    File Management Callbacks

    onFilePickerInsert

    onFilePickerCancel

    Collaboration Callbacks

    onComment

    Event Configuration Examples

    Basic Event Handling

    Advanced Event Handling

    File Manager Configuration

    Method Chaining and Async Operations

    Best Practices

    Error Handling

    Performance

    User Experience

    Collaboration

    Development

    TypeScript Support

    Beefree SDK Types
    Beefree SDK Types
    const bee = new BeefreeSDK(token);
    const beeInstance = bee.start(beeConfig, template);
    
    // Use methods to control the editor
    beeInstance.save();
    beeInstance.preview();
    
    // Configure callbacks to respond to events
    const beeConfig = {
        container: 'editor-container',
        onSave: function(jsonFile, htmlFile) {
            // Handle save event
        },
        onChange: function(jsonFile, response) {
            // Handle content changes
        }
    };
    // Basic start
    await beeInstance.start();
    
    // Start with template
    await beeInstance.start(templateJson);
    
    // Start with full configuration (NPM package)
    await beeInstance.start(templateJson, userInfo, templateInfo, options);
    await beeInstance.load(templateJson);
    await beeInstance.reload(templateJson);
    beeInstance.save();
    beeInstance.saveAsTemplate();
    beeInstance.saveRow();
    beeInstance.send();
    beeInstance.togglePreview();
    beeInstance.toggleStructure();
    beeInstance.toggleMergeTagsPreview();
    beeInstance.execCommand({
        action: 'highlight',
        target: { type: 'row', id: 'row-id' }
    });
    
    beeInstance.execCommand({
        action: 'scroll',
        target: { type: 'block', id: 'block-id' }
    });
    beeInstance.loadWorkspace('mixed');
    beeInstance.loadConfig({
        debug: { all: true },
        language: 'es-ES'
    });
    const first = await beeInstance.loadConfig({ debug: { all: false } }, { rejectDebounced: true })
    const second = await beeInstance.loadConfig({ debug: { all: true } }, { rejectDebounced: true })
    const third = await beeInstance.loadConfig({ debug: { all: false } }, { rejectDebounced: true })
    const first = await beeInstance.loadConfig({ debug: { all: false } })
    onSave: function(jsonFile, htmlFile, ampHtml, templateVersion, language) {
        console.log('Template saved:', {
            json: jsonFile,
            html: htmlFile,
            amp: ampHtml,
            version: templateVersion,
            lang: language
        });
        
        // Save to your backend
        saveTemplate({
            json: jsonFile,
            html: htmlFile,
            version: templateVersion
        });
    }
    onSaveAsTemplate: function(jsonFile) {
        console.log('Saving as template:', jsonFile);
        
        // Save template to library
        saveToTemplateLibrary(jsonFile);
    }
    onAutoSave: function(jsonFile) {
        console.log('Auto-saving template');
        
        // Perform background save
        autoSaveTemplate(jsonFile);
    }
    onSaveRow: function(rowJson) {
        console.log('Row saved:', rowJson);
    
        // Save row to your backend
        saveRowToLibrary(rowJson);
    }
    onSend: function(htmlFile) {
        console.log('Sending email');
        
        // Send email via your service
        sendEmail({
            html: htmlFile,
            subject: getSubject(),
            recipients: getRecipients()
        });
    }
    onChange: function(jsonFile, response) {
        console.log('Content changed:', response);
        
        // Track changes for analytics
        trackUserAction({
            action: response.description,
            value: response.value,
            timestamp: Date.now()
        });
        
        // Sync with other users in collaborative editing
        broadcastChange(response);
    }
    onRemoteChange: function(jsonFile, response) {
        console.log('Remote user made changes:', response);
        
        // Update UI to show remote changes
        highlightRemoteChanges(response);
        
        // Notify current user of remote activity
        showCollaborationNotification(response.user);
    }
    onLoad: function(jsonFile) {
        console.log('Template loaded successfully');
        
        // Initialize custom features
        initializeCustomModules();
        
        // Track template usage
        trackTemplateLoad(jsonFile);
    }
    onLoadWorkspace: function(workspace) {
        console.log('Workspace loaded:', workspace.type);
        
        // Update UI based on workspace
        updateWorkspaceUI(workspace);
    }
    onError: function(errorMessage) {
        console.error('Beefree SDK Error:', errorMessage);
        
        // Show user-friendly error message
        showErrorNotification('Something went wrong. Please try again.');
        
        // Log error for debugging
        logError({
            source: 'beefree-sdk',
            message: errorMessage,
            timestamp: Date.now()
        });
    }
    onWarning: function(alertMessage) {
        console.warn('Beefree SDK Warning:', alertMessage);
        
        // Show warning to user if needed
        if (shouldShowWarning(alertMessage)) {
            showWarningNotification(alertMessage);
        }
    }
    onPreview: function(status) {
        console.log('Preview mode:', status ? 'opened' : 'closed');
        
        // Update UI state
        updatePreviewButton(status);
    }
    onTogglePreview: function(status) {
        console.log('Preview toggled:', status);
        
        // Adjust layout for preview mode
        adjustLayoutForPreview(status);
    }
    onViewChange: function(view) {
        console.log('View changed to:', view);
        
        // Track user navigation
        trackViewChange(view);
        
        // Update application state
        switch(view) {
            case 'fileManager':
                showFileManagerHelp();
                break;
            case 'preview':
                hideEditingTools();
                break;
            case 'editor':
                showEditingTools();
                break;
        }
    }
    onFilePickerInsert: function(data) {
        console.log('File selected:', data);
        
        // Process selected file
        processSelectedFile(data);
        
        // Close file picker
        closeFilePicker();
    }
    onFilePickerCancel: function() {
        console.log('File picker cancelled');
        
        // Handle cancellation
        handleFilePickerCancel();
    }
    onComment: function(commentData) {
        console.log('Comment activity:', commentData);
        
        // Update comment UI
        updateCommentInterface(commentData);
        
        // Notify relevant users
        notifyCommentActivity(commentData);
    }
    var beeConfig = {
        container: 'beefree-sdk-container',
        
        // Essential callbacks
        onSave: function(jsonFile, htmlFile) {
            saveToDatabase(jsonFile, htmlFile);
        },
        
        onError: function(errorMessage) {
            handleError(errorMessage);
        },
        
        onLoad: function(jsonFile) {
            console.log('Editor ready');
        }
    };
    var beeConfig = {
        container: 'beefree-sdk-container',
        trackChanges: true,
        commenting: true,
        
        // Content tracking
        onChange: function(jsonFile, response) {
            trackChanges(response);
            autoSave(jsonFile);
        },
        
        onRemoteChange: function(jsonFile, response) {
            syncRemoteChanges(response);
            showCollaboratorActivity(response);
        },
        
        // Collaboration
        onComment: function(commentData) {
            updateCommentThread(commentData);
            notifyTeamMembers(commentData);
        },
        
        // View tracking
        onViewChange: function(view) {
            analytics.track('view_change', { view });
            updateUIForView(view);
        },
        
        // Complete save handling
        onSave: function(jsonFile, htmlFile, ampHtml, version, language) {
            Promise.all([
                saveTemplate(jsonFile),
                saveHTML(htmlFile),
                saveAMP(ampHtml),
                updateVersion(version)
            ]).then(() => {
                showSuccessMessage();
            }).catch(handleSaveError);
        }
    };
    var beeConfig = {
        container: 'file-manager-container',
        
        // File picker callbacks
        onFilePickerInsert: function(data) {
            insertFileIntoContent(data);
            closeFileManager();
        },
        
        onFilePickerCancel: function() {
            closeFileManager();
        },
        
        onViewChange: function(view) {
            if (view === 'fileManager') {
                showFileManagerInstructions();
            }
        }
    };
    // Sequential operations
    async function loadAndPreview(templateJson) {
        try {
            await beeInstance.load(templateJson);
            await beeInstance.preview();
            console.log('Template loaded and previewed');
        } catch (error) {
            console.error('Operation failed:', error);
        }
    }
    
    // Conditional operations
    async function saveAndSend(shouldSend = false) {
        await beeInstance.save();
        
        if (shouldSend) {
            await beeInstance.send();
        }
    }
    import { BeefreeSDK, BeeConfig, SaveCallback } from '@beefree.io/sdk';
    
    const beeConfig: BeeConfig = {
        container: 'editor-container',
        onSave: ((jsonFile: string, htmlFile: string, ampHtml: string | null, version: number, language: string | null) => {
            // Fully typed callback
        }) as SaveCallback
    };
    beefree-sdk-examples/secure-auth-example at main · BeefreeSDK/beefree-sdk-examplesGitHub
    Logo
    Beefree SDK Console Dashboard with an Example QA Environment Development Application