Embed SDK Reference
Including Kota.js
Include the Kota.js script on each page you want to run it on - it should always be loaded directly from https://js.kota.io or https://test.js.kota.io, rather than included in a bundle or hosted yourself. This ensures compliance and future updates.
When you are ready to go-live make sure your production environment is not including the test SDK.
Initialising Kota.js
Employer
Kota.Health.employer(employerAccessToken, options?)
Use Kota.Health.Employer(employerAccessToken, options?) to create an instance of the Kota Health’s Employer embedded UI.
The employerAccessToken can be retrieved from the Embed Session endpoint.
Once initialised, if the optional container has not been provided, the employer embed will load in on a <div> with id="employer".
Method parameters
/embed/session endpoint to authenticate the user session.Employee
Kota.Health.employee(employeeAccessToken, options?)
Use Kota.Health.Employee(employeeAccessToken, options?) to create an instance of the Kota Health’s Employee embedded UI.
The employeeAccessToken can be retrieved from the Embed Session endpoint.
Once initialised, if the optional container has not been provided, the employer embedded will load in on a <div> with id="employee".
Method parameters
/embed/session endpoint to authenticate the user session.Browser events
The only way to communicate with your Embedded UI in the browser is by listening to an event.
You can set up listeners directly from your initialised employer and employee objects or by directly listening for the events on the window.
pageLoaded
The pageLoaded event fires each time a new page is loaded throughout an Embedded UI - both for employer and employee.
You can listen for it directly from your initialised objects, e.g. employerEmbed.on('pageLoaded', handler), or with event listeners. If listeningly directly be careful to listen for the correct event as they are namespaced by employer and employee - see the event list for more information.
Method parameters
handler(event) => void is a callback function that you provide that will be called when the event is fired. After it’s called, it passes an event object with the following properties:
healthSetupLoaded
The healthSetupLoaded event fires each time a new page is loaded throughout an Embedded UI - both for employer and employee.
You can listen for it directly from your initialised objects, e.g. employerEmbed.on('healthSetupLoaded', handler), or with event listeners. If listeningly directly be careful to listen for the correct event as they are namespaced by employer and employee - see the event list for more information.
Method parameters
handler(event) => void is a callback function that you provide that will be called when the event is fired.healthManagementLoaded
The healthManagementLoaded event fires each time a new page is loaded throughout an Embedded UI - both for employer and employee.
You can listen for it directly from your initialised objects, e.g. employerEmbed.on('healthManagementLoaded', handler), or with event listeners. If listeningly directly be careful to listen for the correct event as they are namespaced by employer and employee - see the event list below for more information.
Method parameters
handler(event) => void is a callback function that you provide that will be called when the event is fired.loadError
The loadError event fires when the Embedded UI fails to load.
You can listen for it directly from your initialised objects, e.g. employerEmbed.on('loadError', handler), or with event listeners. If listeningly directly be careful to listen for the correct event as they are namespaced by employer and employee - see the event list below for more information.
Method parameters
handler(event) => void is a callback function that you provide that will be called when the event is fired.
