Steps of Receiving OPTT’s Notifications via Webhook on IOS applications
To optimize API integration offered by OPTT, we introduce the webhook which simplifies the access for third-party digital mental health applications to any notifications received inside the OPTT platform without the need to login into OPTT platform. This will simplify and enhance 3rd party user experience to use the clinically validated smart care plans.
In this guide you will learn how to connect to OPTT Notification Center and receive notifications from OPTT on your IOS application via Webhook:
1- Registering the Application in the Firebase
Client (IOS application) registers itself in FCM using the OPTT Server Key and gets a specific token by adding the Firebase SDK to the app.
2- Registering the Application in OPTT
The client sends the token that was generated by Firebase SDK along with the OPTT.ID (in this case user’s email address) to the notification server and gets registered to the notification system.
3- Registering user’s application in OPTT
The client, registers the users to the FCM and gets the token, then sends back the OPTT.ID and the token (that was already sent by FCM) to OPTT for registering the user in the OPTT notification service.
3.1- Request URL:
http://ec2-3-96-157-217.ca-central-1.compute.amazonaws.com:8064/api/fcm-token
3.2- Header:
Header | Value |
---|---|
Content-Type | application/json |
3.3- Body
{
"token": "987578",
"userId": "[email protected]"
}
In this call, we want to register [email protected]:
4- Sending Notifications Through OPTT
From now on, users will receive OPTT notifications. Any new notification that is created for the user will be sent to them.
5- Testing the Receiving of Notifications for Registered Users:
Consider that a user has logged in to the application using: [email protected]
And the client has already created a token for this user through Firebase and has sent the token along with the user's email address to OPTT.
From now on, all new notifications will be sent to the user.
5.1- Request URL:
http://ec2-3-96-157-217.ca-central-1.compute.amazonaws.com:8064/api/notification
5.2- Body:
{
"content": "New Assignment by [email protected]",
"data": {"URL":"https://institut.dv.optt.ca/client/module/view/9UTLNMDHXY/401FFKBGSJT?lang=en"},
"optt_id":"[email protected]",
"subject": "Assignmnet"
}
Parameter | Description |
---|---|
content | content of notification |
data | Notification deep link address in the application |
optt_id | user's email |
subject | subject of notification |
5.3- Header:
Header | Value |
---|---|
Content-Type | application/json |
6- Receiving Notifications by the User
Updated almost 3 years ago