.. _extending_notification_service: ############################# Adding a notification service ############################# Post Status Notifier has a built-in email notification service. But it is easy to implement custom notification services. After the built-in services have been loaded, PSN triggers the action ``psn_after_load_services`` which you can use to register your custom notification service. Let's say you put the logic for your custom service in a class file **MyService.php** located in the Example module's subdirectory lib/Service: .. code:: jinja Example └ lib └ Service └ MyService.php In the module's bootstrap.php you can load your service like this: .. code:: getPathinfo()->getRootLib() . 'Service/MyService.php'; // add the service to the notification service manager $notificationManager->addService(new Psn_Module_Example_Service_MyService($this->_pm)); } The callback function for the action ``psn_after_load_services`` expects one parameter, an object of type ``Psn_Notification_Manager``. This is PSN's Notification Manager object. Use it to add your service with the method ``addService``. ************** Service object ************** A Post Status Notifier service object must implement the interface ``Psn_Notification_Service_Interface`` to be accepted by the Notification Manager's addService method. Following the interface, the notification service object must implement the method ``execute``. It receives **two parameters**, the **notification rule object** which matched the post status transition and the WordPress **post object** of the post which got changed. .. code::