Skip to content
docsv0.1.0

NotificationChannelInterface

Interface for notification channels. Plugins implementing this interface can send notifications to their respective channel (Telegram, Pusher, WebSocket, etc).

NotificationChannelInterface::notify()

abstract public function notify(string $recipient, Milpa\Notifications\Contracts\NotificationPayloadInterface $payload): bool

Send a notification through this channel.

Parameters

Parameters of notify()
NameTypeDescription
$recipientstringChannel-specific recipient (e.g., chat_id for Telegram)
$payloadNotificationPayloadInterfaceThe notification data

Returns

True if sent successfully

NotificationChannelInterface::getChannelName()

abstract public function getChannelName(): string

Get the channel identifier.

Returns

Channel name (e.g., 'telegram', 'pusher', 'websocket')

NotificationChannelInterface::supports()

abstract public function supports(string $payloadType): bool

Check if this channel supports the given payload type.

Parameters

Parameters of supports()
NameTypeDescription
$payloadTypestringThe type of notification (e.g., 'action_result', 'alert')