iOS payload, but nothing to deliver to (missing device_tokens, tags, segments, or aliases)

232 views Asked by At

I am doing background download for my app but I am getting

iOS payload, but nothing to deliver to (missing device_tokens, tags, segments, or aliases) 

when I insert this in terminal:

curl -v -X POST -u "<appKey>:<master key>" -H "Content-type: application/json" -H "Accept:
application/vnd.urbanairship+json; version=3;" --data '{"audience":"all", "device_types" : ["ios"],    "notification": {"ios": {"content-available":true, "sound": "default", "badge": 1, "message": "Hi there!", "priority":5}}}' https://go.urbanairship.com/api/push/

I wonder if the curl codes has any format mistakes in it.

Terminal return:

 * Hostname was NOT found in DNS cache
 *   Trying 23.74.208.46...
 * Connected to go.urbanairship.com (23.74.208.46) port 443 (#0)
 * TLS 1.2 connection using TLS_RSA_WITH_AES_256_CBC_SHA
 * Server certificate: *.urbanairship.com
 * Server certificate: Cybertrust Public SureServer SV CA
 * Server certificate: Baltimore CyberTrust Root
 * Server auth using Basic with user '<codes>'
 > POST /api/push/ HTTP/1.1
 > Authorization: Basic <codes>
 > User-Agent: curl/7.37.1
 > Host: go.urbanairship.com
 > Content-type: application/json
 > Accept:
 > application/vnd.urbanairship+json; version=3;
 > Content-Length: 143
 > 
 * upload completely sent off: 143 out of 143 bytes
 < HTTP/1.1 400 Bad Request
 * Server gunicorn/0.14.5 is not blacklisted
 < Server: gunicorn/0.14.5
 < Vary: Authorization, Cookie
 < X-Frame-Options: SAMEORIGIN
 < Content-Type: text/html; charset=utf-8
 < Date: Wed, 19 Nov 2014 02:19:02 GMT
 < Transfer-Encoding:  chunked
 < Connection: close
 < Connection: Transfer-Encoding
 < Set-Cookie: SRV=s0196; path=/
 < 
 * Closing connection 0
 iOS payload, but nothing to deliver to (missing device_tokens, tags, segments, or aliases)
1

There are 1 answers

4
Mike Taverne On

First, you should not post your credentials for all to see. This could allow anyone to send notifications to your app users!

Second, the problem appears to be that within your "ios" section you need to specify your audience by means of device tokens, tags, segments, or aliases. These are mechanisms UA gives you to identify which users should receive the notification.