Change text on notification

I’m trying to change the text on a notification before it’s opened but not having any luck.

  appInfo.msgConfirmation = app.notification.create({
    icon: '<i class="icon demo-icon">7</i>',
    title: 'Success!',
    subtitle: 'Your message was successfully sent',
    text: 'Your confirmation number is: ',
    closeButton: true,
    closeTimeout: 3000,
    on: {
      open: function (text) {
        debugger;
        app.dialog.alert('Notification opened');
      },
    }
  });

I’ve tried:

appInfo.msgConfirmation.params.text = "My new text";

And when I open the notification

appInfo.msgConfirmation.open();

It still shows the original text even though the text has been changed and the change is reflected in params.text.

How do I do this?

If anyone else is interested, here’s how I ended up solving the problem:

appInfo.msgConfirmation.params.confirmation = "AG-12246z";

And then.

appInfo.msgConfirmation = app.notification.create({
    icon: '<i class="icon demo-icon">7</i>',
    title: 'Success!',
    subtitle: 'Your message was successfully sent',
    text: 'Your confirmation number is: <span id="nConfirm"></span> ',
    closeButton: true,
    closeTimeout: 3000,
    on: {
      open: function (text) {
        $$("#nConfirm").text(appInfo.msgConfirmation.params.confirmation);
      },
    }
  });

Now when I do this:

appInfo.msgConfirmation.open();

the on open event gets called and I can retrieve the confirmation # from the params and set the span with it. This makes the code reusable without having to destroy the notification in order to change the text. One could also attach an object onto the params and pass in multiple variables.