HappierleadsDocs
Embed Happierleads screens

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:

  1. Tick Allow my app to embed these screens.
  2. Under Your app's addresses add http://localhost:8000 and click Save addresses.
  3. 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.)

GET/admin/websites
Try:
Parameters
PagePage number (starts from 1)
LimitNumber of websites per page
SearchSearch term to filter websites by domain name
StatusFilter websites by status (defaults to 'all' which excludes only deleted)
curl -X GET "https://rest-admin.happierleads.com/admin/websites?privateKey=YOUR_KEY&page=1&limit=50"
Response
Press Send request to try it with sample data.

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:

index.html
<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 handIn the real integration
Copied a website idYour server creates one website per client at sign-up and saves its id (create a website)
Ran curl with the embed keyOne endpoint on your server asks for the link on every page load (open a screen)
Pasted the url into index.htmlYour page fetches the url from your endpoint and sets the iframe (show it in an iframe)
Used localhostYour app's real address, with the screens on your own domain (your domain and keys)

Next: how it works: the three flows.

On this page