customerio / customerio-expo-plugin

MIT License
11 stars 9 forks source link

Push deep links not working when using multiple push notification modules (ie `expo-notifications`) #83

Closed wanschi closed 9 months ago

wanschi commented 1 year ago

Hello,

I have integrated the Customer.io Expo SDK. It seems like everything is working.

What does not work though are deep links. Deep links "dry" launch the app too (tested with uri-scheme), but not with a Customer.io push notification. Also, Linking.useURL() is not triggered after I receive a push notification and launch the app. I always end up in the homescreen of the app.

I have also tried debugging the whole thing via Swift. But it seems like it doesn't jump into the code for the deep links at all.

"expo": "~48.0.18", "customerio-expo-plugin":"^1.0.0-beta.10", "customerio-reactnative": "2.4.0",

(Unfortunately, the latest version of customerio-reactnative does not work for us).

Thank you

ami-aman commented 1 year ago

Hi @wanschi

Thanks for reaching out and apologies for the inconvenience caused.

I would like to let you know that this is a known issue with our expo plugin. We are actively working on improving our plugin, but I'm unable to provide a specific timeline for the resolution at this moment. Rest assured I will make sure to raise this with our team internally and get the fix out of the door soon. Your patience and understanding are greatly appreciated.

Meanwhile, let us know if you have any other issues.

wanschi commented 1 year ago

@ami-aman Thanks for your reply. Please let me know if we can support you.

heuels commented 1 year ago

Following! We at @on-deck would also love to use deep links from the CIO push notifications.

dgsunesen commented 1 year ago

Same here. Deep link support would be awesome.

@wanschi if I may ask you a question? Do you receive Customer.io push notifications when your app is foregrounded? Currently I only receive them when the app is backgrounded.

wanschi commented 1 year ago

@dgsunesen Yes, same here. We're only receive them in the background. After opening them you'll end up on the first screen. In our case this is the left item in the root tab bar.

@ami-aman Can you give us a rough estimation. Since our plan is to release in 3 weeks we'll need to know if we need to switch to another push notification solution.

dgsunesen commented 1 year ago

@ami-aman Just FYI, I'm in contact with your Technical Support Engineers who promised me to reach out to you guys (Mobile team) on an ETA on when this could be fixed :)

We're also planning on releasing a new version of our app including Customer.io, but not being able to receive push notifications while app is foregrounded as well as deep links not working properly could be quite the party killer for us :(

I do want to extend a huge gratitude towards you and your team β€” it's really awesome that you got the compatibility issues fixed with expo-notifications πŸ™πŸΌπŸ•Ί

ami-aman commented 1 year ago

@wanschi @dgsunesen Thank you for reaching out and sharing your concerns. I completely understand the frustration caused by the current issues with push notifications and deep links in you app. Please rest assured that our Mobile team is actively working on resolving these issues to provide a seamless experience for our users.

I appreciate your proactive approach in contacting our Technical Support Engineers, who are in direct communication with our Mobile team. While we don't have a specific ETA at the moment, I want to assure you that addressing these issues is our top priority. We are aiming to have the fixes implemented by the end of next week. I will make sure to update you as soon as we release the fix.

However, I want to be transparent and avoid providing a hard timeline at this point. Our team is working diligently to resolve these issues as quickly as possible, but we want to ensure that the solutions are thoroughly tested and reliable before releasing them to our users.

I apologize for any inconvenience caused, and I genuinely appreciate your patience and understanding.

ami-aman commented 1 year ago

@dgsunesen

I do want to extend a huge gratitude towards you and your team β€” it's really awesome that you got the compatibility issues fixed with expo-notifications πŸ™πŸΌπŸ•Ί

πŸŽ‰ πŸŽ‰ πŸŽ‰ Thank you for your gratitude and positive feedback! We are committed to continuously improving our product to make our customers' lives easier. Your support is greatly appreciated.

dgsunesen commented 1 year ago

@ami-aman What's the status on this one? :)

ami-aman commented 1 year ago

Hi @dgsunesen

Our team is working on this issue and we expect the fix to be released either end of this week or early next week. We are trying our best to get this fix out of the door as soon as possible.

I will make sure to update this conversation once the fix has been released. Let me know if you have any other question or suggestion for us.

Apologies for the inconvenience.

wanschi commented 1 year ago

@ami-aman Hello, are there any updates on the timeline?

Thanks for your work guys!

ami-aman commented 1 year ago

Hi @wanschi Our team has been working hard on this issue, and I am happy to report that we've made significant progress. We've developed a fix that we believe will resolve the issue. We're currently testing the fix internally and we're planning to release the fix in the next few days.

I apologize for the delay in getting this fix to you. I know that this issue has been causing you some inconvenience, and I appreciate your patience.

I will you updated on the release of the fix. In the meantime, if you have any questions, please don't hesitate to contact us.

