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:
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": "<employer-id>",
"employee_id": "<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:
- Embed Employer Flow — Embedded the employer iframe
- Connect API — Set up webhooks, provided census
- Sync Data — Receiving deductions, reporting employment changes
- Embed Employee Flow (this page) — Embedded the employee iframe