Schedule Appointment Flow (Android)
- Authentication
- Create intake
- Select a consultation
- Select appointment time
- Start or cancel an appointment

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 -> {}
}
- Initiate login:
- The app calls
VseeApi.auth.loginAsPatient, passing the username and password.
- The app calls
- Handle the response:
- The function returns a
Resourcethat indicates success or failure:- Success: if authentication succeeds, the code in the
Resource.Successblock runs. - Error: if authentication fails, the code in the
Resource.Errorblock handles the error.
- Success: if authentication succeeds, the code in the
- The function returns a
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.

Update the reason for the 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")
}

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.

To book the selected time:
- Call the API:
- The app calls the
createVisitAPI 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.
- The app calls the
- 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.
- The API returns success or failure:
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}")
}

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 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)
}
}