Display Notification
Octory PRO
Element type: Dictionary
Availability: 2.1.0+ | macOS 10.14+
Display a local notification to the user with one or more actions. It is required to allow the app to show notifications.
It's not possible to customise the notification icon yet.
When posting a new notification, the app will remove all the previously delivered ones.
Keys
Name | Type | Possible values | Required |
---|---|---|---|
Type | String | DisplayNotification | Required |
Title | String | - | Required |
Body | String | - | |
SoundName | String | - | |
Actions | Array (Notification actions) | - | |
Condition | Dictionary (Condition) | - |
Detail
Type Required
Type: String
Explanation: The type of the action has to be DisplayNotification
.
Title Required
Type: String
Explanation: The title of the notification.
Body
Type: String
Explanation: A subtext that is displayed in the notification.
SoundName
Type: String
Explanation: Optionally provide a system sound name. Otherwise the default one will be used.
Actions
Type: Array (Dictionary of Notification actions)
Explanation: The notification can offer one or more actions to the user.
Name | Type | Possible values | Required |
---|---|---|---|
Title | String | - | Required |
Trigger | String | - | Required |
Title Required
Type: String
Explanation: The title of the button to execute the action.
Trigger Required
Type: String
Explanation: The custom trigger event to send. When sent, the trigger execute the action set matching this custom trigger.
If two actions have a different title but have the same value for the Trigger
key, the titles become the same for both actions.
Condition
Type: Dictionary (Condition)
Explanation: Allows launch the action only based on a boolean expression.
Example
Display a notification with a title and a body asking to fill a form. When the "Open" action is clicked, it will trigger any action set that is triggered by the "showFom" custom trigger. The same goes for the "Later" action.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>Custom(showNotif)</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>DisplayNotification</string>
<key>Title</key>
<string>Hey you!</string>
<key>Body</key>
<string>Please fill the form</string>
<key>Actions</key>
<array>
<dict>
<key>Title</key>
<string>Open</string>
<key>Trigger</key>
<string>showForm</string>
</dict>
<dict>
<key>Title</key>
<string>Later</string>
<key>Trigger</key>
<string>showformLater</string>
</dict>
</array>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>