customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

CustomerIO and Intercom push notifications #192

Closed SYoder1 closed 12 months ago

SYoder1 commented 12 months ago

SDK version: 3.1.8

Are logs available?

Describe the issue We have Intercom setup, and after setting up the CIO sdk, my Intercom notifications are not showing any more. I fixed it on Android with a similar way to #120, but ios they just disappear.

Intercom says they safely swizzle the public methods in UIApplicationDelegate that handle receiving push notifications. This was the part I think that stoped working, so I disabled this and tried to do something like this in my AppDelegate.mm, but didReceiveNotificationResponse never gets called.

- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
  NSDictionary *userInfo = response.notification.request.content.userInfo;
  if ([IntercomModule isIntercomPushNotification:userInfo]) {
    [IntercomModule handleIntercomPushNotification:userInfo];

    completionHandler();
  }
  else {
    [pnHandlerObj userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
  }
}

Screenshots

Additional context

I followed the setup guide exactly, and used the same names for everything. I am using APNS

SYoder1 commented 12 months ago

@Shahroz16 đŸ‘€

Shahroz16 commented 12 months ago

@SYoder1 we are looking into this now, can you tell us a bit more about your setup?

Intercom says they safely swizzle the public methods in UIApplicationDelegate that handle receiving push notifications.

The method you mention userNotificationCenter is not used for receiving push notifications but it is called when you click/interact with the push notification.

Did you add a notification service extension to handle rich push?

SYoder1 commented 12 months ago

Do you want to use push notifications from both Intercom and CIO?

Yes, Intercom will send push notifications when an agent responds to the chat. With intercom there is no way to pass in the notification from the JS layer, so the handle multiple push providers section in the docs, doesn't work.

What kind of push notifications are you using simple or rich push (push with images/deep link)?

We are wanting to use rich notifications with deep links.

Did you add a notification service extension to handle rich push?

Yes I do have the extension setup, I just follow the docs setting it up. For userNotificationCenter, that would make sense why it didn't do anything then.

Shahroz16 commented 12 months ago

After looking into the provided context and a little Intercom documentation. Seem like the Intercom setup shouldn't really be affected by the CIO unless you are missing something like sending a device to them etc.

I am not sure why you are not receiving push notifications when sent from the intercom when you haven't changed their implementation, which I assume was working before.

So I can't advise much on this. You will need to reach out to Intercom regarding this. But if there is something with CIO notifications that's not working, feel free to reach out.

SYoder1 commented 12 months ago

Hey @Shahroz16, thanks for the response and all your help! I will reach out to them and see if they can thing of what might be wrong.

One last question, on android, my app restarts any time I press on any push notification (simple and rich). I have android:launchMode="singleTask" in the manifest file, but it seems to not be doing anything.

Shahroz16 commented 12 months ago

Awesome, reaching out to them would surely resolve it.

Regarding

my app restarts any time I press on any push notification (simple and rich)

This is a known behaviour at the moment, we do it to make sure deep links are always working but we working on improving the experience so it doesn't restart like this and will be starting work on it soon.

SYoder1 commented 12 months ago

Gotcha, thats really a bummer. Is there a timeline on when that will get improved?

Thanks again for all your help!

Shahroz16 commented 12 months ago

Can't really commit to the timeline, but rest assured the development might start as early as next week if everything goes accordingly. Thank you for your patience.

I am closing this ticket, feel free to create a new one in case you have more questions.