How to send notification to a named_user using ruby-library?

I am getting a "400 Bad Request" error while I try to send the following push notification:

{"audience":{"named_user":"user_54434"},"notification":{"alert":"TEST"},"device_types":"all"}

Ruby code:

p = airship.create_push 
p.audience = UA.named_user('user_54434') 
p.device_types = UA.all

p.notification = UA.notification(alert: 'TEST') 
p.send_push

Didn't find what you were looking for?

New post

Comments

2 comments

  • Hi Sumit, 

    Named User is not available on all platforms, Windows specifically, so you are not allowed to use p.device_types = UA.all. You need to specify either Android, iOS or both. 

    I hope this helps. 

    Comment actions Permalink
    0
  • Hi Aidan,

    Thanks for that information.  Changing my code to specify device type of iOS  fixed the issue.

    p.device_types = UA.( ["ios"] )

    - Sumit

     

    Comment actions Permalink
    0

Please sign in to leave a comment.