Quickstart: your first embedded screen
In about 10 minutes, see one of your own websites inside a local page, before writing any real integration.
Before building anything, see it work with your own account: one key, one call, one HTML file. You need a Happierleads account with at least one website.
Switch embedding on for localhost
In the dashboard open Account settings → White label → Embed in your app:
- Tick Allow my app to embed these screens.
- Under Your app's addresses add
http://localhost:8000and click Save addresses. - Under Server keys click Create key and copy it (it is shown once).
You don't need your own domain yet: Your domain and keys does that before you go live.
Find a website id
Switch the playground to My real account and press Send request: copy the _id of one of your websites. (On Mock data you get the sample website.)
/admin/websitescurl -X GET "https://rest-admin.happierleads.com/admin/websites?privateKey=YOUR_KEY&page=1&limit=50"Ask for a one-time link
From your terminal, with the key from step 1 and the website id from step 2:
curl -X POST "https://rest-admin.happierleads.com/v3/embed/sessions" \
-H "Authorization: Bearer hle_YOUR_EMBED_KEY" \
-H "Content-Type: application/json" \
-d '{ "websiteId": "YOUR_WEBSITE_ID", "view": "auto" }'You get { "url": "…/embed?ticket=…" }. It works once, within 60 seconds, so go straight to the next step.
Open it in a page
Save this as index.html, paste the url in, and serve the folder on port 8000 (python3 -m http.server 8000), then open http://localhost:8000:
<iframe src="PASTE_THE_URL_HERE" title="Website visitors" style="width:100%;height:100vh;border:0"></iframe>Your website's leads (or its install screen, if the pixel isn't live yet) appear inside your page. Reload after 60 seconds and you get This link was already used or has expired: that is the one-time link doing its job.
What you just did
| You did by hand | In the real integration |
|---|---|
| Copied a website id | Your server creates one website per client at sign-up and saves its id (create a website) |
Ran curl with the embed key | One endpoint on your server asks for the link on every page load (open a screen) |
Pasted the url into index.html | Your page fetches the url from your endpoint and sets the iframe (show it in an iframe) |
Used localhost | Your app's real address, with the screens on your own domain (your domain and keys) |