Hi. I'm using named user tags group to associate UA users with tags in an external system. I need to be able to push notifications to multiple users with different tags. user1 might have tag 1 and user2 might have tag 2 so I want to send 1 notification that will go to tag 1 OR tag 2. I have followed the example in the documentation used for AND but with an OR, but I'm not getting any notifications sent. my request looks like the following

{
"notification": {
"alert": "New Document is available: p22||471 test",
"ios": { "priority": 10, "content_available": true, "expiry": 0 },
"actions": { "open": { "type": "deep_link", "content":"Some content here" } }
},
"audience": {
"OR": [
{ "tag": "22", "group": "product" },
{ "tag": "471", "group": "product" }
]
},
"device_types": [ "ios" ]
}

 

In this example teher is at least 1 user that has both tag 22 and 471 in the product group. I have also tried this with tags other tags. I once got it to send a notification with another compbination of tags, but have not been able to repeat it.

also is the following a valid request that should send a notification to anyone with the tag 22 or do I need to not use an or if I only have 1 tag?

{
"notification": {
"alert": "New Document is available: p22||471 test",
"ios": { "priority": 10, "content_available": true, "expiry": 0 },
"actions": { "open": { "type": "deep_link", "content":"Some content here" } }
},
"audience": {
"OR": [
{ "tag": "22", "group": "product" }
]
},
"device_types": [ "ios" ]
}

Didn't find what you were looking for?

New post

Comments

9 comments

  • Justin,

    Be careful when including "content-available" fields inside your payload. These should only be used when trying to wake the app from the background and should not include badges, sounds, or alerts in the payload.

    Including those in the payload when using content-available is likely going to cause Apple to throttle or even not deliver the push to your app at all.

    For the purposes of your API call, since you're just wanting to send the push immediately, you may remove the entire "ios" payload. The rest of the JSON looks fine, and should do what you want it to do.

    Comment actions Permalink
    0
  • I'm using these pushes to trigger the download of content.

    I tried several combinations of tags that I knew should send notifications and none of them did. Is an or with only one audience valaid? I tried that with tags that without the or send just fine and it never sent.

    It has been almost 24 hours since I make these requests and none (except for the one I mentioned) have resulted in any delivered notifications.

    I meant to mention that UA is acceptintg these requests and they show up in my activity log (with no sends)

    Comment actions Permalink
    0
  • OK so I tried removing the ios alert and it sends notifications, but I need to sent the content available flag because content is availabel. if I don't use an or this works just fine.

    My understanding is that the audience and named user/tags is a UA thing and APN doesn't know anything about the audience I have requested urban airship to send notifications to. Is this the case? if so why would this cause a problem?

    Comment actions Permalink
    0
  • I got it to work. The key seems to be to set the expiry of the ios object to > 0

    Comment actions Permalink
    0
  • Justin,

    I think we need to make the distinction here.

    Are you wanting to deep-link the user (In other words, navigate them to a specific page inside the app to view the new content), or are you wanting to download content in the background?

    The way you're currently sending a push with a deep-link makes it seem as though you want to send the user to a specific page, but there is no valid URL scheme that is being passed to the app. Instead, you're passing key/values pairs as if to have the app download content in the background, which isn't the way to do it.

    Can you clarify what use case you're trying to solve here?

     

    Comment actions Permalink
    0
  • I'm doing both. new content is available that needs to be downloaded and if the user taps the notification they need to be taken to that content in the app.

    I replaced the actual content of the action with the place holder 'some content here" just because I didn't want to include the real message.

    Comment actions Permalink
    0
  • Justin,

    You can't do both. Apple's documentation states that if you are using the content-available flag, that you cannot include the alert, sound, or badge fields within the payload when using this flag. In your payload, you are including an alert, which is against Apple's guidelines. Not following these guidelines may result in inconsistent behavior with receiving and not receiving notifications.

    When sending pushes that download content in the background, they need to be "silent" notifications, without an alert. If you have the correct handling in the app, then you can download the content in the background.

    When that happens, you can send a separate push that actually alerts the user, and deeplinks to the appropriate section in the app. However, to do this, you must set up URL schemes that the app can recognize so that it can deeplink the user to the appropriate section in the app. 

    For setting up deeplinks, make sure you set it up according to our DeepLink guide for iOS

    Comment actions Permalink
    0
  • Thank you. That was very helpful information

    Comment actions Permalink
    0
  • No problem!

    Comment actions Permalink
    0

Please sign in to leave a comment.