Yii2 Telegram bot.
The preferred way to install this extension is through composer.
Either run
composer require agtong/yii2-telegram-bot
or add
"agtong/yii2-telegram-bot": "*"
to the require section of your composer.json
file.
Use the below code to send a message.
$bot = new TelegramBot(['token' => '123456:abcde');
$bot->sendMessage('123456', 'Hello World!');
The sendMessage
function and it's optional paramters are shown below.
sendMessage($chat_id, $text, $parse_mode = null, $disable_web_page_preview = null, $disable_notification = null, $reply_to_message_id = null, $reply_markup = null)
Read more about the parameters here.