Embeds provide a complete user experience for editing campaigns, email templates, and other
marketing primitives available within Pocketflows. For when to use them, see
Businesses, customers, and embeds.
The work is split between your server, which creates the embed, and your frontend, which displays it.
Before you start, read How embeds are secured: the embed’s URL works without a
login, so who receives it matters.
1. On your server: create the embed
Add an endpoint to your application that your frontend calls when a business owner opens your marketing page. In it:- Check the user’s session, and look up which business they belong to from your own records. Don’t accept a business ID from the browser.
- Find that business’s Pocketflows ID, which you saved when you synced the business.
-
Create an embed for it, using your secret key:
-
Return the
urlto your frontend, and nothing else from the response.
2. In your frontend: display it
Pass theurl as the src of an iframe:
iframe take up as much of the viewport as possible.
3. Handle expiry
An embed expires 7 days after it’s created. If a business owner keeps the page open pastexpires_at,
the embed tells them their session has expired. Reloading your page fetches a new URL from step 1, so
no extra handling is needed if your page always creates a new embed when it loads.
Related
- How embeds are secured for what an embed URL grants and how long it lasts.
- Set up custom domains: custom domain setup is built into the embed UI.