Interact with Telegram Bots in Laravel with Telegraph


Telegraph is a Laravel package for fluently interacting with Telegram Bots. It provides some key features that make it easier to set up and interact with users via Bots:

  • Create Bots
  • Add Bots to Chats
  • Create new Chats
  • Send Telegram Messages
  • Attach a keyboard to a message
  • Queue messages via Laravel queues
  • Make Telegram API calls
  • Webhooks to receive incoming Telegram messages

Attaching a keyboard to a message gives the user some easy options for responding to a message. For example, buttons to delete a resource or open a URL:

1Telegraph::message('hello world')

2 ->keyboard(Keyboard::make()->buttons([

3 Button::make('Delete')->action('delete')->param('id', '42'),

4 Button::make('open')->url(''),

5 ]))->send();

This package provides a few settings that you can configure via the CLI or programmatically to create chats dynamically. For example, once you set up a Telegram bot, you can register programmatically:

1$bot = TelegraphBot::create([

2 'token' => $token,

3 'name' => $name,


View the Telegraph documentation to get started with this package. You can also view the source code on GitHub, which gives instructions on getting started in the README.

Source link

Leave a reply

Please enter your comment!
Please enter your name here