All of the notifications generated by Helpshift have an “origin” key in the payload which has a value “helpshift”. You can check for this key value in your notification receive delegate and pass on the payload to Helpshift SDK to handle the notification . Helpshift SDK will take the user to the appropriate landing screen (Conversation Screen / Campaign screen).

Example code for iOS

Whenever a push notification is received, the application delegate didReceiveRemoteNotification: gets called. You can check the “origin” field of the notification dictionary and call Helpshift’s handleRemoteNotification:withController: API if the origin of the notification is “helpshift”.

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
if ([ [userInfo objectForKey:@"origin"] isEqualToString:@"helpshift"]) { [HelpshiftCore handleRemoteNotification:userInfo withController:self.viewController]; }
else

{ // app handles the notification }
}
<‘code>

For more detailed information, please see our developer documentation on configuring the Helpshift SDK.

Example code for Android

You can check for the “origin” key in GCM’s onMessageReceived callback, which is called whenever a notification arrives:

@Override
public void onMessageReceived(String from, Bundle data) {
String origin = data.getString("origin");
if (origin != null && origin.equals("helpshift"))

{ Core.handlePush(this, data); }
else

{ // app handles the notification }
}
For more detailed information, please see:

https://developers.helpshift.com/android/notifications/#configure-helpshift-android-sdk

In case you need info about full payload, please find below the format for push notifications for support and Campaigns. The common factor in both type payloads is the “origin” key. The SDK decides whether a notification is for Support or a Campaign by looking at the rest of the data in the payload.

1. Campaign payload:

For Android:

{“origin” : “helpshift”, “hsp.a” : 8, “hsp.d” : “test.json”, “alert” : “See single section”, “cid” : “campaign_id_3”}

For iOS:

{"origin" : "helpshift", "aps":{"alert": "Your message goes here" ,"cid" : "test", "hsp.a": 8, "hsp.d" : “test.json”}}

2. Support payload:

For Android:

{"origin" : "helpshift", "app_name" : “Test App", “issue_id”:”test_issue_1”, “alert”:”test message”}

For iOS:

{"origin" : "helpshift",”issue_id" : “test_issue_1”, "aps":
{"alert": “test message" , “badge" : “1”, “sound”:”default”}
}