Issue with Expo's Online Push Notification Tester

when i send a post request via Postman with a basic push notification payload, it works great and triggers the listener in my app…

however, when i send that same payload via the form at the link below, it fails to trigger the listener

i am on expo v25

Could you please provide more precise details to identify the issue?

thank you @ide … i suspect that the reason the form is not working, is the same reason why my programmatic network requests are not working… please see this recent Expo forum post.

expo v25
ios 11.1
expo ios client app @ latest

in Postman and/or cURL, it works great, even when the headers are incomplete:

method: 'POST',
headers: {
 'Content-Type': 'application/json'
}

on a side note, as per docs, complete headers should be:

method: 'POST',
headers: {
 'Content-Type': 'application/json',
 'Accept': 'application/json',
 'Accept-Encoding': 'gzip, deflate'
}

In Postman, this is what I am sending over as “raw” data:

{
	"to": "ExponentPushToken[...omitted for security reasons...]",
    "body": "push notification test"
}

and it works perfectly, every time, no issues. Anyway, below is what I think you are asking for:

My app’s dependencies…

"dependencies": {
    "axios": "^0.16.2",
    "expo": "^25.0.0",
    "moment": "^2.20.1",
    "react": "16.2.0",
    "react-apollo": "^1.4.8",
    "react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz",
    "react-native-dotenv": "^0.1.0",
    "react-native-indicator": "^0.7.0",
    "react-native-is-iphonex": "^1.0.1",
    "react-native-keyboard-aware-scroll-view": "^0.4.3",
    "react-native-modal": "^2.5.0",
    "react-native-swiper": "^1.5.13",
    "react-navigation": "^1.1.2",
    "react-redux": "^5.0.6",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0",
    "subscriptions-transport-ws": "^0.8.2",
    "underscore": "^1.8.3"
  }

My app’s syntax…

componentDidMount(){
    this.registerForPushNotificationsAsync()
  }

  componentWillUnmount() {
    this.notificationSubscription && this.notificationSubscription.remove()
  }
  
  async registerForPushNotificationsAsync(){
    const { status } = await Permissions.getAsync(Permissions.NOTIFICATIONS)
    if (status === 'granted') {
      this.getPushToken()
    } else {
      let { status:newStatus } = await Permissions.askAsync(Permissions.NOTIFICATIONS)
      newStatus === 'granted' ? this.getPushToken() : this.updatePushTokenInDb(null)
    }
  }
  
  async getPushToken(){
    let token = await Notifications.getExpoPushTokenAsync()
    token && this.updatePushTokenInDb(token)
  }
  
  updatePushTokenInDb(token){
    // omitted from expo forum
  }
  
  createNotificationSubscription(){
    this.notificationSubscription = Notifications.addListener(
      this.handleNotification
    )
  }

  handleNotification = (notification) => {
    console.log(notification)
  }

Fields that I’m filling out in your form:

EXPO PUSH TOKEN (FROM YOUR APP): ExponentPushToken[...omitted for security reasons...]
MESSAGE TITLE: my title
MESSAGE BODY: my message
PLAY SOUND: checked // fails whether checked or unchecked
JSON DATA: {"any": "any"} // fails whether blank or populated
TTL (SECONDS): 0 // fails whether blank, or numbers  >=  0
BADGE COUNT: 1 // fails whether blank, or numbers  >=  0
CONTENT AVAILABLE (for background update notifications): checked // fails whether checked or unchecked

I think it would be helpful if this form parsed the following type of response under the checked green button so there’s more programmatic visual confirmation:

{
  "data": [
    {"status": "ok"}
  ]
}

but again, i suspect that the reason that the form is having trouble either posting the request, or triggering expo’s Notifications.addListener, is very related to the other issue i’m having with failed POST requests at your Push API’s endpoint. Please visit this expo forum post for more details.

Important Side Note Question…
For the field in your test form labeled “CONTENT AVAILABLE (for background update notifications)”, to which object field does this correlate to in the outbound message format defined at the link below???
https://docs.expo.io/versions/v25.0.0/guides/push-notifications.html#message-format

The notification dashboard checks for a receipt with {"status": "ok"}. Could you check in your browser’s console to see if the webpage has an error when sending the notification?

Re: content available: this is a private field that is corresponds to APNs’s content-available field.

just want to confirm though… the content-available field is not listed as an exposed field in the Expo docs, but is listed/allowed in the online form? according to APNS, this could be useful if exposed/allowed in Expo’s push api… perhaps it already is, i will run a quick test myself to see if it’s supported

but back to the main point… the form seems to be working fine now… for the record, no code/syntax on my end has been changed, so i’m not sure what’s different about my successful tests now, versus my failed attempts a few days ago… perhaps APNS throttling? if so, my apologies for the false alarm. there were no visible network issues on my end either, so again, it’s a mystery.

so… tests showing everything works as expected for my manual tests (cURL, Postman, Your Online Push Tool), but programmatic tests still seem to be failing… some advice/guidance on my failed programmatic tests over at Push Notification Endpoint Issue with My Post Requests would help a ton, thanks so much in advance, much love for all you and Expo have done for the community

Yes, the content-available field is not part of Expo’s public API and may change at any time. It’s in the testing dashboard just for debugging.

We didn’t make any changes to the service and, to reaffirm, when you get back {"status": "ok"}, that means Apple successfully received your push notification and there is nothing more for you nor Expo to do at that point.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.