DEF STUDIO srl

Register Webhooks

In order to receive Telegram updates through a webhook, it has to be registered to a specific bot. This can be accomplished both programmatically and through an artisan command

artisan command

You can register a webhook calling the telegraph:set-webhook artisan command:

php artisan telegraph:set-webhook

programmatically

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

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

$telegraphBot->registerWebhook()->send();
Warning

Manual updates polling is not available if a webhook is set up for the bot. Webhook should be remove first using its unregisterWebhook method

Routes

Telegraph register a route to handle webhook messages. By default, the URL is: https://<server_domain>/telegraph/{token}/webhook, but it can be customized in telegraph.php config file (webhook.url) or entirely disabled (by setting its value to null)

Edit this page
Last updated 26 April 2024