Longman\TelegramBot\Telegram::setWebHook PHP Method

setWebHook() public method

Set Webhook for bot
public setWebHook ( string $url, string | null $path_certificate = null ) : ServerResponse
$url string
$path_certificate string | null
return Longman\TelegramBot\Entities\ServerResponse
    public function setWebHook($url, $path_certificate = null)
    {
        if (empty($url)) {
            throw new TelegramException('Hook url is empty!');
        }
        $result = Request::setWebhook($url, $path_certificate);
        if (!$result->isOk()) {
            throw new TelegramException('Webhook was not set! Error: ' . $result->getErrorCode() . ' ' . $result->getDescription());
        }
        return $result;
    }