summaryrefslogtreecommitdiff
path: root/doc/plugin-notifications.markdown
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-17 22:19:49 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-17 22:19:49 -0400
commit09da289c2fb18475f372bee24e885617da484e0b (patch)
tree95d1869ba3236ccdd9234d7909fc16c495c84d44 /doc/plugin-notifications.markdown
parent9283fb88d80cb355ff98364a9a57b657fc511d98 (diff)
Move slack, hipchat and jabber integrations to plugins
Diffstat (limited to 'doc/plugin-notifications.markdown')
-rw-r--r--doc/plugin-notifications.markdown60
1 files changed, 60 insertions, 0 deletions
diff --git a/doc/plugin-notifications.markdown b/doc/plugin-notifications.markdown
new file mode 100644
index 00000000..83fdb5e3
--- /dev/null
+++ b/doc/plugin-notifications.markdown
@@ -0,0 +1,60 @@
+Add Notification Types with Plugins
+===================================
+
+You can send notifications to almost any system by adding a new type.
+There are two kinds of notifications: project and user.
+
+- Project: Notifications configured at the project level
+- User: Notifications sent individually and configured at the user profile
+
+Register a new notification type
+--------------------------------
+
+In your plugin registration file call the method `setType()`:
+
+```php
+$this->userNotificationType->setType('irc', t('IRC'), '\Kanboard\Plugin\IRC\Notification\IrcHandler');
+$this->projectNotificationType->setType('irc', t('IRC'), '\Kanboard\Plugin\IRC\Notification\IrcHandler');
+```
+
+Your handler can be registered for user or project notification. You don't necessary need to support both.
+
+When your handler is registered, the end-user can choose to receive the new notification type or not.
+
+Notification Handler
+--------------------
+
+Your notification handler must implements the interface `Kanboard\Notification\NotificationInterface`:
+
+```php
+interface NotificationInterface
+{
+ /**
+ * Send notification to a user
+ *
+ * @access public
+ * @param array $user
+ * @param string $event_name
+ * @param array $event_data
+ */
+ public function notifyUser(array $user, $event_name, array $event_data);
+
+ /**
+ * Send notification to a project
+ *
+ * @access public
+ * @param array $project
+ * @param string $event_name
+ * @param array $event_data
+ */
+ public function notifyProject(array $project, $event_name, array $event_data);
+}
+```
+
+Example of notification plugins
+-------------------------------
+
+- [Slack](https://github.com/kanboard/plugin-slack)
+- [Hipchat](https://github.com/kanboard/plugin-hipchat)
+- [Jabber](https://github.com/kanboard/plugin-jabber)
+