Skip to content
Last updated

WHMCS\Module\Contracts\NotificationModuleInterface

Interface

Notification Module Interface

All Notification modules must implement this interface

Methods

settings

public function settings()

List of settings required for module activation/configuration

EX. return [ 'api_username' => [ 'FriendlyName' => 'API Username', 'Type' => 'text', 'Description' => 'Required username to authenticate with message service', ], 'api_password' => [ 'FriendlyName' => 'API Password', 'Type' => 'text', 'Description' => 'Required password to authenticate with message service', ], ];

Returns array

isActive

public function isActive()

Is this notification provider active?

Returns bool

getName

public function getName()

Returns bare class name of the specific notification module. EX. 'Hipchat' or 'Aim' or 'MyMessageModerator'

Returns string

getDisplayName

public function getDisplayName()

Get display name for the notification module.

Returns string

getLogoPath

public function getLogoPath()

Logo of provider.

Publicly accessible path relative to WHMCS System URL. Expressed as "absolute" path (leading forward slash) EX. '/modules/notifications/messagemod/messagemod.png'

Returns string

testConnection

public function testConnection($settings)

Routine to validate settings for activation/configuration of notification provider

Parameters

TypeNameDescription
array$settings

Returns bool — Return true for success

notificationSettings

public function notificationSettings()

List of settings relevant to the delivery of a notification

EX. ['channel' => [ 'FriendlyName' => 'Channel', 'Type' => 'dynamic', 'Description' => 'Select the desired channel for notification delivery.', 'Required' => true, ], ]

Returns array

getDynamicField

public function getDynamicField($fieldName, $settings)

Retrieve option values used to populate a 'dynamic' Type notification setting

Parameters

TypeNameDescription
string$fieldNameNotification setting field name
array$settingsSettings for the module

Returns array

sendNotification

public function sendNotification(NotificationInterface $notification, $moduleSettings, $notificationSettings)

Deliver notification

Parameters

TypeNameDescription
NotificationInterface$notificationA notification to send
array$moduleSettingsConfigured settings of the notification module
array$notificationSettingsConfigured notification settings set by the triggered rule