Slack Notifications > Invisionize.eu - IP.Board (IPB) News
Kanał Rss Kanał Rss
Kanał Atom Kanał Atom

Slack Notifications

wersja drukowalna wersja Microsoft Word wersja HTML

Integrate Your Community Into The Workplace!

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. Slack Notifications works on the frontend notification system and allows your community members to add as many slack 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. 

slackPoster.thumb.png.bcb7ba16e6407e274dae7ffab87f5bde.png

Developers

The Slack Notification class extends IPSNotification and works as a hook within the send() method. The Slack Notifications class constructor depends on an IPSNotification 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 IPSslackNotification;

/**
* Slack Constructor
*
* @param IPSNotification $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 IPSUrl|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( IPSNotification $notification, $title=NULL, $pretext=NULL, $text=NULL, IPSHttpUrl $url=NULL, $fields=array() )
{
    // Set class properties
    $this->title = $title;
    $this->pretext = $pretext == NULL ? IPSMember::loggedIn()->language()->addToStack( 'slack_notifications_auto_pretext', FALSE, array( 'sprintf' => array( IPSSettings::i()->board_name ) ) ) : $pretext;
    $this->text = $text;
    $this->url = $url;
    $this->fields = $fields;
    $this->notification = $notification;
}

Example (Using native Notification class)

// Example of a IPSContent item
$notification = new IPSNotification( IPSApplication::load('core'), 'notification_key', $this->item(), array( $this ) );
$notification->recpients->attach( IPSMember::loggedIn() );
$notification->send();

Example (Send only a Slack Notification)

// Example of a IPSContent item
$notification = new IPSNotification( IPSApplication::load('core'), 'notification_key', $this->item(), array( $this ) );
$notification->recpients->attach( IPSMember::loggedIn() );
$slack = new IPSslackNotificationSlack( $notification );
$slack->sendSlackNotifications();

 

nie, 24 listopad 2019