ami-aman commented 1 year ago

@wanschi I'm excited to that the fix for deeplinks has been successfully deployed in release version 1.0.0-beta.13. This fix introduces a new configurable property named handleDeeplinkInKilledState and can be used as :

"ios": {
            "handleDeeplinkInKilledState": true,
            "pushNotification": {
             .
             .
             .
            }
       }

You can read more about the fix in our docs here.

Thank you for your understanding throughout this process. I am closing this ticket for now. Should you have any inquiries, please feel free to re-open the ticket and reach out to us at any time.

dgsunesen commented 1 year ago

@ami-aman Great stuff! Does this also include receiving notifications when the app is foregrounded? I know @wanschi and his team experienced the same issue where you'd only receive notifications when app is backgrounded.

Great job! Will definitely get this tested.

ami-aman commented 1 year ago

@dgsunesen Yes, this release also addresses the issue where you can now receive notifications when the app is in foreground.

Add a property ios. handleNotificationClick to app.json or app.config.js to make use of the feature. More about the configurable properties can be found here in our docs.

Thank you for your patience and cooperation while we worked on the fix release. We appreciate your understanding. Please let us know if you have any further questions or concerns.

dgsunesen commented 1 year ago

@ami-aman This is nice! I will definitely get back if I see any issues.

Do you by any chance have any discord or slack channel where to reach you guys ?

ami-aman commented 1 year ago

@dgsunesen I would appreciate feedback. Thank you ! :)

We do not have a discord or slack channel but you can reach to us on win@customer.io or create a ticket on Github.

dgsunesen commented 1 year ago

@ami-aman All right, so I tested this, and here is what I found πŸ‘‡

Receiving notifications with the app both foregrounded/backgrounded + deep links only seem to work if we have the following enabled in our app.config.ts file:

ios: {
  handleDeeplinkInKilledState: true
  handleNotificationClick: true 
}

I cannot get deep links working if I only have handleDeepLinkInKilledState enabled. Also, by enabling handleNotificationClick this now means that notification click handler / event listener for all our expo-notification notifications no longer work, such as receiving a chat message and being able to direct the user directly to that specific chat room by tapping the notification we sent.

Isn't there any way we can have both event listeners work in parallel?

ami-aman commented 1 year ago

@dgsunesen Thanks for testing out the fix. I really appreciate it.

Unfortunately, expo-notifications does not work well when setting the delegate for UNUserNotificationCenter. Our package needs to have this delegate set for certain features, such as to show push notifications in foreground etc.

We have introduced a few JavaScript methods for tracking push metrics that help expo-notifications and our package run in parallel. We are also working on bringing more features to let both libraries run together without any interference. However, we do not have any workaround to let both event listeners work in parallel at this time.

Your observation regarding notifications in the foreground is accurate: enabling handleNotificationClick to true will indeed result in notifications being received while the app is in foreground but this might conflict with expo-notifications. We are constantly working on making our plugin better and introducing features that will help address this inconvenience.

dgsunesen commented 1 year ago

@ami-aman I see. It would really be a killer feature to be able to do this, as we are so deeply dependant on the notifications we are already sending out using expo-notifications. Also, using Customer.io and be able to send engagement content via push notifications and be able to actually deep link to certain places in the app is quite crucial for our business, so I indeed think this is something that needs to be addressed.

I know it works when using Intercom in parallel with expo-notifications β€” I've tested it a bit there. Though it only seems that the push notification arrives when the app is backgrounded, however, deep links are indeed working. Perhaps you could get some inspirations from there?

https://github.com/intercom/intercom-react-native

Config plugin we use: https://github.com/cmaycumber/config-plugin-react-native-intercom

berkcoker commented 1 year ago

Deeplinks do not work for us with these configurations. It actually only works when the app is in killed state. Seems like there's an issue with handleNotificationClick

ami-aman commented 1 year ago

@dgsunesen I appreciate your interest in our plugin and for sharing the reference plugin. We understand that you have specific requirements, and we are constantly working to improve the plugin to meet those requirements. I will pass your feedback on to the team.

Again, thank you for your feedback. It helps us to improve our products and services. Your feedback is immensely helpful to us.

ami-aman commented 1 year ago

@berkcoker Apologies for the inconvenience. Could you please confirm if you have followed the steps as mentioned in our docs?

berkcoker commented 1 year ago

Yes followed the instructions and can confirm that the deep links are working (both when the app is killed and when I try to open the link from the Notes app). The issue seems to be that background responses (notification taps) don't trigger the desired event for the listener. Sidenote: we use expo-notifications for local notifications but don't rely on their listeners. When I tried to disable CustomerIO's handleNotificationClick and tried to rely on Expo Notifications that didn't work either

dgsunesen commented 1 year ago

@ami-aman as Expo seems to be more and more adopted I would highly recommend that it could be working seamlessly together with that as well, as I could see many would rely on expo-notifications for local notifications in combination with something like customer.io :)

