handlePushNotificationAction()
Note: This API is supported from version 10.0.0.
The handlePushNotificationAction() API processes incoming push notification data and handles user interactions with notification actions, such as “Reply”, “Accept”, or “Decline”. It enables your app to respond appropriately based on the action performed.
Parameters:
- actionIdentifier (String?): The identifier of the action triggered by the user (e.g., "Reply", "Accept", "Decline").
- userInfo ([AnyHashable: Any]): The push notification payload.
- responseText (String?): The user input text used for reply actions.
- completion: A closure that is executed once Mobilisten completes handling the push notification action.
Example
Copiedfunc userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
if ZohoSalesIQ.isMobilistenNotification(response.notification.request.content.userInfo) {
let userInfo = response.notification.request.content.userInfo
let actionIdentifier = response.actionIdentifier
let responseText = (response as? UNTextInputNotificationResponse)?.userText
ZohoSalesIQ.handlePushNotificationAction(actionIdentifier: actionIdentifier,
userInfo: userInfo,
responseText: responseText,
completion: completionHandler)
} else {
// Handle any other non-SalesIQ notifications
}
}