Skip to main content

Installation

This SDK is a vanilla JavaScript library that renders the MeetingDoctors web client on your page. To integrate it, you need:

  1. Add the SDK script.
  2. Create a container element in your HTML.

Methods

Initialization

Call the global window.MeetingDoctors.init(config) method once your page is ready:

Initialization
window.MeetingDoctors.init({
widgetId: "<WIDGET_ID>",
companySlug: "<COMPANY_SLUG>",
companyId: "<COMPANY_ID>",
lang: "en",
displayMode: "embed",
containerId: "root",
authType: "sso",
token: "<SSO_TOKEN>", // required if authType is `sso`

// Optional SSO-only parameters:
isolatedView: {
type: "chat", // enum: "chat" | "video_call" | "medical_history"
data: {
specialtyId: 1, // integer ID of a specialty required by type "chat"
// or
specialtyCode: "general" // string code of a specialty required by type "video_call"
}
}
});

Logout

To log the user out and clear the session, call:

Logout
window.MeetingDoctors.logout();

On

To listen for SDK events, use the on method:

Event Listener
window.MeetingDoctors.on("meeting_doctors_ready", (data) => {
// The SDK is fully loaded and ready
});

Off

To stop listening to an event, use the off method:

Remove Event Listener
window.MeetingDoctors.off("meeting_doctors_ready");

Example Implementation

index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body style="width:100%;height:100vh;margin:0;padding:0;display:grid;place-items:center;background-color:#f0f0f0;">
<!-- Container -->
<div id="root"
style="height:667px;width:375px;box-shadow:0 0 10px rgba(0,0,0,0.5);border-radius:8px;overflow:hidden;background-color:#fff;">
</div>

<!-- MeetingDoctors SDK -->
<script type="module" src="https://widget.staging.meetingdoctors.com/sdk/latest/static/js/index.js"></script>

<!-- SDK Initialization -->
<script>
document.addEventListener("DOMContentLoaded", function () {
window.MeetingDoctors.init({
widgetId: "<WIDGET_ID>",
companySlug: "<COMPANY_SLUG>",
companyId: "<COMPANY_ID>",
lang: "<LANGUAGE>",
displayMode: "embed",
containerId: "root",
authType: "sso",
token: "<SSO_TOKEN>"

// Optional SSO-only parameters:
isolatedView: {
type: "chat",
data: {
specialtyId: 1
}
}
});
});
</script>
</body>
</html>
note

Replace <SSO_TOKEN> with the SSO authentication token retrieved from MeetingDoctors API. e.g: bearer eyJ0eX... (it should contain the authentication type, e.g., bearer).

Configuration Parameters

KeyRequiredTypeDescriptionProvided by MeetingDoctors
widgetIdYesstringWidget identifierYes
companySlugYesstringURL-friendly company slugYes
companyIdYesstringUnique company IDYes
langYesstringLanguage code (e.g., en, es, etc.)No
displayModeYesenum(embed)Presentation mode of the SDKNo
authTypeYesenum(sso, email, phone)Authentication methodNo
tokenConditionally (if authType is sso)stringSSO authentication tokenNo
containerIdConditionally (when displayMode: embed)stringDOM element ID where the SDK will be renderedNo

Optional Parameters (SSO only)

KeyTypeDescription
isolatedViewobjectConfigure an isolated view: must include type and optional data.
isolatedView.typeenum(chat, video_call, medical_history)Type of isolated view.
isolatedView.data.specialtyIdintegerRequired by type chat. References a specialty ID in MeetingDoctors.
isolatedView.data.specialtyCodestringRequired by type video_call. References a specialty code in MeetingDoctors.