I am trying to push notifications through the API using big text style.


I am testing from postman using the below JSON body:

{
"audience": { "named_user":["someuser@gmail.com"] },
"notification": {
"android": {
"style": {
"type": "big_text",
"big_text": "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message",
"title": "LiquorFlip",
"summary": "New preference on sale!"
}
},
"ios":{
"alert": "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message"
}
},
"device_types": ["ios","android" ]
}

and using the reequired headers:


Authorization Basic XXXXXXXXX
Accept application/vnd.urbanairship+json; version=3
Content-Type application/json

When posting the above request I am getting the below response in the body:

{
"ok": true,
"operation_id": "74da40d6-4e62-43ed-9304-386af7940e8b",
"push_ids": [
"84316a9a-5001-456d-ac62-d965aad22e87"
],
"message_ids": [],
"content_urls": []
}

However I did not receive any notification in my android device.

Can you please help me with this issue?

 

Didn't find what you were looking for?

New post

Comments

7 comments

  • Hi Jaydel,

    I looked up the named user 'someuser@gmail.com' in our system and found no channel ID associated with it. This is probably why your push notification wasn't received. The API request itself is fine, but it needs to be sent to a user in our system. You can associate a named user to your device's channel ID using the Association endpoint. You can also test the notification by sending it to your channel ID if you want to try that first.

    Give the association endpoint a try and let me know if you're able to receive the push notification on your device after that!

    Comment actions Permalink
    0
  • Hi Jennifer,

    Thanks for your kindly reply.

    You are absolutely right, named user "someuser@gmail.com" doesn't exist in your system because it is a fake email address I posted with the request, though its true channel_id is "d44ca209-8aab-4932-81ee-7c8c688c3760".

    Could you please check what is happening using the above info?

    Thanks in advance

    Comment actions Permalink
    0
  • I ran the body of your API request through our Validate endpoint and it returned successfully. The notification should come through on your device once the audience is changed to a valid user. You can send it to your Android channel like so:

    {
    "audience": {
    "android_channel": "d44ca209-8aab-4932-81ee-7c8c688c3760"
    },
    "notification": {
    "android": {
    "style": {
    "type": "big_text",
    "big_text": "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message",
    "title": "LiquorFlip",
    "summary": "New preference on sale!"
    }
    },
    "ios":{
    "alert": "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message"
    }
    },
    "device_types": ["android"]
    }

    Give that request a try and let me know if it works. You might want to include an iOS channel in the audience selector, and add iOS back to device types again if you want to see the iOS part of the payload go through. You can also associate the named user with an Android device and an iOS device and use your original request. 

     

    Comment actions Permalink
    0
  • Thank you for your support Jennifer.

    I am certain that the body of the API request is valid because any time I posted it I receive a response as the below:

    {
    "ok": true,
    "operation_id": "40137cb7-e86e-4755-a1f8-e4cf361ca00b",
    "push_ids": [
    "afbf1145-d200-4bfa-ad66-74d88ddd3c63"
    ],
    "message_ids": [],
    "content_urls": []
    }

    In fact the above response was the latest one I received for the below post:

    {
    "audience": {
    "android_channel": "d44ca209-8aab-4932-81ee-7c8c688c3760"
    },
    "notification": {
    "android": {
    "style": {
    "type": "big_text",
    "big_text": "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message",
    "title": "LiquorFlip",
    "summary": "New preference on sale!"
    }
    },
    "ios":{
    "alert": "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message"
    }
    },
    "device_types": ["android"]
    }

    However none notification is received in the aforementioned device Id.

     

    On the other hand if I post the below json:

    {
    "audience": {
    "android_channel": "d44ca209-8aab-4932-81ee-7c8c688c3760"
    },
    "notification": {
    "alert":
    "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message"
    },
    "device_types": ["android"]
    }

     

    it works (I mean, I can see the notification in the android device) and received the below response from the API:

    {
    "ok": true,
    "operation_id": "06cd3936-4606-4fe2-927d-824f38a738c0",
    "push_ids": [
    "b4fd5380-30f9-49a7-9273-3062418b8b9f"
    ],
    "message_ids": [],
    "content_urls": []
    }

    So my question is: 

    do we need to do an additional configuration in the mobile application code so big_text works correctly or there is an issue with the API?

     

    Comment actions Permalink
    0
  • Hi Jaydel,

    After taking a closer look at our official documentation for Android, I found out the big_text is used by default in Android notifications. 

    I took out all references to big_text (including summary and title), and was able to send the below notification to my test device successfully. I have replaced my named user with your Android channel for ease of testing on your side:

    {
    "audience": {
    "android_channel": "d44ca209-8aab-4932-81ee-7c8c688c3760"
    },
    "notification": {
    "android": {
    "alert": "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message"
    },
    "ios":{
    "alert": "This should be a very long text and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and also this and this is the end part of the message"
    }
    },
    "device_types": ["android", "ios"]
    }

    Upon receiving the notification, all you have to do is pull down on the notification to see the entire alert text.

    Comment actions Permalink
    0
  • Hi there,  but the example shows multiple line whereas my notification only shows 1 line.   How does my outlook print three lines showing on the notification?

    Comment actions Permalink
    0
  • Hi Jaydel,


    That is expected behavior for Android, at least while you are on the lock screen. In order to view the full big text notification on the lock screen, you have to expand the notification.

    If you unlock your phone and view the notification center, the full content of your Android big text notification will appear provided that the notification is at the top of the list of notifications, like so:

     

    Comment actions Permalink
    0

Please sign in to leave a comment.