# Notifications

## Methods

### <mark style="color:purple;">Create Notification</mark>

Creates a new notification.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
await window.deskifier.notifications.create({ arguments })
```

**Arguments**

* `title` <mark style="color:green;">String</mark> (Required)\
  A title for the notification, which will be displayed at the top of the notification window when it is shown.
* `body` <mark style="color:green;">String</mark> (Required)\
  The body text of the notification, which will be displayed below the title or subtitle.
* `subtitle` <mark style="color:green;">String</mark> ***macOS*** (Optional)

  A subtitle for the notification, which will be displayed below the title.
* `silent` <mark style="color:green;">Boolean</mark> (Optional)\
  Whether or not to suppress the OS notification noise when showing the notification.
* `iconDataURL` <mark style="color:green;">String</mark> (Optional)\
  A data URL for a custom notification icon.
* `hasReply` <mark style="color:green;">Boolean</mark> ***macOS*** (Optional)

  Whether or not to add an inline reply option to the notification.
* `timeoutType` <mark style="color:green;">String</mark> ***Linux*** ***Windows*** (Optional)

  The timeout duration of the notification. Can be `default` or `never`.
* `replyPlaceholder` <mark style="color:green;">String</mark> ***macOS*** (Optional)

  The placeholder to write in the inline reply input field.
* `closeButtonText` <mark style="color:green;">String</mark> ***macOS*** (Optional)\
  A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
* `toastXml` <mark style="color:green;">String</mark> ***Windows*** (Optional)

  A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.
* `notificationId` <mark style="color:green;">String</mark> (Optional)

  An identifier for the notification. If left empty, an ID will be generated.

**Returns**

* `success` <mark style="color:green;">Boolean</mark>\
  If the action was successful.
* `message` <mark style="color:green;">String</mark>\
  Additional confirmation, or error details if action was unsuccessful.
* `notificationId` <mark style="color:green;">String</mark>\
  The given or generated notification ID.

**Example**

{% code overflow="wrap" %}

```javascript
const notificationOptions = {
    title: "Hello!",
    body: "This is a notification example.",
    silent: true
};

const result = await window.deskifier.notifications.create(notificationOptions);

console.log(result.success) //true
```

{% endcode %}
{% endtab %}
{% endtabs %}

***

### <mark style="color:purple;">Set Badge Count</mark>

Sets the counter badge for current app. Setting the count to `0` will hide the badge.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
await window.deskifier.notifications.setBadgeCount({ arguments })
```

**Arguments**

* `count` <mark style="color:green;">Number</mark> (Required)

**Returns**

* `success` <mark style="color:green;">Boolean</mark>\
  If the action was successful.
* `message` <mark style="color:green;">String</mark>\
  Additional confirmation, or error details if action was unsuccessful.
  {% endtab %}
  {% endtabs %}

***

### <mark style="color:purple;">Flash Frame</mark>

Starts or stops flashing the window in the taskbar to attract user's attention.

{% hint style="info" %}
On macOS, this causes the application icon to "bounce". Additionally, on macOS, this action only works if the window isn't currently focused.
{% endhint %}

{% tabs %}
{% tab title="JavaScript" %}

```javascript
await window.deskifier.notifications.flashFrame({ arguments })
```

**Arguments**

* `flash` <mark style="color:green;">Boolean</mark> (Required)
* `windowId` <mark style="color:green;">String</mark> (Optional)\
  Defaults to the current window.

**Returns**

* `success` <mark style="color:green;">Boolean</mark>\
  If the action was successful.
* `message` <mark style="color:green;">String</mark>\
  Additional confirmation, or error details if action was unsuccessful.
  {% endtab %}
  {% endtabs %}

***

## Events

### <mark style="color:purple;">Notification Clicked</mark>

Fires when the notification is clicked by the user.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
window.deskifier.notifications.onClicked((data) => { })
```

**Arguments**

* `notificationId` <mark style="color:green;">String</mark>\
  The given or generated notification ID.
  {% endtab %}
  {% endtabs %}

***

### <mark style="color:purple;">Notification Reply</mark>

<mark style="color:purple;background-color:purple;">**macOS**</mark> Fires when the user types a reply in the notification.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
window.deskifier.notifications.onReply((data) => { })
```

**Arguments**

* `notificationId` <mark style="color:green;">String</mark>\
  The given or generated notification ID.
* `reply` <mark style="color:green;">String</mark>\
  The user reply.
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://deskifier.gitbook.io/deskifier/notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
