public function slack() { // Instantiate with defaults, so all messages created // will be sent from 'Cyril' and to the #accounting channel // by default. Any names like @regan or #channel will also be linked. $settings = ['username' => env('SLACK_USERNAME'), 'channel' => env('SLACK_CHANNEL'), 'link_names' => true]; $client = new \Maknz\Slack\Client(env('SLACK_WEBHOOKS'), $settings); $client->send('Test Message!'); $client->to(array_get($settings, 'channel'))->send('Are we rich yet?'); $client->from('lubri')->to(array_get($settings, 'channel'))->send('Adventure time!'); return ''; }
/** * {@inheritdoc} */ public function send(array $metrics, array $params = array()) { $message = $this->formatter->format($metrics); $this->client->to($params['room'])->from($params['from'])->send($message); }
public function sendMessage($message) { $client = new \Maknz\Slack\Client($this->webhook_url); $client->to($this->channel)->send($message); }