await formFillingClient.start({ ... }) from your own code when the clinician is ready.
Use this approach if you are building with vanilla JavaScript, or another non-React framework, and want to control when and where Form filling appears in your interface.
Let’s get started!
Prerequisites
Before you begin, you must have the following requirements met:- Packages: Install
@suki-sdk/jsand@suki-sdk/core(Web SDKv3.2.0or later). - Partner credentials: Obtain
partnerIdandpartnerTokenfrom Suki after Partner onboarding. - Template IDs:
template_idUUIDs from your Suki support team forform_template_ids. - Encounter ID: Pass your encounter ID as
correlation_id. Refer to Configuration for more details. - Browser and layout: Your app runs in a browser over HTTPS, with microphone access and a Form filling container that has height.
Install the packages
Add both packages to the same project you load in the browser:Step 1: Add container HTML
The hosted Form filling UI mounts inside the element you pass asrootElement. That node must have real height, or the iframe looks blank.
HTML
Step 2: Create auth manager
Now you need to create the Auth Manager for your application. To create the Auth Manager, you must have thepartnerId and partnerToken credentials from Suki.
Refer to Partner onboarding guide to learn how to get these credentials.
Once you have all the required credentials, create one auth manager for the page (or app shell).
Code example for creating auth manager
JavaScript
Step 3: Create Form filling client
After you have created the auth manager, you can create the Form filling client for your application. The Form filling Client is the object that will be used to start the Form filling session. Create one Form filling client and reuse it for everystart() call on that page.
Code example for creating Form filling client
JavaScript
Step 4: Call start() to open Form filling
Now you can start the Form filling session by calling thestart() method on the Form filling client.
Call await formFillingClient.start({ ... }) from a click handler (or similar) when the DOM is ready.
Pass rootElement, form_template_ids, onSubmit, and any optional fields you need. Refer to Configuration guide for more details on the available options and how to use them.
Code example for starting Form filling
JavaScript
onSubmit is required. It runs when structured JSON is ready after processing, not when the clinician taps submit in the hosted UI.Callbacks
You can passonReady, onSubmit, and onCancel on start(), or listen with formFillingClient.on() for handlers that stay active across many sessions:
JavaScript
FormFillingResult shape and Events for every event and payload.
Starting another session
Callingstart() again replaces the active session. You do not need to call stop() manually just to open Form filling again:
JavaScript
Complete code example
Below is a complete code example in JavaScript for Form filling with a single container and button.JavaScript
onSubmit returns structured_data.