Being notified when a push token is rejected

Hi,

In the FAQ I read the following :

The system removes the devices after sending push notifications message as soon as Push Notifications Provider rejects the push notification token.

So Pushwoosh servers are notified when we want to send a push notification to a device registered with an invalid push token.

Do you provide (or planned to provide) a functionnality to be notified when a push notification token is rejected by a Push Notification provider ?

For example we could enter an HTTP URL like 'http://myserver.com/pushwoosh/rejected-token-enpoint' in the Pushwoosh administration GUI.

Then each time the Pushwoosh server encounter a rejected token it would send us a JSON payload with all the informations associated to the removed device / push token.

This would allow us to clean our devices database.

I'm not really sure but it seems that for the moment we have only 2 solutions to deal with invalid tokens, is this right ?

  • Keep invalid tokens / devices in our database indefinitely, its not perfect because we store data which will never be used again, also what is the behavior if we use the Pushwoosh /createMessage Web Service with invalid / rejected device identifiers ?
  • Track the tokens / devices using a CRON job and deletes the devices which are very old in our database. Not perfect because we can have users which do not use our app during a long time.

Thanks,

Baptiste

asked 23 May '14, 19:30
bgaillard's gravatar image

bgaillard
416

Hello Baptiste,

Actually, there is a third way: at the moment, when you send a createMessage request with the "devices" section, our API returns a list of push tokens that aren't in our database, and since our servers keep the userbase up-to-date, you can simply remove these push tokens as well.

As for the functionality to check whether there are any outdated push tokens in the list that is currently stored on our servers, I will consult with our developers if we are going to implement it any time soon (hopefully, they will get back to me tomorrow, and I'll let you know the status).

permanent link
answered 25 May '14, 14:02
Dmitry%20%20Dyudeev's gravatar image

Dmitry Dyudeev
3.7k7

Hello Dmitry and thanks for your response,

our API returns a list of push tokens that aren't in our database, and since our servers keep the userbase up-to-date, you can simply remove these push tokens as well.

So, if we remove those tokens from our database each time we call the createMessage service we can be sur our database will be in sync with the Pushwoosh database.

Because we want to use the tags functionnalities instead of manually providing device ids is it possible to provide an empty "devices" section just to ask Pushwoosh to return invalid tokens ?

In other words in this /createMessage request valid ?

{
    "request": {
        "application":"XXXX-XXXX",
        "auth":"XXXX",
        "notifications" : [
            {
                "content": {
                    "en" : "Hello World !"
                },
                "devices" : []
            }
        ]
    }
}

Then what would be the structure of the response (i.e where are the invalid / expired tokens in the response) ?

{
   "status_code":200,
   "status_message":"OK",
   "response": {
      "Messages" : ["XXXXXXXX"]
   } 
}

As for the functionality to check whether there are any outdated push tokens in the list that is currently stored on our servers, I will consult with our developers if we are going to implement it any time soon (hopefully, they will get back to me tomorrow, and I'll let you know the status).

Great, thanks.

permanent link
answered 25 May '14, 17:52
bgaillard's gravatar image

bgaillard
416

1

Unfortunately, the request with the empty "devices" section won't work: it would only try to send a notification to an empty list of devices.

Aside from that, I am glad to inform you that we are going to implement getUnregisteredDevices method with our next update. When called, it would return you a list of push tokens that were recently removed from our database, i.e. there is another way to sync your database with ours. I will let you know when the update is finished!

(26 May '14, 11:56) Dmitry Dyudeev Dmitry%20%20Dyudeev's gravatar image

Ok, perfect, with a getUnregisteredDevices method it will be easy to implement a CRON job to synchronize our databases. Thanks.

(26 May '14, 12:24) bgaillard bgaillard's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×9
×6
×3

question asked: 23 May '14, 19:30

question was seen: 1,732 times

last updated: 26 May '14, 12:24