Notifications iOS

Configure Push and In-App notifications.

Configure push notifications via Helpshift

Notifications can be sent to your users when you reply to an issue submitted by them. The notification from Helpshift appears as a badge or a sound alert or both along with the App icon in the iOS notifications.

If your app does not already use push, you will need to enable push for your app. To enable push notification in your application you need to add APNS registration code to your AppDelegate's application:didFinishLaunchingWithOptions: method:

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
        UIUserNotificationType notificationType = UIUserNotificationTypeBadge | UIUserNotificationTypeAlert;
        UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:notificationType categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
        [[UIApplication sharedApplication] registerForRemoteNotifications];

    } else {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

Configure Helpshift's push notification service in the Helpshift admin interface

Set up your application with Apple and enable push notifications. Download the Push Notifcation Certificate from Apple's developer portal, and double click on it to import it to the Keychain Access application.

In the Keychain Access application right click on the certificate that was just added and click export it in .p12 format. Please provide a password while exporting the certificate (We do not accept empty passwords). Note that if your development private key is not present in Keychain Access you will not be able to export it in .p12 format. Once you have exported the .p12 file you can login and upload that file in your app settings in the Helpshift admin panel. Provide the same password you used while exporting to .p12 format.


Set the Production / Development mode options, depending on whether your Apple push certificate was for testing (development push) or production. You can configure whether to send a badge or not, and sound alerts if you provided custom sounds bundled with your app to handle notifications. Save it and you're all set.

Configure the Helpshift iOS SDK to handle notifications

For Helpshift SDK to work with the Helpshift push notification service you will need to invoke the registerDeviceToken: api call inside the application delegate method application:didRegisterForRemoteNotificationsWithDeviceToken: In your app delegate file it will look something like this:

- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [[Helpshift sharedInstance] registerDeviceToken:deviceToken];

Whenever a push notification is received, the application delegate didReceiveRemoteNotification: gets called. Developers should check the "origin" field of the notification dictionary and call handleRemoteNotification:withController: api if the origin of the notification is "helpshift". The Helpshift SDK will check issue for which the notification was received and will launch the chat screen for that issue automatically.

Example usage:

When receiving remote notifications when app starts for the first time

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    if (launchOptions != nil) //Handle PushNotification when app is opened
        NSDictionary* userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
        if (userInfo != nil && [[userInfo objectForKey:@"origin"] isEqualToString:@"helpshift"])
            [[HelpshiftsharedInstance] handleRemoteNotification:userInfo withController:[[UIApplication sharedApplication] keyWindow].rootViewController];

For the didReceiveRemoteNotification delegate

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    if ([[userInfo objectForKey:@"origin"] isEqualToString:@"helpshift"]) {
        [[Helpshift sharedInstance] handleRemoteNotification:userInfo withController:[[UIApplication sharedApplication] keyWindow].rootViewController];

If you need to handle badge reset in the application icon, you can do something like below in the applicationDidBecomeActive: delegate method:

- (void)applicationDidBecomeActive:(UIApplication *)application
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

In-app notifications

Applicable to SDK version 2.4.0-rc-1 and above

In-app notifications are similar to Apple's push notification banners. Unlike push notifications, they appear within your app when it is in use by the user.

These notifications are sent when an agent replies to a customer's issue. Your customers can click on these banners to go straight into the conversation screen.

In-app Notifications on iOS 7

iOS Simulator Screen shot 16-Sep-2013 2.42.30 PM.png

iOS Simulator Screen shot 16-Sep-2013 2.42.55 PM.png

iOS Simulator Screen shot 16-Sep-2013 2.43.07 PM.png

In-app Notifications on iOS 6




Configuring in-app notifications

The Helpshift install call supports flags for configuring the SDK's behaviour. Currently we support one flag i.e enableInAppNotification or you can use macro HS_ENABLE_IN_APP_NOTIFICATION in HelpshiftCocos2dx.h file.

In-app Notification flag

Applicable to SDK v4.0.0 & above

"yes" or "no" (CCString)

If you do not want the in-app notifications support provided by the Helpshift SDK, please set this flag to "no". The default value of this flag is "yes" i.e in-app notifications will be enabled.


For cocos2d-x 3.x

ValueMap config;
config[HS_ENABLE_IN_APP_NOTIFICATION] = Value("yes");


For cocos2d-x 2.x

cocos2d::CCDictionary *config = new cocos2d::CCDictionary();
config->setObject(new CCString("yes"), HS_ENABLE_IN_APP_NOTIFICATION);


Pausing In-app notifications

Applicable to SDK v4.3.0 & above

If you have enabled in-app notifications, use the API pauseDisplayOfInAppNotification to pause/resume the notifications. When true is passed to this method display of in-app notifications is paused even if they arrive. When you pass a false, in-app notifications start displaying.



Showing notification count when replies are sent to the user

If you want to show your user notifications for replies on the issues posted, you can get the notification count synchronously from cache. Example:-

int notifCount = HelpshiftCocos2dx::getNotificationCountFromRemote(true);