Being notified when a push token is rejected

Answered

Comments

4 comments

  • Avatar
    Dmitry Dyudeev

    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).

  • Avatar
    Baptiste Gaillard

    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.

  • Avatar
    Dmitry Dyudeev

    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!

  • Avatar
    Baptiste Gaillard

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

Please sign in to leave a comment.