In this version we are going to enable users to send messages between them. To achieve this we can make use of the ONEm API.
First, we will need an API key to be able to authenticate our requests towards the ONEm API. Head over to the ONEm Developer Portal.
First create the app then click on Details --> API key & permissions, check the Notification box and click on Generate API key:
Copy the freshly generated API key and head over to the settings file in our Django project:
Now we can edit the
settings.py file and replace the value of the
APP_APIKEY variable with the key we have generated earlier:
APP_APIKEY = '...'
Start the local server for your app:
Expose the server publicly:
Test Client section in the developer portal and send
#name-of-your-app. This should be the name as shown in the developer portal.
Now we simply have to look for posts from other users and select one of them for viewing:
#POST.TEST apartment for rent Hi, offering a 90sqm, 2 bedrooms apartment for renting. Message me for more details! Author: Milla Expires in: in 10 days, 19 hours Code: 3z8d7m Views: 5 A Send message --Reply MENU/BACK
By choosing option
A the app will allow you to compose your message for the post owner.
Behind the scene, your request will use ONEm API to send the message.
You can inspect the code in the
views.py file in the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
The post owner will receive the notification as follows:
#POSTV3 - apartment for rent Hello, I am interested in renting your apartment! Can you let me know what your telephone number is ? Sent by: John --Reply #postv3