3. 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:
Check integration: If you connect payroll through Check, the employer_id and employee_id you pass here must be the Check company and employee IDs (formats com_XXXXX and emp_XXXXX). Benbase uses them to render Check's widget components for that employee. Passing any other value returns 400 Invalid employee_id format.
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 Native Integration is complete:
- Embed Employer Flow — Embedded the employer iframe
- Connect Payroll — Connected payroll engine via Check OAuth
- Embed Employee Flow (this page) — Embedded the employee iframe
Everything else — census, quoting, deduction syncing — is automatic.