Http IONIC push notification request

Hi everyone, I created a http push request but I didn’t receive any notification in my android device.

Here is the response body I received in return of request. I have tally my device token carefully as I used http get all tokens request of IONIC service. And I matched the token in device using console log under token registration metho

{
    "data":
    {
        "status": "open",
        "uuid": "472945c4-7c3a-4b53-a727-b4909236c9da",
        "state": "enqueued",
        "config":
        {
            "profile": "pust_test",
            "tokens":
            [
                "mytoken"
            ],
            "notification":
            {
                "android":
                {
                    "sound": "default",
                    "message": "Hey android",
                    "title": "Hi"
                },
                "ios":
                {
                    "priority": 10,
                    "content_available": 1,
                    "sound": "default",
                    "message": "Hi",
                    "title": "Hey"
                }
            }
        },
        "created": "2017-05-24T07:31:03.550740+00:00",
        "app_id": "a840f9e9"
    },
    "meta":
    {
        "status": 201,
        "request_id": "261b02f8-acdb-41fb-c1d7-57155d620e4b",
        "version": "2.0.0-beta.0"
    }
}

To what push provider/service?
What exactly did you send there?
How did you implement push in your application?

To make request I used mozilla RESTCLIENT services

url https://api.ionic.io/push/notifications
header Authorization Berer IONICAPPKey
content type application/json
request type POST

{
“tokens”: [“mydevicetoken”],
“profile”:" myprofile",
“notification”: {
“title”: “Hi”,
“message”: “Hello world!”,
“android”: {
“title”: “Hey”,
“message”: “Hello Android!”
},
“ios”: {
“title”: “Howdy”,
“message”: “Hello iOS!”
}
}
}

I think this much information is enough to understand the issue

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

But yes, you seem to be using Ionic Push, an Ionic Service.

How did you implement push in your app? Anything special?
You are getting the push token when you start the app, correct?

Here you can check the status of an individual message:
https://docs.ionic.io/api/endpoints/push.html#get-messages-message_id
You can also list all messages here:
https://docs.ionic.io/api/endpoints/push.html#get-notifications

Thanks for suggesting but as I already mentioned that I created a http web request from Mozilla browser REST CLIENT addon , I knew my device token , I just simply using http end points of PUSH NOTIFICATION, it was a post request to send notification on token. I sent the request successfully to IONIC CLOUD as in response you can see the code 201
BUT the issue is this that I, on device didn’t receive any push notification . Thanks

So what? Now you can use these two endpoints to check on the status of that notification and see if there was an error, if it says it was delivered etc. You have to debug the problem to be able to know how to fix it - if you don’t know what and why is going wrong, no way to change anything.

Here is the response of
https://api.ionic.io/push/notifications

    {
        "state": "enqueued",
        "config":
        {
            "profile": "ios_profile",
            "tokens":
            [
                "e0bb97a60ce3a506c13e8fe13acc7c3f8838cacb0039359242c3548dfb32b8a5"
            ],
            "notification":
            {
                "android":
                {
                    "title": "Hey",
                    "message": "Hello Android!"
                },
                "title": "Hi",
                "ios":
                {
                    "title": "Howdy",
                    "message": "Hello iOS!"
                },
                "message": "Hello world!"
            }
        },
        "status": "locked",
        "created": "2017-05-29T11:48:47.707126+00:00",
        "uuid": "e2a508f2-e197-4901-84f6-9cfa4493695e",
        "app_id": "21aa4773"
    },

Please look at the status “Locked” and “Enqueued” . What does it mean? I haven’t received any notification on iOS device. It will be really appreciatable if someone helps. Thanks

I am also experiencing what I believe is the same issue as @gurjit_onebcg. Fundamentally, the issue is that there is a large delay of 30 minutes to a couple of hours between when a push notification is registered with the Ionic Push Service create API and the time that the notification registers on a target device. This does not occur when creating a push notification from the ionic dashboard.

The create API response shows the same data as indicated by @gurjit_onebcg in his previous response, primarily, “state” : “enqueued” and “status” : “locked”.

REQUEST
var body = {
                     "external_ids": "111",
                     "profile": "myprofile",
                     "notification": {
                           "title": "Test Push",
                           "message": "Yet another push message scheduled"
                     }
              };

