LogoLogo
Try it outResourcesAPIsAddOnsBook a demo
  • Getting Started
    • Introduction to Beefree SDK
      • Create an Application
      • Installation and Fundamentals
        • Configuration parameters
          • Configuration Reload
          • Workspaces
          • Debugging the Beefree SDK Editor
        • Methods and Events
        • Authorization Process
        • How the UID parameter works
        • Set up two-factor authentication
        • Naming conventions
      • Development Applications
      • Manage Users
      • Manage Subscriptions
      • Installation and Fundamentals
    • Tracking Message Changes
    • Sample Code
    • Release Candidate Environment
  • Visual Builders
    • Email Builder
    • Page Builder
      • Integrating Page Builder
      • Embedding videos in a page
    • Popup Builder
      • Popup Builder - Getting Started
      • Testing and Integrating
      • Setting layout and size
        • Advanced settings
    • AI-Driven Design Creation
  • APIs
    • Content Services API
      • Authentication
      • Export
      • Convert
      • Row Processing
      • AI Collection
      • Brand Style
    • Template Catalog API
      • Authentication
      • Templates
      • Categories
      • Collections
      • Designers
      • Tags
    • HTML Importer API
      • Authentication
      • Import HTML
  • Forms
    • Form Block
    • Integrating and using the Form block
      • Passing forms to the builder
      • Form structure and parameters
      • Form layout customization
      • Allowed form fields
      • Edit form field modal
  • Rows
    • Reusable Content
      • Create Reusable Content
        • Pre-build Reusable Content
          • Implement Custom Rows
        • Save Reusable Content
          • Implement Hosted Saved Rows
          • Implement Self-hosted Saved Rows
            • Self-hosted Saved Rows Concepts and Tutorial
      • Sync Reusable Content
        • Implement Synced Rows
        • Initialize Edit Single Row Mode
      • Manage Reusable Content
    • Storage for Reusable Content
      • Hosted Saved Rows
      • Self-Hosted Saved Rows
  • File manager
    • File manager application overview
      • Mime Types and Groups
  • Server-side configurations
    • Server-side options
      • Toolbar options
      • Storage options
        • Configure your AWS S3 bucket
        • Connect your file storage system
      • Content options
      • Services options
      • Undo & Changes history
      • Custom JavaScript Libraries Injection
  • Other Customizations
    • Advanced options
      • Special Links and Merge Tags
      • Content Dialog
      • Custom Color Palette
      • Font management
      • Roles and Permissions
      • Smart Merge Tags
      • Commenting
      • Custom Attributes
      • Meta Tags
      • Custom Languages
      • Display Conditions
      • Advanced Permissions
      • Custom File Picker
      • Custom Headers
    • Appearance
      • Content Defaults
      • Custom Sidebar Position
      • Content Tile Sorting
      • Content Tile Grouping
      • Loading Spinner Theme
      • Custom Tab Layout
      • Themes
      • Custom CSS
        • Change Log
    • AMP for Email
    • Collaborative Editing
      • Co-editing Integration Guide
    • Mobile Design Mode
    • Multi-language Templates
    • Cards Style and Image Round Corners
    • Hover Effect for Buttons
    • Content Area Padding
    • Line Height
  • Data Structures
    • Getting Started
    • Schema Catalog
    • Simple Schema
      • Template Schema
      • Definitions Schema
      • Row Schema
      • Column Schema
      • Title Schema
      • Image Schema
      • Button Schema
      • Paragraph Schema
      • HTML Schema
      • Menu Schema
      • List Schema
      • Icon Schema
      • Divider Schema
    • Row Metadata
    • Form Validation Schema
    • Comments Schema
      • Change Schema for Comments
  • Builder AddOns
    • AddOns
      • AddOns Overview
      • Partner AddOns
        • Partner AddOns directory
        • Installing Partner AddOns
        • DeepL
        • Stability AI
        • Azure AI Vision - Image Analysis
          • Alternate Text Generation with AI
          • AI Alt Text Bulk Generation
        • AI Writing Assistant
          • Available Providers
            • OpenAI
            • Azure OpenAI
            • Anthropic
          • AI Providers and Data Security
          • AI-Generated Meta Tag Fields
          • Token Upselling
          • Apply a Brand Tone
        • Custom AI Writing Assistant
      • Custom AddOns
        • AddOn Development
        • Contribute to the Partner AddOn Marketplace
      • AddOns Configuration
      • AddOn FAQs
  • Resources
    • Error Management
      • onWarning
      • Beefree SDK Editor Errors
      • File System Provider errors
      • JSON Parser errors
      • Template Validation and Update
      • Template validation and update errors
    • Scheduled maintenances
Powered by GitBook
LogoLogo

Policies

  • Privacy & Cookies
  • Terms of Services
  • GDPR Compliance
  • Trust Center

Contact Us

  • Submit a request
  • Book a demo
  • Report a security issue

Resources

  • Developer website
  • Create a Developer Account

© Bee Content Design, Inc. San Francisco, CA | Part of Growens

