Skip to main content
Use the embed when your users need to make banners, posts, labels or documents inside your product. Your page shows the Bannerify editor in an iframe. Each of your users gets their own designs, and can start from the templates of your workspace.

How it works

  1. Your server signs a short token for the user with the signing secret of the embed.
  2. Your page opens https://embed.bannerify.co/<embed id>?token=<token> in an iframe.
  3. Bannerify checks the token and the domain of the page, then opens the editor for that user.
  4. The designs of the user are templates of your workspace. You render them with the API, like any other template.

Prerequisites

  • A workspace on the Scale or Enterprise plan.
  • A server that can sign a JWT. The signing secret must stay on your server.

Set up the embed

  1. Open Embed in the dashboard sidebar.
  2. Click Set up the embed, then turn on Turn on the embed.
  3. Under Allowed domains, add the origin of each page that shows the editor, such as https://app.example.com. Use https://*.example.com for every subdomain, and http://localhost:3000 while you develop.
  4. Copy the Embed id and the Signing secret.

Sign a token on your server

The token is an HS256 JWT. Set sub to the id of the user in your app. The same sub always opens the same designs.

Show the editor

Add &templateId=tpl_xxx to the URL to open one design directly.

Use the SDK

The SDK adds the iframe for you, tells your page what the user does, and lets your page control the editor.
In React, install @bannerify/embed-react and use the component. The ref controls the editor.

Events

A template has id, name, width, height and updatedAt.

Commands

Each command waits for ready and returns a promise. A template of your workspace is read-only, so setModifications and save fail with “Make a copy of this template to change it”.

Asset picker

On the Enterprise plan, your page can show its own library when a user adds an image or picks a color. Turn on Images from your app or Colors from your app under Asset picker. The Media panel then shows Choose from with the name of your app, and the color picker gets a swatch button. Users can still upload their own files.
Return null when the user closes your picker. Bannerify downloads the image from the https URL and copies it into the uploads of the user, so the URL can expire after that. An image is PNG, JPEG, WebP or SVG, up to 5 MB. In React, pass the same function as onAssetRequest.

Without the SDK

The editor talks to your page with postMessage. It sends { source: "bannerify-embed", type, data } to the page that frames it, and accepts { source: "bannerify-host", type, requestId, data } only from that page. It answers each command with { source: "bannerify-embed", type: "response", requestId, data }, or with error in place of data. The command types are open-template, close-template, set-modifications, save, request-content and asset-response. Answer each asset:request event with asset-response and the data { requestId, asset }, where asset is { url, fileName }, { value } or null.

What your users can do

  • Create designs in common sizes, or copy a template of your workspace.
  • Edit text, images, shapes, QR codes and the other layers of the editor.
  • Upload their own images.
  • Download a design as PNG, JPEG, WebP or PDF.
Turn each of these on or off under Permissions. Under Appearance, set the name and logo at the top of the editor, and the accent color of its main buttons.

Render the designs of a user

List the designs of one user with the embedUserId parameter of List templates, then render them like any template.
The templates of your users do not show in the template list of the dashboard.

Webhooks

Add a URL under Webhook, and your server gets a POST when a user creates, changes or deletes a design. Use them to keep your own records, because the events of the SDK only reach the open page.
user is null for a token without sub. Answer with a 2xx status within 10 seconds. A delivery that fails is tried again after 1, 2, 4, 8, 16 and 32 minutes. The same event always has the same id, so skip an id that you already handled.

Check the signature

Each request has a Bannerify-Signature header: t=<unix seconds>,v1=<signature>. The signature is the hex HMAC-SHA256 of <t>.<raw body> with the webhook secret.
Read the raw body before you parse it: a parsed and serialized body can have other bytes.

Analytics

On the Enterprise plan, the Analytics section of the Embed page shows how your users use the editor in the last 7, 30 or 90 days: users, sessions, designs created and downloads, the sessions per day, the sites that opened the editor, and the most active users. A session is one load of the editor. Days are in UTC.

Rotate the signing secret

Click Rotate secret when the secret leaks. Tokens signed with the old secret stop working at once, so update your server first.

Troubleshooting