C#
This tutorial provides you with a step-by-step walkthrough of how to build a ‘Doctor’s Appointment App’ to send appointment reminders via SMS using Live Link 365.
This is not a production-ready application. Please take your time to enhance it for production so that it meets your specific business requirements.
The main panel on the right highlights the right piece of code for each step.Steps
Create a class Person
, since two of our entities share the same information, we are using this class to extend one of them, a patient will be treated as a person. Person
will have the next attributes:
- id: String
- firstName: String
- lastName: String
- phoneNumber: String
Create a class Doctor
and extend it from Person
class, override the constructor to reflect the parameters needed for a Doctor
. Doctor
will have the same properties as Person
and a new attribute:
- specialization: Specialization
Create the class Specialization
, that will have the next attributes:
- id: String
- name: String
Create the java class for Appointment
using the Doctor
, Patient
, Specialization
and Date
class objects.
Create the getter/setter methods to access the attributes of the Appointment
class
The properties.json file contains the information needed by the MessageHandler
class in order to be able to send the SMS. It has three properties:
- appKey
- appSecret
- defaultOrigin
appKey
and appSecret
are the ones generated for your app in the Live Link 365 Main Portal and defaultOrigin
is the default number the message will be sent to
MessageHandler
class works as a container for the functionalities required to send SMS through the API. For this step we have created two methods:
GetAccessToken()
: This method will take the app Key and app Secret and combine them into a Base64 string, which will then be sent to the/api/oauth/token
endpoint to generate and return the authentication tokensendMessage()
: This method makes the POST request to the API to send the SMS; it receives the message to be sent, the number which we want to send the message, and optionally we can define from wich number we want to send the message
Now we finally call the main()
function. Retrieve the information from properties.json to access the API data.
Create an instance of the MessageHandler
class, passing the information we just retrieved.
Once an Appointment
is created, we send the notification SMS to the patient where we let him/her known the details for the appointment (doctor and date of the appointment)
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
1 2 3 4 5 6 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|