The URL is the credential
The embed’s URL contains a long random token, and that token is all the browser needs. Anyone who has the URL can use the embed as that business, with no further login, until it expires. Treat the URL like a password:- Create it on your server, after you have checked who the signed-in user is.
- Choose the business from your own session data. Never take the business ID from the browser, or one user could open another business’s marketing.
- Give the URL only to that user’s browser. Don’t put it in logs, analytics, emails or links that can be shared.
What an embed can do
An embed made withPOST /businesses/:id/embeds can see and change everything that business has in
Pocketflows: its customers, segments, campaigns, triggers, templates and settings. It can’t reach other
businesses in your project.
Narrower embeds open a single editor for one record, such as an email template
(POST /email_templates/:id/embeds) or an SMS template (POST /sms_templates/:id/embeds). Use them
when the user should only edit that one thing.
How long an embed lasts
- A business embed expires 7 days after it’s created, at its
expires_attime. Email and SMS template embeds acceptexpires_in, in seconds, to set a different lifetime. - Until it expires, the URL can be loaded any number of times.
- Creating a new embed doesn’t cancel earlier ones, and there is no way to revoke an embed before it expires.
- When an embed expires while it’s open, the page tells the user their session has expired. Loading an expired URL again doesn’t work.