On this page
  • Introduction
  • Getting Started
  • Authentication Process
  • Beefree SDK Initialization
  • Working with Templates
  • Advanced Features
  • Troubleshooting
  • Frequently Asked Questions
  • Conclusion

Was this helpful?

Export as PDF
  1. Getting Started
  2. Introduction to Beefree SDK

Installation and Fundamentals

PreviousManage SubscriptionsNextTracking Message Changes

Last updated 25 days ago

Was this helpful?

Introduction

Beefree SDK is an embeddable no-code content builder that enables your end users to build stunning marketing assets, such as emails, landing pages, and popups, without writing a single line of code.

The following list includes a few key features within Beefree SDK:

  • Drag-and-drop visual editors

  • File manager

  • Multi-user collaboration

  • Responsive design capabilities

  • Extensive template library

  • Secure authentication workflow

This guide provides comprehensive instructions and best practices for implementing Beefree SDK.

Getting Started

This section discusses how to get started with Beefree SDK.

Prerequisites

Prior to integrating Beefree SDK, ensure you have:

  1. A Beefree SDK .

  2. Node.js (v14 or higher) installed.

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

Local Development Setup

To test the SDK locally before production deployment:

  1. Clone the demo repository:

    git clone https://github.com/BeefreeSDK/beefree-sdk-npm-official.git
  2. Install dependencies:

    npm install
    # or
    yarn install
  3. Configure environment:

    cp .env.sample .env
  4. Start the dev server:

    npm start
  5. Access at http://localhost:8081

Package Installation

Using npm

npm install @beefree.io/sdk --save

Using Yarn

yarn add @beefree.io/sdk

Package Details:

  • TypeScript Support: Included

  • License: Apache-2.0

Authentication Process

This section discusses the authentication process.

Server-Side Authentication

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

Authentication Endpoint

POST https://auth.getbee.io/loginV2

Required Parameters

The following table lists and descibes the required authentication parameters.

Parameter
Type
Description
Example

client_id

string

Your application client ID

"abc123-client-id"

client_secret

string

Your application secret key

"xyz456-secret-key"

UID

string

Unique user identifier

"user-12345"

Example Implementation (Node.js)

var req = new XMLHttpRequest();
req.onreadystatechange = function() {
  if (req.readyState === 4 && req.status === 200) {
    // Obtain token
    var token = req.responseText;
    // Call create method and pass token and beeConfig to obtain an instance of BEE Plugin
    BeePlugin.create(token, beeConfig, function(beePluginInstance) {
	// Call start method of bee plugin instance
	beePluginInstance.start(template); // template is the json to be loaded in BEE
    });
  }
};

// This is a sample call to YOUR server side application that calls the loginV2 endpoint on BEE the side
req.open(
	'POST', 	// Method
	'/YOUR_BACKEND_TOKEN_ENDPOINT', // your server endpoint
	false 		// sync request
);

Important Notes:

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

  • Tokens are valid for 12 hours.

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

JSON Authorization Response

{
    "access_token": "...",
    "v2": true
}

Beefree SDK Initialization

This section discusses how to initialize Beefree SDK.

Container Setup

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

<div id="bee-plugin-container" style="width: 100%; height: 800px;"></div>

Configuration Options

Beefree SDK requires a configuration object with the following essential property:

var config = {
    container: 'string'
}

Full Configuration Reference

The following table explains the container property.

Property
Type
Required
Description

container

string

Yes

DOM element ID for the editor

Working with Templates

Loading a Template

Initialize the editor with a template JSON object:

// After successful initialization
const template = {
  // Your template JSON here
  // Sample templates available at:
  // https://github.com/BeefreeSDK/beefree-sdk-assets-templates
};

bee.start(template);

Template Management Methods

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)

save()

Trigger save callback

bee.save()

saveAsTemplate()

Save as template

bee.saveAsTemplate()

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.

Advanced Features

Token Refresh Implementation

Implement automatic token refresh to maintain uninterrupted sessions:

// Refresh expired token (call before 12-hour expiry)
bee.updateToken(newToken); 

How to use:

  1. Get a fresh token from your backend

  2. Pass it to updateToken()

Collaborative Editing

Enable real-time collaboration with these additional methods:

// Join a co-editing session
bee.join({ uid: "user-123" }, "shared-session-id"); 

How to use:

  1. Generate a unique session-id on your server

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

Troubleshooting

The following list includes the most common issues and steps for troubleshooting them.

  • Authentication Failures

    • Verify client_id and client_secret

    • Ensure UID matches between auth and config

    • Check network connectivity to auth.getbee.io

  • Editor Not Loading

    • Confirm container element exists

    • Verify container ID matches config

    • Check for JavaScript errors in console

  • Token Expiration Issues

    • Implement onTokenExpired callback

    • Test token refresh flow

Frequently Asked Questions

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. Refer to the advanced 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)

Conclusion

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 SDK updates and new features

You can install Beefree SDK using either or :

Repository:

Reference the in GitHub for example templates.

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

developer account
npm
yarn
Beefree SDK GitHub
beefree-sdk-assets-templates repository
template repository