Community

Community Forums

Where our customers, developers, and more can come together to help each other with both general and technical questions about our products and services.

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

Sumit Birla

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

Please sign in to leave a comment.

0
Avatar

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. 

Aidan Hickman 0 votes
0
Avatar

Hi Aidan,

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

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

- Sumit

 

Sumit Birla 0 votes