DEF STUDIO srl

Unregistering Webhooks

A webhook can be unergistered from a telegraph bot. This can be accomplished both programmatically and through an artisan command

artisan command

You can unregister a webhook calling the telegraph:unset-webhook artisan command:

php artisan telegraph:unset-webhook

programmatically

if you are implementing a custom bot management logic, you can unregister a webhook using the TelegraphBot model:

/** @var DefStudio\Telegraph\Models\TelegraphBot $telegraphBot */

$telegraphBot->unregisterWebhook()->send();

Pending updates

It may happen that there are pending message updates when deleting a webhook. By default they are kept in order to retrieve them through a manual polling. To drop these updates, use the --drop-pending-updates artisan command option

php artisan telegraph:unset-webhook --drop-pending-updates

or using a parameter inside the method call:

$dropPendingUpdates = true;

$telegraphBot->unregisterWebhook($dropPendingUpdates)->send();
Suggest a change
Last updated 23 December 2024