techaffinity / freshchat-phonegap

Freshchat sdk for phonegap
7 stars 36 forks source link

freshchat-phonegap sdk displays another plugin push message #10

Closed Jeyakumarrathnaselvi closed 5 years ago

Jeyakumarrathnaselvi commented 6 years ago

We are using freshchat-phonegap and onesignal sdk in our mobile app

freshchat-phonegap is handling and displays the notification sent from onesignal portal.

As per documentation, freshchat-phonegap is not supposed to display push messages other than received from freshchat portal but it displays?

It is raised as per the discussion with freshchat team.

https://github.com/techaffinity/freshchat-phonegap

We followed the steps as mentioned in above documentation section 2. Alternate Option for Push

techaffinity commented 6 years ago

1) Did you integrate both the freshchat-phonegap and one signal for push notification configuration? 2) As you aware of the freshchat-phonegap is normal push notification plugin handle notification sent from Apns and GCM or FCM portal. With support of handle freshchat specific notification in background is newer feature added in this push notification.

Jeyakumarrathnaselvi commented 6 years ago

Please refer our reply

  1. Yes we integrated both freshchat and onesignal plugin

  2. Do you mean below step mentioned part of your steps. if yes . We have added already

https://github.com/techaffinity/freshchat-phonegap

  1. Alternate Option for Push Follow the steps below if your app handles push notifications using any other plugin.

2a. Pass device token to Freshchat When you receive a deviceToken from GCM or APNS , you need to send the deviceToken to Freshchat as follows API name has changed for passing the token since version 1.2.0.

// Example illustrates usage for phonegap-push-plugin push.on('registration',function(data) { window.Freshchat.updatePushNotificationToken(data.registrationId); }); 2b. Pass the notification to Freshchat SDK Whenever the app receives a push notification, check and pass the notification to Freshchat SDK

// Example illustrates usage for phonegap-push-plugin push.on('notification', function(data) { window.Freshchat.isFreshchatPushNotification(data, function(success, isFreshchatNotif) { if( success && isFreshchatNotif ) { window.Freshchat.handlePushNotification(data.additionalData); } }); });

techaffinity commented 6 years ago

Above integration are correct for configure the freshchat notification handling in push notification. You must use any one of the plugin for push notification either freshchat-phonegap or one signal. UpdateNotification on registration Token: window.Freshchat.updatePushNotificationToken(data.registrationId);

HandlePushNotification on receive notification :

window.Freshchat.isFreshchatPushNotification(data, function(success, isFreshchatNotif) { if( success && isFreshchatNotif ) { window.Freshchat.handlePushNotification(data.additionalData); } });

Jeyakumarrathnaselvi commented 6 years ago

Do you mean we can call these functions(window.Freshchat.updatePushNotificationToken(data.registrationId);) inside onesignal then we can handle freshchat message?