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

[Bug]: #46

Open
1 task done
emawby opened this issue Jan 17, 2024 · 1 comment
Open
1 task done

[Bug]: #46

emawby opened this issue Jan 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@emawby
Copy link

emawby commented Jan 17, 2024

@Duddde

What happened?

I'm trying to send notification with ExternalId.
I do not receive anything.
But when the external Id is null, i receive the notification on my device.

 public async Task SendNewMatchNotification(string userId)
  {
      //SendOneSignalNotification
      Configuration config = new Configuration();
      config.BasePath = _options.BasePath;
      // Configure Bearer token for authorization: app_key
      config.AccessToken = _options.AccessToken;
      
      var apiInstance = new DefaultApi(config);
      
      var notification = new Notification(appId: _options.AppId)
      {
          TemplateId = _options.NewMatchTemplateId,
          IncludedSegments = new List<string> { "Total Subscriptions" },
          ExternalId = userId
      };
      
      try
      {
          // Create notification
          CreateNotificationSuccessResponse result = await apiInstance.CreateNotificationAsync(notification);
          Debug.WriteLine(result);
      }
      catch (ApiException e)
      {
          Debug.Print("Exception when calling DefaultApi.CreateNotification: " + e.Message);
          Debug.Print("Status Code: " + e.ErrorCode);
          Debug.Print(e.StackTrace);
      }
  }

On my .Net MAUI APP i'm using OneSignal.Login(userId.ToString()); to register the connected user.

But in my subscriptions i have two with the same Id's (it's maybe the problem)

image

Any idea of what's the problem ?

Steps to reproduce?

### Steps to reproduce?


Back end API .Net 7
pckg OneSignalAPI v2.0.2

Client : MAUI .Net 7.0
pckg OneSignal.SDK.Net 5.0.2

What did you expect to happen?

What did you expect to happen?

I expect to receive notification when using externalId

Relevant log output

Output of the one signal api : 
class CreateNotificationSuccessResponse {
  Id: 4cead680-2811-4134-b570-4f4d1bd95acc
  Recipients: 0
  ExternalId: 91b0045a-ed5c-49df-b499-88d382721db4
  Errors: 
}

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@emawby emawby added the bug Something isn't working label Jan 17, 2024
@emawby
Copy link
Author

emawby commented Jan 17, 2024

@Duddde
According to OneSignal Support, I need to use the IncludeExternalUserIds property instead of ExternalId. Indeed it seems to work. However, the IncludeExternalUserIds property is marked as deprecated by the SDK.
Do you think this is the right solution?

The API return does not looks good...

class CreateNotificationSuccessResponse {
Id: 9481f102-ae46-4bfa-907e-fa8949a00aed
Recipients: 0
ExternalId:
Errors:
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant