$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');
$media = new \TelegramBot\Api\Types\InputMedia\ArrayOfInputMedia();
$media->addItem(new TelegramBot\Api\Types\InputMedia\InputMediaPhoto('https://avatars3.githubusercontent.com/u/9335727'));
$media->addItem(new TelegramBot\Api\Types\InputMedia\InputMediaPhoto('https://avatars3.githubusercontent.com/u/9335727'));
// Same for video
// $media->addItem(new TelegramBot\Api\Types\InputMedia\InputMediaVideo('http://clips.vorwaerts-gmbh.de/VfE_html5.mp4'));
$bot->sendMediaGroup($chatId, $media);
try {
$bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN');
//Handle /ping command
$bot->command('ping', function ($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(), 'pong!');
});
//Handle text messages
$bot->on(function (\TelegramBot\Api\Types\Update $update) use ($bot) {
$message = $update->getMessage();
$id = $message->getChat()->getId();
$bot->sendMessage($id, 'Your message: ' . $message->getText());
}, function () {
return true;
});
$bot->run();
} catch (\TelegramBot\Api\Exception $e) {
$e->getMessage();
}
composer
"opensourcewebsite-org/php-telegram-sdk": "*"
php
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');
$bot->sendMessage($chatId, $messageText);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.