Push Notification API and Deep Links...

I have an application that will send a Push Notification using the API.  The problem I am struggling with is that when I add the "Actions" section I am always getting a "400 Bad Request".  I have followed the example I have seen here https://support.urbanairship.com/hc/en-us/community/posts/115017602043-How-to-create-JSON-which-uses-a-Deep-Link-action-for-use-with-PUSH-API .  Below is the JSON I am using and I am not sure why adding the "actions" section alone would cause the Bad Request...

The following gets 400 Bad Request

{
"audience": {
"OR": [
{
"ios_channel": "342604eb-a1ff-4347-bfae-11dfe6823d3e"
}
]
},
"device_types": "all",
"notification": {
"alert": "iOS Alert",
"ios": {
"sound": "default",
"actions": {
"open": {
"type": "deep_link",
"content": "orderdetail?patientid=0da4050c-6127-4aed-ad8c-2f6ac5046518"
}
}
}
}
}

 

This works

 

{
"audience": {
"OR": [{
"ios_channel": "342604eb-a1ff-4347-bfae-11dfe6823d3e"
}]
},
"device_types": "all",
"notification": {
"alert": "iOS Alert",
"ios": {
"sound": "default"
}
}
}

Any feedback or ideas would be awesome.  I have been working on this all day and it can't get it to work.

 

Thanks in advance.

Didn't find what you were looking for?

New post

Comments

2 comments

  • Hey George!

    We were taking a peak at any differences that may be going on within the two JSON requests. 

    Looks as though it might be just a matter of pulling the 'action' attribute outside the iOS block. 

    Give this API call a shot: 

    {
         "audience": {
             "OR": [
                     {
                           "ios_channel": "342604eb-a1ff-4347-bfae-11dfe6823d3e"
                      }

      ]
      },
    "device_types": "all",
    "notification": {
             "alert": "iOS Alert",
              "ios": {
                        "sound": "default"
                 },
             "actions": {
                            "open": {
                                  "type": "deep_link",
                                  "content": "orderdetail?patientid=0da4050c-6127-4aed-ad8c-2f6ac5046518"
                                   }
                              }
                    }
    }

     

    Comment actions Permalink
    1
  • That was it.  Feel stupid, but I guess that is how you learn.  Thanks for your help and quick answer.

    Comment actions Permalink
    0

Please sign in to leave a comment.