Creating Custom Notifications
To create a custom notification:
Subclass
exengine.base_classes.NotificationUse Python’s
@dataclassdecoratorDefine
category(fromexengine.notifications.NotificationCategoryenum) anddescription(string) as class variablesOptionally, specify a payload type using a type hint in the class inheritance. For example,
class MyCustomNotification(Notification[str])indicates this notification’s payload will be a string.
Keep payloads lightweight for efficient processing. Example:
from dataclasses import dataclass
from exengine.base_classes import Notification
from exengine.notifications import NotificationCategory
@dataclass
class MyCustomNotification(Notification[str]):
category = NotificationCategory.Device
description = "A custom device status update"
# Usage
notification = MyCustomNotification(payload="Device XYZ is ready")