Python
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 Flask to make it meet production standards and your business requirements.
To follow this tutorial, you should have basic understanding of:- Python
- Flask
- Pipenv
- Requests
Steps
Create a simple Flask
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 - See Authentication section
- LIVELINK_BASE_URL: Live Link 365's API Url
- LIVELINK_DEFAULT_ORIGIN (Optional): Phone Number to be used to send the SMS
config.py
is a project file, this file can contain other properties needed by the application
Create the 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.
In this section you can implement the code that is going to handle the requests data.
For this sample project, we are going to write the most relevant data coming from the POST requestsTo demonstrate the callbacks, the "Send Appointment Reminders with Live Link 365" project is used as a the code to send the SMS; please refer to the 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 application will send an SMS using the appointment service. After that, the service will start listening to any POST requests made to the endpoints defined earlier
Code
1 2 3 4 5 6 7 8 9 10 |
|
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 |
|
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 |
|