levibostian commented 1 year ago

Hello, I am a teammate of Aman's. I'll try to help in this issue as well.

The handleNotificationClick feature in our Expo plugin is only useful when Customer.io is the only push notification module that you are using in your app. handleNotificationClick will tell our Expo plugin that the Customer.io SDK should be the module that handles all push notification interactions and no other module.

It seems as though both of you are using expo-notifications. This is a module that also can interact with notifications in your app. Unfortunately, only 1 module is able to be the handler of push notification interactions. This is a limitation set by iOS. From working with customers, we have seen that it is best to make expo-notifications the handler and therefore, make sure to set handleNotificationClick to false.

When another module, such as expo-notifications, is responsible for handling push notification being delivered and clicked, your setup with the Customer.io SDK requires a couple more steps since it is no longer handling the clicks. U

Use expo-notification listeners to listen for push events in your app. Specifically, when a push is received on the device and when a push is clicked on the device.

I hope that this helps give clarity to the use of handleNotificationClick.

levibostian commented 1 year ago

In regards to the use of handleDeeplinkInKilledState, this feature is designed to add more stability to deep link handling when your app is in the killed state. This feature should not interfere with the unrelated handleNotificationClick feature.

Are you using Expo's linking module for deep link handling in your app?

dgsunesen commented 1 year ago

@levibostian Yup we're using the Linking module to handle deep linking :)

levibostian commented 1 year ago

Great, thank you for sharing that.

We have internally logged this issue with deep links not getting opened on a Customer.io push when multiple SDKs are installed. Unfortunately, I cannot share estimates for when we are able to ship a fix for this.

I'll re-open this issue to help track when this issue becomes resolved. Thank you again for all who have been involved in helping us better understand this issue.

dgsunesen commented 1 year ago

@levibostian Any progress on this issue?

levibostian commented 1 year ago

Thanks for the patience and cooperation, @dgsunesen.

This issue is more complex then we originally anticipated. I don't have dates to share with you today, except for the fact we are working on this.

levibostian commented 1 year ago

I am happy to share that I have a prototype for this feature and would greatly appreciate feedback on it.

There are so many environments to test against with an Expo app. We greatly appreciate everyone able to help us with testing!

We are looking for multiple people to install this prototype code into their app, test that the Customer.io SDK and expo-notifications both work as intended. We expect that that both libraries are more compatible together by this new feature.

Note: The feature is in an unstable prototype condition at the moment. We do not suggest running this code in production. It's purpose is for testers to test it to see if they get the desired outcome. After testing concludes, we will move forward with the next steps making this feature stable.

How to install

Install Expo plugin from git branch:

The prototype only works with 1 specific version of the React Native SDK. Make sure your package.json file contains this line exactly as below:

"customerio-reactnative": "3.1.12",

Here is an example plugin configuration that has been tested internally:

    "plugins": [
      [
        "customerio-expo-plugin",
        {
          "android": {
            "googleServicesFile": "./files/google.json",
            "setHighPriorityPushHandler": true
          },
          "ios": {
            "pushNotification": {
              "useRichPush": true,
              "env": {
                "siteId": "put your site id here",
                "apiKey": "put your api key here",
                "region": "us"
              }
            }
          }
        }
      ],

How to test

In your email, please include....

Thank you! Have an awesome day.

dgsunesen commented 1 year ago

@levibostian Wow! This sounds promising! I'll make sure to get this tested with our setup :)

LeonRueda commented 1 year ago

Hi πŸ‘‹ We started using CustomerIO since before the summer and I feel this has added a lot of value to our setup. I don't want to make a lot of noise here, but I ran into this problem for the last month, I think this is something that can be more clear in the docs, actually I stumble by accident in this issue... A good first point would be to clarify that those flags are needed if you use expo-notificatiosn and that they will impact other modules handling push notifications, I mean handleDeeplinkInKilledState and handleNotificationClick. And perhaps a clarity note like I have seen for other points in the docs where you are pretty clear about tradeoffs or improvements that you are working on... Now that I fixed my problem with those I'm trying to make the proposed Test to work in our staging app. About the docs: is there any way people can contribute to those?

levibostian commented 1 year ago

Thank you for the feedback, LeΓ³n. Our team is currently working on making improvements to this feature. We hope that when shipped, the issues that everyone is encountering in this issue become resolved.

is there any way people can contribute to those?

Yes! You can give suggestions while you browse a webpage. See this screenshot for how to find this form:

CleanShot 2023-11-13 at 08 38 26@2x

levibostian commented 9 months ago

Happy to announce the latest Customer.io Expo plugin release 1.0.0-beta.14 includes increased compatibility with expo-notifications for reporting opened push metrics as well as deep links being launched when a push is clicked.

We hope you enjoy this new feature!