http method="post" url="https://api.ionic.io/push/notifications" result="response"  {
                     httpparam type="body" value="body";
              };

RESPONSE
{  
   "data":{  
      "status":"open",
      "config":{  
         "external_ids":[  
            "111"
         ],
         "profile":"myprofile",
         "notification":{        
            "message":"Yet another push message scheduled",
            "title":"Test Push"
         }
      },
      "state":"enqueued",
      "created":"2017-06-16T22:55:06.125950+00:00",
      "uuid":"xxxx-xxxx-xxxx-xxxx-eb404b3f6056",
      "app_id":"xxxxxx"
   },
   "meta":{  
      "request_id":"xxxxxx-xxxx-xxxx-xxxx-c388aafdacac",
      "version":"2.0.0-beta.0",
      "status":201
   }
}

Immediately after creating a push notification calling the Get Notifications API returns a list which includes the notification generated in the previous create API. The state of this notification remains “state” : “enqueued”.

{  
   "meta":{  
      "status":200,
      "request_id":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
      "version":"2.0.0-beta.0"
   },
   "data":[  
      {  
         "config":{  
            "profile":"myprofile",
            "external_ids":[  
               "111"
            ],
            "notification":{  
               "title":"Test Push",
               "message":"Yet another push message scheduled"
            }
         },
         "status":"locked",
         "state":"enqueued",
         "app_id":"xxxxxxx",
         "uuid":"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
         "created":"2017-06-16T23:03:41.557491+00:00"
      }
]}

A subsequent call to list notification messages returns a list of messages created for the previous notification. Each of the messages has a “status”: “sent”, yet the messages are still not received on the target device for times ranging from 30 minutes to a few hours.

{  
   "meta":{  
      "version":"2.0.0-beta.0",
      "status":200,
      "request_id":"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
   },
   "data":[  
      {  
         "notification":"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
         "status":"sent",
         "uuid":"xxxxxxx-xxxxx-xxxx-xxxx-xxxxxxx",
         "error":null,
         "created":"2017-06-16T23:03:41.786952+00:00",
         "token":{  
            "token":"dzJv-4ZPkrM:APA91bfgjghFo2eL1Ca4DPGTnjbdwv6TT1Xd8Zfd--eNqgdGDg5rt1e4hjhjrEceVGvm5ydBrnT015SeYvBVZFzXUEAcZTaq9DE6Vpt2OjFjaWitBkvhQoWDRW5tigFz4qUZNyXd-MVY6a9msjyU2",
            "valid":true,
            "invalidated":null,
            "created":"2017-06-16T18:39:15.927269+00:00",
            "id":"xxxxxxxxxx",
            "app_id":"xxxxx",
            "type":"android"
         },
         "user_id":"xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
      }
   ]
}

Calling the message retrieve API returns the message information. The message has “status” : “sent” as would be expected from the previous API.

{  
   "data":{  
      "notification":"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
      "user_id":"xxx-xx-xxxx-xxxx-xxxxxxxx",
      "status":"sent",
      "uuid":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
      "created":"2017-06-16T23:03:41.786952+00:00",
      "error":null,
      "token":{  
         "token":"dzJv-4ZPkrM:APA91bFo2edfg46534Ds4L1Ca4DPGTnjbdwv6TT1Xd8Zfd--eNqgdGDg5rt1e4rEceVGvm5ydBrnT015SeYvBVZFzXUEAcZTaq9DE6Vpt2OjFjaWitBkvhQoWDRW5tigFz4qUZNyXd-MVY6a9msjyU2",
         "invalidated":null,
         "id":"e3c847ab2sasd43sd327ea4d378a5cf49535a1477",
         "created":"2017-06-16T18:39:15.927269+00:00",
         "type":"android",
         "valid":true,
         "app_id":"xxxxxx"
      }
   },
   "meta":{  
      "version":"2.0.0-beta.0",
      "status":200,
      "request_id":"xxxxx-xxx-xxxx-xxxx-xxxxxxx"
   }
}

NOTES

  1. Using the ionic dashboard to generate a push notification immediately deploys the notification to a target device.
  2. I am using an android device for my testing of received push notifications
  3. I use custom auth in our application and send targeted push notifications via the external_id

http://ionicframework.com/support#support
(Scroll down to “Business and Customer Support”)