What you will build
- A shared platform client for your React app.
- Sign-in with Headless auth.
- An ambient session for recording.
- Start, pause, resume, and submit controls, plus session context after start.
- Optional microphone selection with
config.audio.deviceId(Headless Web SDK v0.3.1 or later).
PlatformClientProvider, sign in with useAuth, create a session with useAmbient, and control recording with useAmbientSession.
By the end of this tutorial, you will have a React page that authenticates, creates an ambient session, and exposes start, pause, resume, and submit controls. You can optionally pass a microphone deviceId so the recording uses a specific microphone.
The Headless Web SDK is in beta. APIs and docs may change. Confirm package versions with your Suki contact before production use.
Prerequisites
Before you begin, make sure you have:- Completed Partner onboarding.
- A React 18+ app that meets Headless Web SDK prerequisites.
- Staging
partnerIdandpartnerTokenvalues.
Headless Web SDK is for custom UIs. If you want the hosted ambient chrome, use the Web SDK ambient session tutorial instead.
Architecture
Project setup
- Use a React 18+ app that meets Headless Web SDK prerequisites.
- Install the required dependencies:.
-
Configure your credentials:.
- Keep staging
partnerIdandpartnerTokenready for sign-in. - Confirm beta expectations with your Suki contact before production use.
- Keep staging
Tutorial steps
Work through each step in order. Read the explanation, review the code example, then continue to the next step. The full code example is available in the accordion below.1
Create PlatformClient and Wrap the App
Create one
PlatformClient and wrap your app with PlatformClientProvider so hooks share the same client.Check: One PlatformClient is passed into PlatformClientProvider.If it fails: Wrap the tree with PlatformClientProvider and pass client={client}. Hooks do not work outside that provider.2
Authenticate with UseAuth
Call
useAuth under the provider. When autoRegister is true, pass providerName, providerOrgId, and providerSpecialty.Check: useAuth runs under the provider, and when autoRegister is true you pass providerName, providerOrgId, and providerSpecialty.3
Create an Ambient Session with UseAmbient
Use
useAmbient to create a session. Wait for isSuccess before you pass ambientSessionId into recording hooks.Check: isSuccess is true and ambientSessionId is set before you pass it into recording hooks.If it fails: Create the session only when the user is signed in and you have not already created a session for this screen.4
Start, Pause, Resume, and Submit with UseAmbientSession
Pass the session ID into
useAmbientSession. After start(), call setSessionContext with patient and visit details to improve note quality. Track recording versus paused in local state. sessionStatus is only created, submitted, completed, or cancelled.Optionally pass config.audio.deviceId with a MediaDeviceInfo.deviceId from your own enumerateDevices() flow (v0.3.1 or later). Your app owns how you design and implement the microphone picker UI. Changing the microphone while recording does not switch the microphone that is already in use. Update deviceId in state, call pause(), then resume(). For the full enumerate-and-select sample, refer to Select a microphone guide.Check: You can start, pause, resume, and submit. sessionStatus is one of created, submitted, completed, or cancelled.If it fails: Changing config.audio.deviceId while recording does not switch the microphone already in use. Update deviceId in state, call pause(), then resume(). This path needs Headless Web SDK v0.3.1 or later.Full code example
Troubleshooting
Hooks Fail Outside Provider
Hooks Fail Outside Provider
Wrap the tree with
PlatformClientProvider and pass client={client}.Session Create Never Runs
Session Create Never Runs
Create only when signed in and you have not already created the session for this screen.
Beta API Surprises
Beta API Surprises
Treat this SDK as beta; confirm package versions with your Suki contact.
Microphone DeviceId Not Applied Mid Recording
Microphone DeviceId Not Applied Mid Recording
Changing
config.audio.deviceId while recording does not switch the microphone that is already in use. Update the deviceId in your app state, call pause(), then resume(). Requires Headless Web SDK v0.3.1 or later. Refer to Select a microphone guide for more details.Summary
In this tutorial, you:- Wrapped the app with
PlatformClientProvider. - Signed in with
useAuthand created a session withuseAmbient. - Controlled recording with
useAmbientSession(start, pause, resume, and submit). - Optionally selected a microphone with
config.audio.deviceId(v0.3.1 or later).