Telegram bot

Installs: 130

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0



1.0.0 2020-12-21 12:57 UTC


Latest Stable Version Total Downloads License Daily Downloads Monthly Downloads

Support chat for site based on Telegram bot

The Bot logic based on akalongman/php-telegram-bot, so you can read Instructions by longman how to register Telegram Bot and etc.

Now only telegram webhook api support. You need SSL cert! Doesn't work on http!


The preferred way to install this extension is through composer.


composer require shopium/mod-telegram

add to your config:

 'modules' => [
    'telegram' => [
        'class' => 'shopium\mod\telegram\Module',
        'PASSPHRASE' => 'passphrase for login',
        // 'db' => 'db2', //db file name from config dir
        // 'userCommandsPath' => '@app/modules/telegram/UserCommands',
        // 'timeBeforeResetChatHandler' => 60

run migrations:

php yii migrate --migrationPath=@vendor/shopium/mod-telegram/migrations #that add 4 tables in your DB

or add to your config file

'controllerMap' => [
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationNamespaces' => [

and run

php yii migrate/up

go to (if not prettyUrl

Now you can place where you want

echo \shopium\mod\telegram\TelegramWidget::widget(); //that add chat button in the page

If you want to limit the storage period of messages history, add to you crontab:

#leave 5 days (if empty - default = 7)
php yii telegram/messages/clean 5

Also you can use custom commands. To do this, you can copy UserCommands dir from /vendor/panix/mod-telegram/defaults and add path to this in config, for example:

'userCommandsPath' => '@app/modules/telegram/UserCommands'

timeBeforeResetChatHandler - the number of minutes before chat handler will be killed (if he forgot do /leavedialog). Never kill if 0 or not setted.