OneSignal / onesignal-dotnet-api

Other
13 stars 12 forks source link

[question]: Is there a way to add Launch URL to the push notification button? #17

Open mensurkurtagic opened 1 year ago

mensurkurtagic commented 1 year ago

How can we help?

Documentation says that we can create WebButtons with LaunchUrl (Url) as a parameter, but WebButtons attribute is a List

Hoang-Minh commented 1 year ago

I experience the same thing too. I have to use the unofficial package instead, and it does support url in the button Check it out at https://www.nuget.org/packages/OneSignal.RestAPIv3.Client

PzYon commented 6 months ago

Might be a bit late for the show, but I had the same problem and I solved it using plain old inheritance:

public class ButtonWithUrl : Button
{
  [DataMember(Name = "url", IsRequired = true, EmitDefaultValue = false)]
  public string? Url { get; set; }

  public ButtonWithUrl(string? id = null, string? text = null, string? icon = null, string? url = null)
    : base(id, text, icon)
  {
    Url = url;
  }
}

And then setting the web buttons using the above type instead of the builtin Button-class:

new ButtonWithUrl(id: "yes", text: "Yes", url: "http://localhost:3000/settings")
nan-li commented 6 months ago

Hi everyone, thank you for reporting, This is a bug, the url property is missing from the Button class so we will be fixing this in the next beta release update.