Developer Hub

Let's build health apps together that do good at scale

Get Started

Using JavaScript SDK

Setup

  1. Import HOPES SDK into your HTML.
<script type="text/javascript" src="lib/hopes.min.js"></script>
  1. Import HOPES into your code.
import Hopes from './hopes';

Retrieve access tokens

  1. Get OAuth2 code with authenticate() method.
const hopes = new Hopes({appId: YOUR_APP_ID, redirectUri: YOUR_REDIRECT_URI});
hopes.authenticate();
  1. Call HOPES Oauth2 API to get access token with the code you get.

  2. Call HOPES API with the access token you get.

Telemedicine

  1. Create/Join a video room
const hv = new Hopes.Video({ roomId });
const audioOnly = false;
const displayName = 'Dylan';
const pin = 'PIN';
hv.start({ audioOnly, displayName, pin }).then((roomInfo) => {
  console.log(`RoomInfo: ${JSON.stringify(roomInfo)}`);
}).catch((error) => {
  alert(error.message);
});
  1. Create a video room
createRoom(name = null, pin = '', audioOnly = false) {
  1. Join a room
joinRoom(roomId, options = {})
  1. Leave room
leaveRoom()
  1. Toggle Full Screen
toggleFullScreen()
  1. Toggle Local Audio
toggleLocalAudio(mute)
  1. Toggle Local Video
toggleLocalVideo(mute)

Using JavaScript SDK