If push notifications without parameters arrive successfully, but those with custom parameters fail, the issue is often caused by exceeding the maximum payload size allowed by push notification gateways (APNs for iOS and FCM for Android).
Common Cause: Payload Too Large
Push notification gateways typically have a strict payload limit (e.g., 4KB). If your request exceeds this limit, the gateway rejects the message with a PayloadIsTooLarge error.
This frequently happens when the same custom data is duplicated across multiple platform-specific fields in the API request.
Example of problematic configuration: In your API request, you might be sending the exact same large dataset (e.g., user info, labels) inside multiple parameters like:
* android_root_params
* huawei_android_root_params
* ios_root_params
* Platform-specific data fields inside the above
Additionally, Unicode escaping in these fields can significantly increase the character count (up to 6 times the original size), pushing the payload over the limit.
Solution: Optimize Your Data Structure
To resolve this, avoid duplicating data for each platform. Instead, use the unified data object at the root level of your API request.
Recommended approach:
1. Remove the custom data from platform-specific fields (android_root_params, ios_root_params, etc.).
2. Place your custom parameters into the general data object, which is located at the same level as content and send_date.
Pushwoosh automatically delivers the content of the global data object to all platforms. This change can reduce your request size by 3-4 times, ensuring it stays within gateway limits and is successfully delivered.
Comments
0 comments
Please sign in to leave a comment.