Support for displaying notifications?

Any plans to add notification actions/objects? In Shortcuts, I’ll sometimes display a notification at the end of a script; as far as I can tell, the closest I can come to that in Scriptable is an Alert (with a baked-in Cancel button; if there was an option to use an OK button instead, that would be an improvement).

1 Like

If you don’t mind using IFTTT you could use a webhook there and make a HTTP (PUT) request in Scriptable to trigger a notification.

(I used this to test notifications)

I use PushOver Its an app that you install on your phone. Then you can send notifications via a url request.

You can in fact show an OK button in alert. Something like the following should work.

let alert = new Alert()
alert.title = "My alert"
alert.message = "This is my alert."
await alert.presentAlert()

That said, I am actively working on adding support for scheduling notifications from a script. If everything goes well, this will be included in the next update.


How can my code detect what i chose as option

The documentation explains you get the index rather than the value.

Here’s an example.

let alert = new Alert();
alert.title = "Selection Test";
alert.message = "Choose an option.";
let intIndex = await alert.presentAlert();
let strReturn;
  case 0:
    strReturn = "Foo";
  case 1:
    strReturn = "Bar";
  case 2:
    strReturn = "Quz";
  case 3:
    strReturn = "Qux";
 console.log("You chose option " +intIndex + ", " + strReturn);

It shows four options and writes details of the selection to the console.

Hope that helps.

1 Like