apache / openwhisk-package-pushnotifications

OpenWhisk Package for Bluemix Push Notifications Service
Apache License 2.0
10 stars 17 forks source link

tagNames error #78

Closed tverilytt closed 6 years ago

tverilytt commented 7 years ago

Hi! I think there is a typo for the "tagNames" property. Using "tagNames" gives me:

While using "tagName" succeeds.

Cheers -jo

AnanthaKrish commented 7 years ago

@tverilytt How you are passing TagNames ?

It should be like this --p tagNames "[\"tag1\"]"

tverilytt commented 7 years ago

Yes, but I am using the API, and this gives the error: { "text": "from OpenWhisk action...", "userIds": [ "jo2" ], "tagNames": [ "jo2id" ] }

While this is working:

{ "text": "from OpenWhisk action...", "userIds": [ "jo2" ], "tagName": [ "jo2id" ] }

AnanthaKrish commented 7 years ago

@tverilytt You are not supposed to pass userIds and tagName together . Send one of the four - userIds,tagNames, platforms or deviceIds

tverilytt commented 7 years ago

Hm, okay...removing userIds results in no error for either "tagName" or "tagNames", but only the "tagNames" version results in receiving push notification...

And, the Bluemix Push Notification service (or the client API) does not seem to pose limitation on either userIds or tagNames. It might be handy to register as a certain user, and maybe use different tagNames, depending on scenarios in the end-user application...

Cheers -jo

tverilytt commented 7 years ago

@AnanthaKrish - Found this on the Bluemix push notification server: https://github.com/ibm-bluemix-mobile-services/bms-pushnotifications-serversdk-swift/issues/14

So seems one cannot use both userIds and tagNames as you say :-)

But still strange I only seem to get "tagName", and not "tagNames" to work when using the OpenWhisk push notification package.

Cheers -jo

AnanthaKrish commented 7 years ago

In the payload please remove UserIds and only add tagNames.

For example

{ "appGuid": "xxxxxx", "appSecret": "xxx "text": "hi there", "tagNames": [ "tag1" ] }

tverilytt commented 7 years ago

Yes, I did that yesterday and several times again now, same result, "tagName" works, "tagNames" does not. Both return same sucess status, but only the "tagName" version result in device receiving the push notification. Might be something on my side of course, would be interesting to hear if others have any problems on this.

Cheers -jo

AnanthaKrish commented 7 years ago

Are you sure the device is subscribed to that tag ? Subscribe the device for that tag and try 👍

tverilytt commented 7 years ago

Yes it is, because I do not receive push notifications for other tags.

AnanthaKrish commented 7 years ago

Hi @tverilytt

When you pass tagName instead of tagNames, OW will not process that param, so it will become a broadcast message. All the devices registered to your push service will get notification.

You can try this,

  1. go to https://mobile.ng.bluemix.net/imfpush/#!/subscriptions/get_apps_applicationId_subscriptions.
  2. check the whether the device is registered for that tag.

Let us know the details please.

tverilytt commented 7 years ago

Thanks for that, that was really helpful. I have used the PN REST API for sending PNs, but not for checking subscriptions...;-) Turned out I subscribed to "Push.ALL", which explains why the notification got through when using wrong property ("tagName"). Have read up a bit on the BMS push docs, and seems like for tags, one have to create them before devices can subscribe to them. Which makes them somwhat unsuiting for my case. The mobile app is supposed to perform a login, so I think it is more natural and straightforrward using "userIds" and filter notifications on username. That has been working all the time. I thought it could be handy to add "tagNames", but since both cannot be used simultaneously, I will stick to "userIds".

Thanks for all the help on this, that is really appreciated, and saved me time :-) I guess this "issue" can be closed now.

Cheers -jo

csantanapr commented 6 years ago

questioned is now answered