verifyProVersion(); $this->validateToken($token); $request = App::getInstance('request'); return (new SlackNotification())->processSlackEvent($request->get('event')); } /** * verifyProVersion method will check if the pro version is installed or not * @throws Exception * @return boolean | Exception */ private function verifyProVersion () { if (!defined('FLUENTSUPPORTPRO')) { throw new \Exception('Slack Integration requires pro version of Fluent Support', 400); } return true; } /** * validateToken method will check if the token is valid or not * @param string $token * @throws Exception * @return boolean | Exception */ private function validateToken ($token) { if (!hash_equals(\FluentSupportPro\App\Services\Integrations\Slack\SlackHelper::getWebhookToken(), $token)) { throw new \Exception('Bot Token could not be verified', 403); } return true; } }