Telegram\Bot\Api::removeWebhook PHP Method

removeWebhook() public method

Removes the outgoing webhook (if any).
public removeWebhook ( ) : TelegramResponse
return TelegramResponse
    public function removeWebhook()
    {
        $url = '';
        return $this->post('setWebhook', compact('url'));
    }

Usage Example

Example #1
0
 /**
  * App constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->match('/', function () {
         return '/';
     });
     /**
      * process messages
      */
     $this->match('update', function () {
         $telegram = new Client(BOT_TOKEN);
         $handler = new Handler($telegram);
         return $handler->handle();
     });
     /**
      * update hook settings/api
      */
     $this->match('hook', function () {
         $telegram = new Api(BOT_TOKEN);
         $telegram->removeWebhook();
         if (USE_WEBHOOK) {
             $telegram->setWebhook(WEBHOOK, '../server-setup/files/cert/nginx.crt');
             return 'hook set';
         }
         return 'hook-removed';
     });
 }
All Usage Examples Of Telegram\Bot\Api::removeWebhook