Skip to content

[Bug]: Can't create notifications targeting a list of external ids #66

@remiremi

Description

@remiremi

What happened?

The REST API makes it possible to send notifications to a list of users given their external ids: https://documentation.onesignal.com/reference/create-notification#platform-to-deliver-to

However the sdk doesn't seem to make it possible, because the field include_aliases expects an object of type PlayerNotificationTargetIncludeAliases, which definition doesn't make it possible to define the external_id field.

This is what the serialized JSON for include_aliases should look like according to REST API documentation

  "include_aliases": {
    "external_id": ["external_user_id_on_push_email_sms"]
  },

Steps to reproduce?

Install latest version of sdk.

To try and make the call with the SDK, run:

    const notification = new OneSignal.Notification()
    notification.app_id = this.appId
    notification.include_aliases = new OneSignal.PlayerNotificationTargetIncludeAliases();
    notification.include_aliases.external_id = ["my-id-1", "my-id-2"]

Typescript will complain that

"Property 'external_id' does not exist on type 'PlayerNotificationTargetIncludeAliases'.ts(2339)"

What did you expect to happen?

I expect the SDK to have the correct type definition of PlayerNotificationTargetIncludeAliases so that the API call can be made with the correct parameters.

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions