C#
This application will demonstrate how to implement endpoints to start receiving callbacks from Live Link 365.
This is not a production-ready application. Please take your time to read about ASP.NET MVC to make it meet production standards and your business requirements.
To follow this tutorial, you should have a basic understanding of:- C#
- ASP.NET MVC
Steps
Create a starter ASP.NET Core Web App (MVC) application
Add extra properties to contain general information used accross the application, these properties are:
- LIVELINK_APP_KEY: Generated app key - see Authentication section
- LIVELINK_APP_SECRET: Generated app secret from the Initiate - Authentication section
- LIVELINK_BASE_URL: Live Link 365's API Url
- LIVELINK_DEFAULT_ORIGIN (Optional): Phone Number to be used to send the SMS. (Phone number must be in E.164 format)
appsettings.json
is a project file, this file can contain other properties needed by the application.
These configurations/properties are loaded on application startup and are available accross the application if an IConfiguration
instance is passed to the controllers
Create a class to map the request body for a status callback request.
For more details about the body of the request please go to this site's SMS Callbacks section
More on SMS Callbacks
Create a class to map the request body for a incoming callback request.
For more details about the body of the request please go to this site's SMS Callbacks section
More on SMS Callbacks
Create a controller class that will work as handler for the endpoints.
Here, the endpoints will be defined through Routes, these are going to be used by Live Link 365 to send the callbacks. The body classes defined previously are going to be used as the function's input types to automatically parse the request body.
In this section you can implemented your code that is going to handle the request data.For this sample project, a logger is going to be used to write the most relevant data coming from the POST requests
Within this callbacks project, the "Send Appointment Reminders with Live Link" project is used to provide already-made functionality to send SMS messages. Please refer to such project's specific guide to learn how to implement it.
After that we will create a service class to be able to send an appointment SMS, sendAppointmentMessage()
will be the function we are going to use to send the message
Run the project. On startup, the main class will send an SMS using the appointment service. After the message is sent, the service will start listening for any POST requests made to the endpoints defined in previous steps
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 37 38 39 40 41 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
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 88 89 |
|
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 |
|
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 |
|
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 |
|