Notification Component
With the Notification component, your script can send desktop notifications to the user. These notifications appear as standard OS-level alerts, drawing immediate attention from the user.
Usage
When implementing your script's onStart, execute, or onFinish methods, you can access the Notification component
through the provided ComponentProvider.
fun execute(provider: ComponentProvider) {
val notification = provider.notification()
// Send a simple notification
notification.show("Purchase Complete", "Your order has been successfully processed")
// Send a notification with higher urgency
notification.show("Action Required", "Payment authorization needed within 5 minutes")
}
Important Considerations
- Users can disable notifications on a global level, so it's not guaranteed that the user will actually receive the notification
- Since desktop notifications immediately attract the user's attention, they should only be used in cases where it's important to notify the user
- For less urgent messages, use the Logger component instead
Best Practices
Notifications are most appropriate for:
- Time-sensitive actions requiring user input
- Completion of long-running processes
- Critical errors that require immediate attention
- Important status updates (successful purchases, etc.)