Greetings, with the industry standard of Single Sign-On (SSO) continually increasing, the need to provided authentication and authorization…
Integrate Your Community Into The Workplace with Slack Notifications!
Bring together your Invision Power Board community with the ultimate collaboration hub for your team! Slack Notifications leverages the internal notification system of Invision Power Board to relay all your important notifications to your Slack account. This applications works on the frontend notification system and allows your community members to add as many channels as they want, routing all their notifications to multiple channels, all from within Invision Power Board. This application is plug and play and allows your community to customize and configure their notifications independently of one another.
Slack Notifications can also work with third party notifications and be integrated into custom applications for Developers.
Developers
The application class extends \IPS\Notification and works as a hook within the send() method. The Slack Notifications class constructor depends on an \IPS\Notification injection and can be optionally configured with several other parameters. See the documentation below for more information and example case use.
Slack Notification Class Constructor
namespace IPS\slack\Notification;
/**
* Slack Constructor
*
* @param \IPS\Notification $notification The notification used to construct the slack notification
* @param null $title The notification title. If not used, the notification text will be used.
* @param null $pretext Optional pretext. Will default to basic notification string.
* @param null $text Optional text. Not used if nothing is passed.
* @param \IPS\Url|NULL $url Optional URL for the title. If not used, the notification link will be used.
* @param array $fields Optional fields. Example: array( 'title' => 'Field 1', 'value' => 'Test Value' );
*/
public function __construct( \IPS\Notification $notification, $title=NULL, $pretext=NULL, $text=NULL, \IPS\Http\Url $url=NULL, $fields=array() )
{
// Set class properties
$this->title = $title;
$this->pretext = $pretext == NULL ? \IPS\Member::loggedIn()->language()->addToStack( 'slack_notifications_auto_pretext', FALSE, array( 'sprintf' => array( \IPS\Settings::i()->board_name ) ) ) : $pretext;
$this->text = $text;
$this->url = $url;
$this->fields = $fields;
$this->notification = $notification;
}
Example:
// Example of a \IPS\Content item
$notification = new \IPS\Notification( \IPS\Application::load('core'), 'notification_key', $this->item(), array( $this ) );
$notification->recpients->attach( \IPS\Member::loggedIn() );
$notification->send();
Example 2:
// Example of a \IPS\Content item
$notification = new \IPS\Notification( \IPS\Application::load('core'), 'notification_key', $this->item(), array( $this ) );
$notification->recpients->attach( \IPS\Member::loggedIn() );
$slack = new \IPS\slack\Notification\Slack( $notification );
$slack->sendSlackNotifications();