2017 © Pedro Peláez
 

yii2-extension yii2-slack

Object oriented Yii2 integration to Slack Incoming WebHooks

image

futuretek/yii2-slack

Object oriented Yii2 integration to Slack Incoming WebHooks

  • Wednesday, November 22, 2017
  • by futuretek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 38 % Grown

The README.md

Yii2 Slack Integration

Object oriented integration to Slack Incoming WebHooks, (*1)

Usage

For detailed documentation see PhpDocs, (*2)

//Create attachment
$attachment = new Attachment();
$attachment->fallback = $attachment->preText;
$attachment->title = 'Issue was resolved';
$attachment->color = Attachment::COLOR_GOOD;
$attachment->titleLink = 'http://some.url/';
$attachment->authorName = 'Issue tracker';
$attachment->authorLink = Url::to(['/'], true);

//Create some attachment fields
$field = new AttachmentField();
$field->title = 'Priority';
$field->value = 'Critical';
$field->short = true;
$attachment->fields[] = $field;

$field = new AttachmentField();
$field->title = 'Status';
$field->value = 'Resolved';
$field->short = true;
$attachment->fields[] = $field;

//Create message
$message = new ChatPostMessage();
$message->attachments[] = $attachment;
$message->iconEmoji = 'headphones2';
$message->linkNames = true;
$message->username = 'Issue tracker';
$payload->channel = '#general';

//Init Webhook and send message
$client = new IncomingWebhookApi(['url' => Yii::$app->params['slack.webhook.url']]);
$response = $client->send($message);

//Check for errors
if ($response->hasErrors) {
    Yii::warning(SlackResponse::getErrorMessage($response->error), 'slack');
}

The Versions

22/11 2017

dev-master

9999999-dev http://www.futuretek.cz/

Object oriented Yii2 integration to Slack Incoming WebHooks

  Sources   Download

Apache-2.0

The Requires

 

extension yii messaging slack integration

22/11 2017

1.0.2

1.0.2.0 http://www.futuretek.cz/

Object oriented Yii2 integration to Slack Incoming WebHooks

  Sources   Download

Apache-2.0

The Requires

 

extension yii messaging slack integration

15/09 2017

1.0.0

1.0.0.0 http://www.futuretek.cz/

Yii2 Slack integration

  Sources   Download

Apache-2.0

The Requires

 

extension yii messaging slack integration