- Newest
- Most votes
- Most comments
The issue you're encountering with APNs VoIP notifications using Amazon Pinpoint message templates is likely due to the way push notification templates are structured in Pinpoint.
When using a standard push notification template in Pinpoint, you don't have direct control over the apns-push-type header, which is crucial for VoIP notifications. Standard templates are designed for general push notifications and don't support specifying VoIP-specific headers.
To resolve this issue, you should use a raw message template instead of a standard one. Raw message templates allow you to specify the exact payload to be sent, including all necessary headers for VoIP notifications.
Here's how you can approach this:
- Create a new push notification template in Pinpoint.
- Instead of using the standard message option, choose to create a template with raw message data.
- In the raw message payload, include your entire APNs message structure, including the
apns-push-typeheader.
Your raw message template might look something like this:
{ "default": { "alert": { "title": "Someone calling", "body": "Someone is calling." }, "content-available": 1, "mutable-content": 1, "sound": "default", "apns-push-type": "voip", "apns-priority": 10 } }
When using this template with the Pinpoint Java SDK, make sure to set it as a raw message payload. This way, Pinpoint will send the exact payload you've specified, including the necessary apns-push-type header for VoIP notifications.
Remember that when using raw message templates, you're responsible for ensuring that the payload is correctly formatted for each push notification service you're targeting. In this case, you're specifically formatting it for APNs VoIP notifications.
By using a raw message template, you should be able to avoid the "InvalidPushType" error and successfully send APNs VoIP notifications through Amazon Pinpoint.
Sources
Creating push notification templates - Amazon Pinpoint
APNSPushNotificationTemplate.Builder (AWS SDK for Java - 2.21.29)
Relevant content
asked 2 years ago
