Skip to Content
Benbase

4. Embed Employee Flow

Embed the Employee Flow iframe in your platform.

Embed Employee Flow

The Employee Flow is shown to each employee. It covers benefits enrollment and waivers.

Each employee gets their own iframe URL. You generate one per employee when they need to access benefits enrollment. Like the Employer Flow, these URLs are single-use.

In the samples, replace <existing_employer_id> and <existing_employee_id> with the IDs from your own system. Use the same IDs that you already sent to Benbase for that employer and that employee.

curl -X POST https://embed-sandbox.benbase.com/api/flows/employee \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "employer_id": "<existing_employer_id>",
    "employee_id": "<existing_employee_id>"
  }'
curl -X POST https://embed.benbase.com/api/flows/employee \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "employer_id": "<existing_employer_id>",
    "employee_id": "<existing_employee_id>"
  }'

Embed the returned URL in your app.

Required: Flow iframes emit benbase-embed.height-updated events via postMessage whenever their content height changes. Your parent page must listen for this event and resize the iframe accordingly — otherwise the iframe will scroll internally. All examples below include this listener.

<iframe id="benbase-employee" src="{{url}}" style="width:100%;border:none"></iframe>

<script>
window.addEventListener('message', function(event) {
    var eventName = event.data.event;
    var data = event.data.data;

    if (eventName === 'benbase-embed.height-updated') {
        document.getElementById('benbase-employee').style.height = data.height + 'px';
    }
});
</script>

All returned URLs are single-use. For theming and dark mode, see Theming.

Done!

Your API Integration is complete:

  1. Embed Employer Flow — Embedded the employer iframe
  2. Connect API — Set up webhooks, provided census
  3. Sync Data — Receiving deductions, reporting employment changes
  4. Embed Employee Flow (this page) — Embedded the employee iframe

Next step

→ Go Live

On this page