Skip to content

Getting Started

Use the MedYou SDK to embed the recorder widget, pass the runtime identifiers the backend expects, and listen to the widget's public events.

The public widget tag is medyou-recorder.

Required attributes

  • client-key
  • clinician-id
  • patient-id
  • session-id

What the widget does

  1. Calls POST /access with your client-key
  2. Lets the clinician record audio or upload an audio file
  3. Sends audio and runtime metadata to the MedYou backend
  4. Emits public DOM events on the widget element as processing progresses

Minimal example

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>MedYou Minimal Example</title>
    <script
      type="module"
      src="https://medyou-sdk-js-prod.pages.dev/medyou-sdk-js.es.js"
    ></script>
  </head>
  <body>
    <medyou-recorder
      id="medyou-recorder"
      client-key="bpk_your_publishable_key"
      clinician-id="clinician_001"
      patient-id="patient_001"
      session-id="session_001"
    ></medyou-recorder>

    <pre id="status">Waiting for audio...</pre>
    <pre id="result"></pre>

    <script type="module">
      const widget = document.getElementById("medyou-recorder");
      const status = document.getElementById("status");
      const result = document.getElementById("result");

      widget.addEventListener("access-ready", () => {
        status.textContent = "Widget ready";
      });

      widget.addEventListener("processing-completed", (event) => {
        status.textContent = "Processing completed";
        result.textContent = JSON.stringify(
          {
            transcription: event.detail.transcription,
            soap: event.detail.soap,
            metadata: event.detail.metadata,
          },
          null,
          2,
        );
      });

      widget.addEventListener("upload-failed", (event) => {
        status.textContent = `Upload failed: ${event.detail.error}`;
      });
    </script>
  </body>
</html>

Next