kostikpenzin/yii2-slackbot

Yii bot for sending messages (alerts) to Slack

v0.1.4 2021-06-08 14:30 UTC

README

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads

Yii bot for sending messages (alerts) to Slack.

Setup

Add the kostikpenzin/yii2-slackbot package to your composer.json

composer require kostikpenzin/yii2-slackbot

Add the component to your config in the components section:

'components' => [
    // ...
    'slackbot' => [
        'class' => 'kostikpenzin\SlackBot\Bot',
        '_token' => 'Asdw-111111111-2222222222-3333333333',
        '_channel' => 'Finanso_alert', // default channel
        '_username' => 'Finanso_SlackBot',
        '_icon' => ':mega:'
    ]
]

Using default settings in your Application:

\Yii::$app
  ->slackbot
  ->message('Message.')
  ->send();

Using custom settings in your Application:

\Yii::$app
  ->slackbot
  ->channel('Finanso_alert')
  ->user('Finanso_SlackBot')
  ->icon(':mega:')
  ->message('Message.')
  ->send();