---
title: Notification
description: Schedules and manages notifications.
---

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.

## Properties

### actions

Actions added to the notification.

```typescript
actions: {string: string}
```

An array of objects on the following form:



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



To add a notification, use `Notification.addAction`.

Read-only.

### badge

Number to display in the app icon's badge.

```typescript
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

Body of the notification.

```typescript
body: string
```

### deliveryDate

Delivery date of the notification.

```typescript
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

Identifier of the notification.

```typescript
identifier: string
```

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

### nextTriggerDate

Next trigger date of the notification.

```typescript
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.

### openURL

URL to open when notification is tapped.

```typescript
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.

### preferredContentHeight

Preferred height of the notification.

```typescript
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.

### scriptName

Name of script to run in rich notification.

```typescript
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

Sound of the notification.

```typescript
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

Subtitle of the notification.

```typescript
subtitle: string
```

### threadIdentifier

Identifier for grouping the notification.

```typescript
threadIdentifier: string
```

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

### title

Title of the notification.

```typescript
title: string
```

### userInfo

Custom information.

```typescript
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.

## Methods

<span id="-new-notification" class="api-anchor"></span>

### new Notification()

Constructs a notification.

```typescript
new Notification()
```

<span id="-addaction" class="api-anchor"></span>

### addAction(title, url, destructive)

Adds an action button.

```typescript
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.

#### Parameters

**`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.

### allDelivered()

Delivered notifications displayed in the Notification Center.

```typescript
static allDelivered(): Promise<[Notification]>
```

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

#### Return value

**`Promise<[Notification]>`**

Promise that carries all delivered notifications when fulfilled.

### allPending()

All pending notifications.

```typescript
static allPending(): Promise<[Notification]>
```

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

#### Return value

**`Promise<[Notification]>`**

Promise that carries all pending notifications when fulfilled.

### current()

Notification a script is running in.

```typescript
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.

#### Return value

**`Notification`**

The notification that a script is running in.

<span id="-remove" class="api-anchor"></span>

### remove()

Removes the notification.

```typescript
remove(): Promise
```

Removes all future triggers of the notification.

#### Return value

**`Promise`**

Promise that is fulfilled when the notification have been removed.

### removeAllDelivered()

Removes all delivered notifications.

```typescript
static removeAllDelivered(): Promise
```

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

#### Return value

**`Promise`**

Promise that is fulfilled when the notifications have been removed.

### removeAllPending()

Removes all pending notifications.

```typescript
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.

#### Return value

**`Promise`**

Promise that is fulfilled when the notifications have been removed.

<span id="removedelivered" class="api-anchor"></span>

### removeDelivered(identifiers)

Removes delivered notifications.

```typescript
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()`.

#### Parameters

**`identifiers` `[string]`**



#### Return value

**`Promise`**

Promise that is fulfilled when the notifications have been removed.

<span id="removepending" class="api-anchor"></span>

### removePending(identifiers)

Removes pending notifications.

```typescript
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()`.

#### Parameters

**`identifiers` `[string]`**



#### Return value

**`Promise`**

Promise that is fulfilled when the notifications have been removed.

### resetCurrent()

Resets the current notification.

```typescript
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`.

<span id="-schedule" class="api-anchor"></span>

### schedule()

Schedules the notification.

```typescript
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.

#### Return value

**`Promise`**

Promise that is fulfilled when the notification have been scheduled.

<span id="-setdailytrigger" class="api-anchor"></span>

### setDailyTrigger(hour, minute, repeats)

Sets the notification to be triggered daily.

```typescript
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.

#### Parameters

**`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.

<span id="-settriggerdate" class="api-anchor"></span>

### setTriggerDate(date)

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

```typescript
setTriggerDate(date: Date)
```

#### Parameters

**`date` `Date`**

Date and time to trigger the notification on.

<span id="-setweeklytrigger" class="api-anchor"></span>

### setWeeklyTrigger(weekday, hour, minute, repeats)

Sets the notification to be triggered weekly.

```typescript
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.

#### Parameters

**`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.