You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to send notification base on user tags filter but it seems like i cannot initialize Filter() without it throws null error:
ArgumentNullException: Value cannot be null.
Parameter name: field is a required property for Filter and cannot be null OneSignalApi.Model.Filter..ctor(string field, string key, string value, RelationEnum relation) in Filter.cs, line 116
Steps to reproduce?
public static async Task<string> testSendAsync()
{
appConfig.BasePath = "https://onesignal.com/api/v1";
appConfig.AccessToken = Authorization;
var appInstance = new DefaultApi(appConfig);
var notification = new Notification(appId: AppId) { Contents = new StringMap(en: "Hello World from .NET!"), Headings = new StringMap(en: "Hello"), IncludedSegments = new List<string> { "Sale Role" }, Filters = new List<Filter> { new Filter(){ Field = "tag", Key = "Role", Value = "4", Relation = Filter.RelationEnum.Equal} }, }; var response = await appInstance.CreateNotificationAsync(notification); return $"Alert success: {response.Recipients.ToString()}"; }
What did you expect to happen?
It should not be null when we provide value to "field" already
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Looks like the error is due to the constructor performing a null check. If you use the constructor instead of initializing manually it should work fine.
Hello bro, were you able to solve this? I am having the same problem and I have not been able to solve it, I have had to use IncludePlayerIds which is a function that is depreciated, thanks a lot
What happened?
I want to send notification base on user tags filter but it seems like i cannot initialize Filter() without it throws null error:
ArgumentNullException: Value cannot be null.
Parameter name: field is a required property for Filter and cannot be null
OneSignalApi.Model.Filter..ctor(string field, string key, string value, RelationEnum relation) in Filter.cs, line 116
Steps to reproduce?
What did you expect to happen?
It should not be null when we provide value to "field" already
Code of Conduct
The text was updated successfully, but these errors were encountered: