Push notifications are sent to the end-users in the following circumstances:
1 Ticket priority update.
2 Ticket status update.
3 Agent's reply.
4 Agent's public comment.
5 Agent's reply to the Live Chat.
Ensure that Push Notifications settings are configured in the ASAP help widget setup page in Zoho Desk.
Ensure that push notifications are implemented in the help widget. For iOS, create and upload a valid Apple Push Notification Service (APNs) certificate and its password. Refer to the
document to learn about Apple Push Notifications.
To enable push notifications
For Android Apps
To enable Push Notifications, include the following code snippet in the main.dart class file:
- import package:zohodesk_portal_apikit/zohodesk_portal_apikit.dart show ZohodeskPortalApikit;
ZohodeskPortalApikit.enablePush(_fcmToken);
For iOS Apps
To enable push notifications, include the following method in the iOS application AppDelegate file:
- func application
(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
{
let token = deviceToken.reduce
("", {$0 + String(format: "%02X", $1)}).uppercased()
ZohoDeskPortalSDK.enablePushNotification
(deviceToken:token, mode: .production)
}
To ensure the accuracy of notifications:
• Test the functionality in development mode.
• Transition to development mode by replacing ".production" with ".sandbox" in the provided code snippet and Desk Setup.
• Remember to switch back to production mode before deploying the application for end-customer usage.
To disable push notifications
To disable Push Notifications, include the following code snippet in the main.dart class file:
- import package:zohodesk_portal_apikit/zohodesk_portal_apikit.dart show ZohodeskPortalApikit;
ZohodeskPortalApikit.disablePush(_fcmToken);
_fcmToken is the string retrieved using FirebaseMessaging.instance.getToken().
Code is standard for both iOS and Android platforms. How to handle push notifications?
This is to help navigate end-users to the respective screen, depending on the type of push notifications they receive.
For Android Apps
Types of Push Notification | End user navigation page |
Single notification | Ticket List |
Bulk notification | Ticket Details |
Chat notification | Live Chat |
Prerequisite - Ensure that the notification icon is set before handling Push Notifications.
Passing the Push Notification icon
To pass the icon, include the following code snippet:
- ZohodeskPortalConfigurationPlugin.setNotificationIcon(drtawableRes);
drtawableRes refers to the icon's drawable identifier.
Handling push notifications
To handle push notifications, include the following code snippet in the FirebaseMessaging.onMessage.listen and _firebaseMessagingBackgroundHandler of main.dart class.
Learn more about handling push notifications.
- ZohodeskPortalConfiguration.handleNotification(map);
map refers to the notification message data that is retrieved using remotemessage.data
Ensure that the SDK initialization process is completed before calling the handleNotification function. For iOS Apps
To handle Push Notifications, include the following code snippet in the application: the didReceiveRemoteNotification method in the AppDelegate file.
- override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any])
{
ZDPortalConfiguration.processRemoteNotification(userInfo: userInfo)
}
How to handle error logging?
Enabling the console log allows you to track error messages, helping to identify and resolve errors that may arise during execution.
By default, the SDK logs are disabled.
To enable the logs, include the following code snippet:
- import 'package:zohodesk_portal_apikit/zohodesk_portal_apikit.dart' show ZohodeskPortalApikit;
ZohodeskPortalApikit.enableLogs();
Code is standard for both iOS and Android platforms.The logs should be disabled before releasing the build.