Jump to content

Marketplace

Slack Notifications 1.0.1

$8.00

   (0 reviews)

3 Screenshots

About This File

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 \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 (Using native Notification class)

// 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 (Send only a Slack Notification)

// 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();

 




User Feedback

You may only provide a review once you have downloaded the file.

There are no reviews to display.

×
×
  • Create New...