# fluent-support/trunk/app/Services/ThirdParty/HandleSlackEvent.php

Fluent Support – Helpdesk &amp; Customer Support Ticket System, version trunk. 59 lines.

- Page: https://pluginprobe.com/plugins/fluent-support/trunk/code/app/Services/ThirdParty/HandleSlackEvent.php
- Raw: https://pluginprobe.com/plugins/fluent-support/trunk/raw/app/Services/ThirdParty/HandleSlackEvent.php
- Modified: 2026-05-20T14:52:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-support/trunk/code/app/Services/ThirdParty/HandleSlackEvent.php#L10-L20`.

```php
<?php

namespace FluentSupport\App\Services\ThirdParty;

use Exception;
use FluentSupport\App\App;
use FluentSupportPro\App\Services\Integrations\Slack\SlackNotification;

class HandleSlackEvent
{

    /**
     * handleEvent method is responsible for handling slack events
     * @param string $token
     * @return bool
     * @throws Exception
     */

    public function handleEvent ( $token )
    {
        $this->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;
    }
}

```
