PHPackages                             sergio-item/telegram - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sergio-item/telegram

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sergio-item/telegram
====================

Telegram bot utilities

1.0.2(3y ago)071MITPHPPHP ^7.4|^8.0

Since Oct 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sergio-item/telegram)[ Packagist](https://packagist.org/packages/sergio-item/telegram)[ Docs](https://github.com/sergio-item/telegram)[ RSS](/packages/sergio-item-telegram/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Telegram Bot Utilities
======================

[](#telegram-bot-utilities)

> Laravel Package

[![Latest Version on Packagist](https://camo.githubusercontent.com/3627ae5ec5d36bea43e591c7db3f534c588b02e312523c2235b9fc35c10845f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73657267696f2d6974656d2f74656c656772616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sergio-item/telegram)[![Total Downloads](https://camo.githubusercontent.com/f616e8b4c38f9e17364a21b459850df93ee0007267f357013c2278ab9e8c6c1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73657267696f2d6974656d2f74656c656772616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sergio-item/telegram)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require sergio-item/telegram
```

[Lumen installation](docs/lumen.md)

Add Telegram variables to your `.env` file

```
TELEGRAM_BOT=""
TELEGRAM_CHAT_IDS="" # Can be multiple values separated by commas or semicolons
TELEGRAM_MANAGE_WEBHOOK_URL="" # Default is telegram-manage-webhook
```

Usage
-----

[](#usage)

Use the `Telegram` Facade to send a notification

```
use SergioItem\Telegram\Facades\Telegram;

Telegram::sendNotification($message);
```

Commands
--------

[](#commands)

Webhook related commands

```
php artisan telegram:set-webhook {url?}
php artisan telegram:remove-webhook
php artisan telegram:get-webhook-info
```

Get updates command (offset option available)

```
php artisan telegram:get-updates
php artisan telegram:get-updates --offset {updateId}
php artisan telegram:get-updates -O {updateId}
```

Send Notification command

```
php artisan telegram:send-notification {message}
```

```
# View all the commands available in the telegram namespace
php artisan list telegram
# Display help for a command
php artisan help telegram:
```

Get updates via webhook
-----------------------

[](#get-updates-via-webhook)

To automatically reply to user messages, you can use the webhook to receive user messages on your server.

First use the command to set the webhook url

```
php artisan telegram:set-webhook {url?}
```

Create `App\Services\TelegramBotWebhookManagerService` in your project with the required method `manageResponseMessage`

e.g

```
