ClinicKit Mobile SDK / Android

Schedule Appointment Flow (Android)

  1. Authentication
  2. Create intake
  3. Select a consultation
  4. Select appointment time
  5. Start or cancel an appointment

Schedule appointment flow

Before scheduling an appointment with a provider, the user must log in to their patient account.

For the same flow on iOS, see Schedule Appointment Flow under Mobile flows.

1. Authentication

val res = VseeApi.auth.loginAsPatient(username = username, password = password)
when (res) {
    is Resource.Success -> {}
    is Resource.Error -> {}
}
  1. Initiate login:
    • The app calls VseeApi.auth.loginAsPatient, passing the username and password.
  2. Handle the response:
    • The function returns a Resource that indicates success or failure:
      • Success: if authentication succeeds, the code in the Resource.Success block runs.
      • Error: if authentication fails, the code in the Resource.Error block handles the error.

This ensures that only authorized patients can access and schedule appointments with providers.

For details of the authentication process, see Authentication in the Enter Waiting Room Flow.

2. Create intake

The intake form, opened with the Schedule an appointment button, lets patients update information about their visit, such as the reason for the visit and the consultation type.

Intake access

Update the reason for the visit:

Update reason for visit

3. Select a consultation

After entering the reason for the appointment, the user chooses a consultation type.

val res = VseeApi.visitApi.updateConsultation(intakeId, consultationId)
res.doIfSuccess {
    _updatedIntake.postValue(it)
}

res.doIfFailure {
    Timber.e("Unable to update consultation: $it")
}

Select a consultation

Use this API to get the available consultations, including their types, slots, and price.

val res = VseeApi.roomApi.getRoom(roomCode = it, timeZone = TimeZone.getDefault().id)
res.doIfSuccess { room ->
    if (room.payment?.consultations?.isEmpty() == true) {
        error.postValue("No consultation types are available in this room currently.")
    } else {
        _consultations.postValue(room.payment!!)
    }
}

res.doIfFailure {
    Timber.e("Unable to get room: $it")
}

4. Select appointment time

After choosing a consultation type, the user selects an available time slot.

Note: Providers manage the available appointment slots. If no slot is convenient, contact the provider for more options.

Select appointment time

To book the selected time:

  1. Call the API:
    • The app calls the createVisit API with the details needed to create the visit:
      • Intake ID: the ID of the intake form.
      • Member ID: the ID of the patient scheduling the appointment.
      • Slot start: the start time of the selected slot.
      • Slot end: the end time of the selected slot.
      • Room code: the code of the virtual consultation room.
  2. Handle the response:
    • The API returns success or failure:
      • Success: the app updates the UI to show the appointment was created.
      • Failure: the app tells the user it failed and asks them to retry or get help.
val res = VseeApi.visitApi.createVisit(
    CreateVisitRequest(
        intakeId = intakeId,
        memberId = VseeApi.session.getUserId()!!,
        slotStart = slot.start,
        slotEnd = slot.end,
        roomCode = VseeApi.session.getRoomCode()
    )
)

res.doIfSuccess {
    Timber.d("Create visit success: $it")
    _visitCreatedSuccessfully.postValue(slot)
}

res.doIfFailure {
    Timber.e("Create visit error: ${res.message}")
}

Appointment confirmation

5. Start or cancel an appointment

To get the list of upcoming appointments, call the getVisits API with the filter parameter set to 'upcoming'.

val request = GetVisitsRequest(
    roomCode = VseeApi.session.getRoomCode(),
    accountCode = VseeApi.session.getAccountCode(),
    filter = "upcoming",
    extended = true,
    order = "desc"
)

viewModelScope.launch {
    isLoading.postValue(true)
    val res = VseeApi.visitApi.getVisits(request)
    isLoading.postValue(false)

    when (res) {
        is Resource.Success -> res.data?.let { data ->
            _visits.value = data
        }

        is Resource.Error -> {
            Timber.d("Get visits error: ${res.message}")
        }
    }
}

When the scheduled time arrives, the user can start the meeting with their provider or cancel the appointment.

Start or cancel an appointment

Start an appointment:

startActivity(Actions.openPreWaitingRoom(this, visit))

Cancel an appointment:

viewModelScope.launch {
    val res = VseeApi.visitApi.closeVisit(visitId, "Close visit on the sample app.")
    res.doIfSuccess {
        _closeVisitResult.postValue(true)
    }
    res.doIfFailure {
        _closeVisitResult.postValue(false)
    }
}