Laravel Magazine

Fluently interaction with Telegram Bots in Laravel

Eric Van Johnson · Packages
Fluently interaction with Telegram Bots in Laravel

Not a long time ago (Feb. 25th), Fabio Ivona announced the release of a package called "Telegraph" whis is "a Laravel package for fluently interaction with Telegram Bots". The package looks really interesting because it simplifies the process of working with Telegram's API.

It's as easy as:

Telegraph::message('hello')->send();
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Registering a bot with Telegraph

The process of creating a new both is pretty straightforward. The package supports two ways:

Running an artisan command:

php artisan telegraph:new-bot

After running this command, you'll be directed through a bot creation process, which will allow you to establish a new conversation and set up a bot webhook.

The second way in wich you can create a new bot is by using the TelegraphBot model to generate the new bot and that's useful if you're implementing custom logic:

$bot = TelegraphBot::create([
    'token' => $token,
    'name' => $name,
]);

I'm planing to create a Telegram channel for Laravel Magazine and I will play with this package more and I intend to maybe come up with either a video or a tutorial how to work with Telegraph in a Laravel application.

I reccomend checking out Telegraph's documentation and the Github Repo for more useful informations and an installation guide.

Stay Updated

Subscribe to our newsletter

Get latest news, tutorials, community articles and podcast episodes delivered to your inbox.

Weekly articles
We send a new issue of the newsletter every week on Friday.
No spam
We'll never share your email address and you can opt out at any time.