Fetch Notifications
📩 GetNotifications – SDK API Documentation
🧠 Overview
The getNotifications
API is used to retrieve active REL-ID verification push notifications such as login or transaction requests. This is typically invoked when a user taps a notification bell or lands on the "Notifications" screen of the app. The SDK then fetches and returns any pending notifications from the server for rendering in the app.
🎯 Target Screen
The app should present a Notifications List Screen, showing login or transaction-related requests that require user attention. Each notification item can be tapped to view details or perform an action.
Notifications List Screen showing:
- Each notification item with message and date/time
- Action buttons if applicable (e.g., ✅ Accept / ❌ Reject / 🚨 Fraud)
- A refresh option to invoke
getNotifications()
again
🔧 APIs Involved
API | Direction | Description |
---|---|---|
getNotifications | App → SDK | Requests notification data from server |
onGetNotifications | SDK → App | Callback invoked with notification data payload |
🔗 API to Call
Method: getNotifications(recordCount, enterpriseID, startIndex, startDate, endDate)
getNotifications(recordCount, enterpriseID, startIndex, startDate, endDate)
Parameter | Type | Description |
---|---|---|
recordCount | Number | Number of records to fetch. Use 0 to fetch all active notifications. |
enterpriseID | String | Optional enterprise ID. Blank if not applicable. |
startIndex | Number | Index to begin fetching from (must be ≥ 1). |
startDate | String | Optional. Format: yyyy-MM-dd'T'HH:mm:ssz |
endDate | String | Optional. Format: yyyy-MM-dd'T'HH:mm:ssz |
The response is delivered through the onGetNotifications
event.
📡 SDK Event: onGetNotifications
onGetNotifications
🧩 Overview
The onGetNotifications
event is emitted by the REL-ID SDK after the getNotifications
API is called. It provides an array of notification objects that may require user action such as Accept, Reject, or Fraud report.
🖼️ Sample Payload
{
"eMethId": 14,
"pArgs": {
"response": {
"ResponseData": {
"notifications": [
{
"notification_uuid": "abc123",
"ds_required": true,
"action_performed": "",
"expiry_timestamp": "2024-10-23T06:22:50UTC",
"create_ts": "2024-10-23T06:19:51UTC",
"actions": [
{ "label": "Accept", "action": "accept", "authlevel": "0" },
{ "label": "Reject", "action": "reject", "authlevel": "0" },
{ "label": "Fraud", "action": "fraud", "authlevel": "0" }
],
"body": [
{
"lng": "English",
"subject": "Device Activation",
"message": "You are attempting to activate a new device.",
"label": {
"Accept": "Accept",
"Reject": "Reject",
"Fraud": "Fraud"
}
}
]
}
]
}
}
}
}
🧩 Payload Fields
Field | Type | Description |
---|---|---|
notification_uuid | String | Unique identifier for the notification |
status | String | Final status of the notification: EXPIRED , UPDATED , TAMPERED , etc. |
signing_status | String | Signature validation status: Verified , Failed , NA |
action_performed | String | Action taken by user, e.g., Accept , Reject , Fraud |
update_ts | String | Timestamp of user action or system update (ISO format) |
create_ts | String | Time the notification was generated (ISO format) |
expiry_timestamp | String | Expiry time of the notification (ISO format) |
body | Array | Localized content (subject/message pairs), each with: |
→ lng | String | Language code of the message content (e.g., "English") |
→ subject | String | Notification title shown to the user |
→ message | String | Notification body message |
actions | Array | List of possible actions (rare in history; mostly used in active notif) |
→ label | String | Text to show on the button (e.g., "Accept") |
→ action | String | Action value (e.g., accept , reject ) |
→ authlevel | String | Authentication level needed (usually "0" for most) |
ds_required | Boolean | Whether digital signature was required |
🎭 Possible Values for actions
actions
Action | Description | Action to Take |
---|---|---|
Accept | User accepts the notification | Call updateNotification('Accept') |
Reject | User rejects the notification | Call updateNotification('Reject') |
Fraud | User marks it as fraudulent | Call updateNotification('Fraud') |
🔐 Digital Signing (ds_required = true)
When a notification includes "ds_required": true
, it indicates that digital signing is required before responding.
✅ The SDK automatically handles this signing process internally.
❌ The developer does not need to perform any cryptographic signing manually.
Developer Responsibility:
- Display notification and action buttons (Accept/Reject/Fraud).
- Call
updateNotification(notification_uuid, action)
based on user input.
➡️ SDK will perform the signing before sending the final response to the REL-ID gateway.
✅ Handling Success & Failure
- On success: Parse and display notifications.
- On failure: Use error code to show retry, login, or error message.
📲 Code Snippets for getNotifications
and onGetNotifications
getNotifications
and onGetNotifications
📱 React Native
// Trigger API
RdnaClient.getNotifications(0, "", 1, "", "", (syncResponse) => {
console.log("GetNotifications Sync Response:", syncResponse);
});
// Event Listener
RdnaClient.on(RdnaClient.onGetNotifications, (event) => {
console.log("onGetNotifications Event:", event);
});
📱 Flutter
// Trigger API
rdnaClient.getNotifications("0", "", "1", "", "");
// Event Listener
rdnaClient.on(RdnaClient.onGetNotifications, (data) {
print("onGetNotifications Event: $data");
});
📱 Cordova
// Trigger API
com.uniken.rdnaplugin.RdnaClient.getNotifications(
function(success) {
console.log("GetNotifications Success:", success);
},
function(error) {
console.error("GetNotifications Error:", error);
},
[0, "", 1, "", ""]
);
// Event is automatically handled in the success callback
📱 Native Android
// Trigger API
RDNAError err = rdna.getNotifications(0, "", 1, "", "");
if (err.shortErrorCode != RDNAErrorID.RDNA_ERR_NONE.intValue) {
Log.e("SDK", "Error fetching notifications: " + err.errorString);
}
// Implement callback method for onGetNotifications in RDNACallbacks
@Override
public void onGetNotifications(JSONObject response) {
Log.d("SDK", "onGetNotifications: " + response.toString());
}
📱 Native iOS
// Trigger API
RDNAError* err = [rdna getNotifications:0 withEnterpriseID:@"" withStartIndex:1 withStartDate:@"" withEndDate:@""];
if (err.shortErrorCode != RDNA_ERR_NONE) {
NSLog(@"Error fetching notifications: %@", err.errorString);
}
// Implement callback method for onGetNotifications in RDNACallbacks
- (void)onGetNotifications:(NSDictionary *)response {
NSLog(@"onGetNotifications: %@", response);
}
Updated about 2 months ago