Skip to main content
Solved

Hybrid - Push notification Not Working in Production


Forum|alt.badge.img+2

Hi, we have a hybrid application - Ionic React from which i wanted to implement Klaviyo push notification. 

Take note, push notification is already working on our app and i just want to add klaviyo push notification without using the SDK. 

These are the steps i did to make it work:
1. Get permission (Done already as we can receive our own push notification)
2. Create or Update Push token (Done Via - https://developers.klaviyo.com/en/reference/create_client_push_token)
     - Ive used platform = ios and, vendor = FCM as we’re using Firebase to make our push notif work. 

Result: Mobile push notifications enabled on a user profile. And user can be added in a segment where filter is all users that can receive push notification.

Issue: I keep getting Bounced Push, with error: 

The specified device token was bad. Verify that the request contains a valid token and that the token matches the environment.

Error Name: BadDeviceToken

Even though its the same token we’re using in our project and it works on our end. 

 

Best answer by markpiana

Since sending to iOS through FCM is not currently supported, my hunch is that that is the cause of the issue somehow, but it is hard to troubleshoot this problem without more specific information about your account. If you haven’t yet, I would recommend creating a Klaviyo Support ticket, so we can take a look at your account and more thoroughly help you triage this issue. https://www.klaviyo.com/support

View original
Did this topic or the replies in the thread help you find an answer to your question?

10 replies

markpiana
Klaviyo Employee
Forum|alt.badge.img+4
  • Klaviyo Employee
  • 25 replies
  • November 14, 2023

Hi @jemantilla ,

Klaviyo does not currently support sending iOS push notifications through FCM. All iOS push notifications are routed through APNs. Therefore, when you try to send to an iOS device using an FCM token, APNs flags the token as invalid, and Klaviyo removes the token from the profile.

To send push notifications to iOS devices, you will need to follow the steps in our guide for setting up iOS push notifications, including uploading your APNs authentication key in your Klaviyo account settings. Plus, when you send iOS tokens to Klaviyo via the API, you will need to set the vendor to APNs. 

I hope that helps!

 

Thanks,

Mark


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 6 replies
  • November 15, 2023
markpiana wrote:

Hi @jemantilla ,

Klaviyo does not currently support sending iOS push notifications through FCM. All iOS push notifications are routed through APNs. Therefore, when you try to send to an iOS device using an FCM token, APNs flags the token as invalid, and Klaviyo removes the token from the profile.

To send push notifications to iOS devices, you will need to follow the steps in our guide for setting up iOS push notifications, including uploading your APNs authentication key in your Klaviyo account settings. Plus, when you send iOS tokens to Klaviyo via the API, you will need to set the vendor to APNs. 

I hope that helps!

 

Thanks,

Mark

Hello, so i’ve tried that. I’m still getting BadDeviceToken on ios. For android it says “Received Push” but i actually don’t receive anything on my app. Anything else i need to consider? 


markpiana
Klaviyo Employee
Forum|alt.badge.img+4
  • Klaviyo Employee
  • 25 replies
  • November 15, 2023

Just to confirm, are you using an APNs token for iOS and still getting that error? If you’re using an FCM token, that won’t work. If you are using an APNs token, make sure that you are using a token for the correct environment. If your app is in production (i.e., in the App Store or TestFlight), you have to use a production token. If you’re using a debug build, you should use a sandbox token. 


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 6 replies
  • November 15, 2023

Yes, I’ve done that. I know its the right token cause it’s the same token we use to send push notif and our push notif works so it’s quite weird that its not working now. To give more context we use FCM on our app to receive push notifications but for token in IOS we use APNs. 

Also it’s deployed in production.


markpiana
Klaviyo Employee
Forum|alt.badge.img+4
  • Klaviyo Employee
  • 25 replies
  • November 15, 2023

Just confirming again, have you updated the tokens in Klaviyo to be platform = ios and vendor = apns?


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 6 replies
  • November 16, 2023

Yes, it’s “ios” and “APNs”


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 6 replies
  • November 16, 2023

I also tried using both FCM token and APNs token with vendor being “APNs” and platform “ios”. Both are not working on our production.

Preceding steps was:
1. Get push notification permission
2. Setup FCM configuration in ios and android to use files from Firebase for push notification. 
3. Uploaded APN authentication key in ios settings.
4. APN auth key on our firebase is the same key i’ve uploaded


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 6 replies
  • November 16, 2023

-


markpiana
Klaviyo Employee
Forum|alt.badge.img+4
  • Klaviyo Employee
  • 25 replies
  • Answer
  • November 16, 2023

Since sending to iOS through FCM is not currently supported, my hunch is that that is the cause of the issue somehow, but it is hard to troubleshoot this problem without more specific information about your account. If you haven’t yet, I would recommend creating a Klaviyo Support ticket, so we can take a look at your account and more thoroughly help you triage this issue. https://www.klaviyo.com/support


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 6 replies
  • November 17, 2023

Thank you!