Это старая версия документа!
Telegram BOT API (Yii2)
Создание / Регистрация бота
Описание
Webhook
Простой пример приветствия завязанного на Webhook, реализованного на Yii2 с помощью. Обязательное наличиче SSL. И хук должен отправляться на https:**
<code php>
class APIController {
public $API_KEY = 'your_bot_api_key';
public $BOT_NAME = 'namebot';
public $API_CERTIFICATE = '';
public function init(){
try {
$telegram = new Longman\TelegramBot\Telegram($this→API_KEY, $this→BOT_NAME);
echo $telegram→setWebHook('https://yourdomain/api/init', $this→API_CERTIFICATE);
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
echo $e→getMessage();
}
}
public function actionInit(){
try {
$telegram = new Longman\TelegramBot\Telegram($this→API_KEY, $this→BOT_NAME);
$telegram→addCommandsPath(Yii::getAlias('@app\commands'));
$telegram→handle();
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
echo $e→getMessage();
}
}
}
</code>
==== getUpdate ====
===== SSL for WebHook =====
* http://www.startssl.com/ (free for noncommerce)
* https://buy.wosign.com/free/?lan=en
===== Исходники =====
===== Yii2 =====
* https://github.com/SonkoDmitry/yii2-telegram-bot-api
==== PHP ====
* https://github.com/TelegramBot/Api
* https://github.com/akalongman/php-telegram-bot
* https://github.com/Ardakilic/Telegram-bot-php
* https://github.com/Surzhikov/TelegramSiteHelper
* https://github.com/zelenin/telegram-bot-api
* https://github.com/mgp25/Telegram-Bot-API
* https://github.com/NeonXP/TelegramApi
* https://github.com/pathetic/tgbot-php
* https://github.com/paranoiasystem/TelegramBot-PHP-library
* https://github.com/matriphe/telegrambot
* https://github.com/smoqadam/php-telegram-bot
* https://github.com/Surzhikov/TelegramSiteHelper
* https://github.com/irazasyed/telegram-bot-sdk
==== Examples / Примеры ====
* https://core.telegram.org/bots/samples/hellobot
* https://github.com/kolar/telegram-poll-bot (Longpoll)
==== API ====
* https://core.telegram.org/bots/api
===== Статьи =====
* http://habrahabr.ru/post/264035/
* http://olegorestov.ru/this/bitrix_php_telegram_bot/
* https://github.com/Surzhikov/TelegramSiteHelper/wiki/%D0%9A%D0%90%D0%9A-%D0%A3%D0%A1%D0%A2%D0%90%D0%9D%D0%9E%D0%92%D0%98%D0%A2%D0%AC