Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question]: How do I send a notification filtering the users role OR location? #41

Open
1 task done
VictorGazzinelli opened this issue Oct 2, 2023 · 1 comment
Open
1 task done

Comments

@VictorGazzinelli
Copy link

How can we help?

I've got a use case to send users a push notifcation based on their role OR location. How do I use the CreateNotificationAsync method to send a notification based on such criteria?

According to the documentation, in order to correctly specify this behavior, I believe the final json data would be something like:

{
  ...
  "filters": [
    {"field": "tag", "key": "is_admin", "relation": "=", "value": "true"},
    {"operator": "OR"}, {"field": "location", "lat": "37.5426574", "long" : "-122.3019626", "radius": "100" }
  ]
}

With this, I believe there is two issues:

  1. The OR operator must be suported for filters - a Pull Request submited by @bnoffer should fix this.
  2. The lat, long and radius props must be added to the Filter class/model.

Any ideia how can I achieve this? Let me know if i can help submiting a PR.

Victor Gazzinelli

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bnoffer
Copy link

bnoffer commented Oct 4, 2023

Hi @VictorGazzinelli,
I had the same demand in regards to the OR operator and actually was a bit confused that OneSignal does not follow their own specification here. But it looks to me as if they are using some kind of code generator and that there is no "real" development happening on this project. So the issue probably lies in the code generator being used, since the proper values are in the spec.

Would be nice to know what is being used, so the issue for the code generation can be addressed to the proper party.

I forked this repo and I am using a modified version of the library, it is not up-to-date though. If it helps you can find it here: https://github.com/bnoffer/onesignal-dotnet-api/tree/support_or_operator_for_notification_filters and build a Nuget yourself.

I know, it is not the recommended way to do it, but it works.

VictorGazzinelli added a commit to VictorGazzinelli/OneSignalPushNotificationClient that referenced this issue Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants