OneSignal / onesignal-dotnet-api

Other
14 stars 11 forks source link

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

Open mensurkurtagic opened 2 years ago

mensurkurtagic commented 2 years 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 8 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 8 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.