All Projects → onmotion → yii2-telegram

onmotion / yii2-telegram

Licence: GPL-3.0 license
Support chat for site based on Telegram bot

Programming Languages

PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to yii2-telegram

yii2-stat
Yii2 Multi Web Statistic Module (yametrika, google-analytic, own db-counter)
Stars: ✭ 18 (-63.27%)
Mutual labels:  yii2, yii2-extension, yii2-modules
yii2-queuemanager
Yii2 Queue Manager (Analytic & Monitor)
Stars: ✭ 18 (-63.27%)
Mutual labels:  yii2, yii2-extension, yii2-modules
yii2-blog
Simple, configurable blog module for Yii2 (post, comment, nested category, tags). + frontend, backend. + SEO! (Opengraph, Schema.org) ~~~COMING SOON V2.0~~~ Please STAR this repo
Stars: ✭ 79 (+61.22%)
Mutual labels:  yii2, yii2-extension, yii2-modules
background-translation-i18n
Based on the YII2 module to translate JSON formatted translation files on the web
Stars: ✭ 11 (-77.55%)
Mutual labels:  yii2, yii2-extension, yii2-modules
yii2-formbuilder
A drag and drop form builder with jQuery for Yii2
Stars: ✭ 33 (-32.65%)
Mutual labels:  yii2, yii2-extension
yii2-user
Flexible user registration and authentication module for Yii2.
Stars: ✭ 24 (-51.02%)
Mutual labels:  yii2, yii2-extension
filedb
ActiveRecord for static data definitions based on files
Stars: ✭ 72 (+46.94%)
Mutual labels:  yii2, yii2-extension
yii2-tinymce
Yii2 extension, tinymce wysiwyg editor
Stars: ✭ 16 (-67.35%)
Mutual labels:  yii2, yii2-extension
yii2-ion-slider
Easily customizable range slider with skins support.
Stars: ✭ 21 (-57.14%)
Mutual labels:  yii2, yii2-extension
yii2-lock-form
disable the button when form submit
Stars: ✭ 37 (-24.49%)
Mutual labels:  yii2, yii2-extension
ar-role
ActiveRecord behavior, which provides relation roles (table inheritance)
Stars: ✭ 34 (-30.61%)
Mutual labels:  yii2, yii2-extension
yii2-js-urlmanager
That extension provide a way to create urls from your frontend part.
Stars: ✭ 53 (+8.16%)
Mutual labels:  yii2, yii2-extension
yii2-fileapi-widget
Yii2 FileAPI widget.
Stars: ✭ 51 (+4.08%)
Mutual labels:  yii2, yii2-extension
yii2-merit
Reputation engine for Yii2 用于实现积分,等级功能的设计
Stars: ✭ 16 (-67.35%)
Mutual labels:  yii2, yii2-extension
yii2-emoji
😄 this is a emoji extension of yii2.
Stars: ✭ 17 (-65.31%)
Mutual labels:  yii2, yii2-extension
yii2-link-preview
LinkPreview widget render page preview
Stars: ✭ 26 (-46.94%)
Mutual labels:  yii2, yii2-extension
yii2-payment
Yii2 Payment extension hổ trợ tích hợp các cổng thanh toán VnPayment, Onepay, Bảo Kim, Ngân Lượng, VTCPay, MoMo.
Stars: ✭ 20 (-59.18%)
Mutual labels:  yii2, yii2-extension
ar-variation
Variation behavior for ActiveRecord
Stars: ✭ 46 (-6.12%)
Mutual labels:  yii2, yii2-extension
yii2-timezone
Timezone detector
Stars: ✭ 14 (-71.43%)
Mutual labels:  yii2, yii2-extension
yii2-ledap
yii2 for ledap
Stars: ✭ 20 (-59.18%)
Mutual labels:  yii2, yii2-extension

Telegram support Bot for Yii2

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!

Installation

The preferred way to install this extension is through composer.

Run

composer require onmotion/yii2-telegram

add to your web config:

 'modules' => [
     //...
    'telegram' => [
        'class' => 'onmotion\telegram\Module',
        'API_KEY' => 'forexample241875489:AdfgdfFuVJdsKa1cycuxra36g4dfgt66',
        'BOT_NAME' => 'YourBotName_bot',
        'hook_url' => 'https://yourhost.com/telegram/default/hook', // must be https! (if not prettyUrl https://yourhost.com/index.php?r=telegram/default/hook)
        'PASSPHRASE' => 'passphrase for login',
        // 'db' => 'db2', //db file name from config dir
        // 'userCommandsPath' => '@app/modules/telegram/UserCommands',
        // 'timeBeforeResetChatHandler' => 60
    ]
    //more...
 ]

and to console config:

 'bootstrap' => [   
 //other bootstrap components...
                'telegram'],
 'modules' => [
         //...
     'telegram' => [
         'class' => 'onmotion\telegram\Module',
         'API_KEY' => 'forexample241875489:AdfgdfFuVJdsKa1cycuxra36g4dfgt66',
         'BOT_NAME' => 'YourBotName_bot',
     'hook_url' => 'https://yourhost.com/telegram/default/hook', // must be https! (if not prettyUrl https://yourhost.com/index.php?r=telegram/default/hook)
         'PASSPHRASE' => 'passphrase for login',
     ]
 ],       

run migrations:

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

or add to your config file

'controllerMap' => [
    ...
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationNamespaces' => [
            'onmotion\telegram\migrations',
        ],
    ],
    ...
],

and run

php yii migrate/up

go to https://yourhost.com/telegram/default/set-webhook (if not prettyUrl https://yourhost.com/index.php?r=telegram/default/set-webhook)

Now you can place where you want

echo \onmotion\telegram\Telegram::widget(); //that add chat button in the page

in bottom right corner you can see:

chat button

if you click it:

client chat

and server side:

client chat

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/onmotion/yii2-telegram/Commands 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].