Skip to content

Notification

Schedules and manages notifications.

Notifications are scheduled for delivery at some point in the future. A notification may be delivered even when Scriptable is not running.

Actions added to the notification.

actions: {string: string}

An array of objects on the following form:

{
"title": "Open Website",
"url": "https://scriptable.app"
}

To add a notification, use Notification.addAction.

Read-only.

Number to display in the app icon’s badge.

badge: number

When the number is zero, no badge is displayed. When the number is greater than zero, the number is displayed in the app icon’s badge. Setting the value to null, will leave the badge unchanged. The default value is null.

Body of the notification.

body: string

Delivery date of the notification.

deliveryDate: Date

If the notification has already been delivered, for example because it was fetched using Notification.allDelivered(), the deliveryDate will be populated. Otherwise it will be null.

The property cannot be set. In order to specify a future delivery date for a notification, see the setTriggerDate function. For recurring notifications, see the setDailyTrigger and setWeeklyTrigger functions.

Read-only.

Identifier of the notification.

identifier: string

To reschedule a notification, use the identifier of an existing notification.

Next trigger date of the notification.

nextTriggerDate: Date

The next trigger date is the point in time where the next notification will be delivered.

The property cannot be set. In order to specify a future delivery date for a notification, see the setTriggerDate function. For recurring notifications, see the setDailyTrigger and setWeeklyTrigger functions.

Read-only.

URL to open when notification is tapped.

openURL: string

The Scriptable application will open the URL when the notification is tapped. This can be a URL that uses Scriptables URL scheme, the URL scheme of another application or a website URL.

Preferred height of the notification.

preferredContentHeight: number

By default Scriptable attempts to determine an appropriate height for your notification. If you want to override the default behavior, you can specify a preferred content height. The preferred content height is only used when running a script inside the notification, i.e. when scriptName is not null. iOS may limit the height of the notification in which case the preferred content height is not guaranteed to be respected.

Name of script to run in rich notification.

scriptName: string

When notification is force touched or long pressed, Scriptable can run a script inside the notification without opening the app. Set the scriptName to a name of an existing script to run it inside the notification.

Sound of the notification.

sound: string

Set to null if you do not want any sound. Set to one of the following values if you want a sound.

  • default
  • accept
  • alert
  • complete
  • event
  • failure
  • piano_error
  • piano_success
  • popup

By default the notification is delivered with no sound.

Subtitle of the notification.

subtitle: string

Identifier for grouping the notification.

threadIdentifier: string

Notifications are grouped by the identifier on the Home screen and in the Notification Center.

Title of the notification.

title: string

Custom information.

userInfo: {string: any}

Store any custom information for the notification. This can be accessed from the Notification.opened property when a script is run from a notification.

Constructs a notification.

new Notification()

Adds an action button.

addAction(title: string, url: string, destructive: bool)

Actions are shown as buttons in the notification. When screen space is unlimited, the system shows up to 10 actions. When the space is limited the system shows at most two actions.

title string

Title of the action.

url string

URL to open when choosing the action.

destructive bool

Optional. If set to true, the button is displayed with special highlighting to indicate that it performs a destructive task. Defaults to false.

Delivered notifications displayed in the Notification Center.

static allDelivered(): Promise<[Notification]>

Fetches all notifications that have been scheduled from Scriptable and that are still displayed in the Notification Center of iOS.

Promise<[Notification]>

Promise that carries all delivered notifications when fulfilled.

All pending notifications.

static allPending(): Promise<[Notification]>

Fetches all notifications that have been scheduled from Scriptable and are waiting to be delivered.

Promise<[Notification]>

Promise that carries all pending notifications when fulfilled.

Notification a script is running in.

static current(): Notification

The notification that a script is being run in or the application was opened from.

The notification contains all information that was set when the notification was originally scheduled, including the userInfo property which can be used to contain custom data that might be relevant when running the script.

Notification

The notification that a script is running in.

Removes the notification.

remove(): Promise

Removes all future triggers of the notification.

Promise

Promise that is fulfilled when the notification have been removed.

Removes all delivered notifications.

static removeAllDelivered(): Promise

Removes all notifications that have been scheduled from Scriptable and that are still displayed in the Notification Center of iOS.

Promise

Promise that is fulfilled when the notifications have been removed.

Removes all pending notifications.

static removeAllPending(): Promise

Removes all notifications that have been scheduled from Scriptable and are waiting to be delivered.

Use with caution. This removes all notifications scheduled across all of your scripts and the action cannot be undone.

Promise

Promise that is fulfilled when the notifications have been removed.

Removes delivered notifications.

static removeDelivered(identifiers: [string]): Promise

Removes notifications with the specified identifiers. The notifications are only removed if they have been delivered. To remove pending notifications, see Notification.removePending().

identifiers [string]

Promise

Promise that is fulfilled when the notifications have been removed.

Removes pending notifications.

static removePending(identifiers: [string]): Promise

Removes notifications with the specified identifiers. The notifications are only removed if they are pending, that is they have been scheduled and are waiting to be delivered. To remove delivered notifications, see Notification.removeDelivered().

identifiers [string]

Promise

Promise that is fulfilled when the notifications have been removed.

Resets the current notification.

static resetCurrent()

Effectively sets args.notification to null.

When a notification scheduled from Scriptable has been tapped to open the app or while the app was open, args.notification will have a value until Scriptable is quit. You can manually reset the value using Notification.resetCurrent.

Schedules the notification.

schedule(): Promise

When a new notification is constructed, it must be scheduled, otherwise it will not be delivered. If an existing notification is modified, it must also be scheduled again for the changes to take effect.

Promise

Promise that is fulfilled when the notification have been scheduled.

Sets the notification to be triggered daily.

setDailyTrigger(hour: number, minute: number, repeats: bool)

Sets the notification to be triggered on a specific time of the day. When the notification repeats, it will be sent at the same time on all future days. If the notification is not repating it will be sent on the next occurrence of the specified time.

hour number

Hour of the day to trigger the notification.

minute number

Minute of the day to trigger the notification.

repeats bool

If true the notification will be sent daily on the specified time, otherwise it will only be sent once. Defaults to false.

Sets the notification to be triggered on a date and time.

setTriggerDate(date: Date)

date Date

Date and time to trigger the notification on.

setWeeklyTrigger(weekday, hour, minute, repeats)

Section titled “setWeeklyTrigger(weekday, hour, minute, repeats)”

Sets the notification to be triggered weekly.

setWeeklyTrigger(weekday: number, hour: number, minute: number, repeats: bool)

Sets the notification to be triggered on a specific day of the week and a specific time of that day. When the notification repeats, it will be sent at the same time on all future days. If the notification is not repating it will be sent on the next occurrence of the specified time.

weekday number

Day of the week to trigger the notification.

hour number

Hour of the day to trigger the notification.

minute number

Minute of the day to trigger the notification.

repeats bool

If true the notification will be sent daily on the specified time, otherwise it will only be sent once. Defaults to false.