Skip to content

InvalidPushType error with APNs VoIP notifications using Amazon Pinpoint message templates

0

I'm trying to send APNs VoIP notifications using the Amazon Pinpoint Java SDK and a message template, but I keep receiving an "InvalidPushType" error. Here’s the schema I'm using for the notification:

{
    "APNSMessage": {
        "aps": {
            "alert": {
                "title": "Someone calling",
                "body": "Someone is calling."
            },
            "content-available": 1,
            "mutable-content": 1,
            "sound": "default",
            "apns-priority": 10
        },
        "apns-push-type": "voip"
    }
}

Observations:

  • This schema works fine when tested as a raw message in Pinpoint's test messaging tool.
  • However, when I try to use this schema in a message template and send it, I receive the following error:
EndpointResult: {22345-f81d-4564-99d5-1235675555={Address: 6235399999fac913300303333333, DeliveryStatus: TEMPORARY_FAILURE, StatusCode: 503, StatusMessage: {"errorMessage":"Channel Provider Exception","channelType":"APNS_VOIP_SANDBOX","pushProviderStatusCode":"400","pushProviderError":"Unknown error code: InvalidPushType","pushProviderResponse":"{\"reason\":\"InvalidPushType\"}"}}}

Has anyone encountered this issue or know how to fix it when using a message template? Is there a specific configuration needed for APNs VoIP notifications to work with Amazon Pinpoint templates?

asked 2 years ago179 views

1 Answer
0

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:

  1. Create a new push notification template in Pinpoint.
  2. Instead of using the standard message option, choose to create a template with raw message data.
  3. In the raw message payload, include your entire APNs message structure, including the apns-push-type header.

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)

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.