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 push notification to specific user ,not specific device

wulong yang

how to push notification to specific user ,not specific device.

 

for example, there are two device device1, device2.

then User A login our apps in device1 and register your channelid

then user B login our apps in device2 and register your channelid.

 

now,if user B login device1, user A login device 2.

 

if  in our server,we want to push notification to UserA,which logined in device2.   but we dont want user B (have login in device1) to get same message.

 

is there anyway to acheive that?

 

I read your document ,

that mean every time user login different device, need to update named_user for this device ChannelID?

so if for above case  update UserA Linked to device2's ChannelID.

in our program we look for all ChannelID linked to named_user (UserA)

then send list of these ChannelID to your api.

then UserA will get notification, right?

 

 

 

 

Please sign in to leave a comment.

0
Avatar

Hi, 

Yes, the feature you need to achieve this is called Named User. Named User is a way for you to link a devices to a User ID from your system. Every time a user logs into the device you will set the Named User, which is just one line of code in iOS and in Android but they will stay linked to that user unless you link the device to another user or you disassociate it. 

When you send the message, you don't need to check the Channels linked to the user, you can just target the Named User ID and we will calculate which devices we need to send to. In the UI this looks likes this:

If you are using the API, your payload would look like this:

{
  "audience": {
    "named_user": "User_A"
  },
  "notification": {
    "alert": "Hello!"
  },
  "device_types": "all"
}

Please let me know if this helps or if you have any questions.

Aidan Hickman 0 votes