function send($content) { global $app; $http = new \HTTP\HTTPRequest($app->config->slack->incoming_webhook); $http->setMethod('POST'); $http->setRequestBody(json_encode(array('channel' => '#' . $app->config->slack->announce_channel, 'text' => $content))); try { $http->send(); echo $content . "\n"; } catch (Exception $e) { } }
private function sendPublicMsg($channel, $msg) { $http = new \HTTP\HTTPRequest($this->app->config->slack->incoming_webhook); $http->setMethod('POST'); $http->setRequestBody(json_encode(array('channel' => '#' . $channel, 'text' => $msg))); try { $http->send(); } catch (Exception $e) { } }