Skip to content

Commit

Permalink
Example for forward new messages to Telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
vitormattos committed Aug 29, 2020
1 parent 339e2e6 commit d8d2bd8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions example.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
$TelegramClient = new TelegramClient('http://selenium-hub:4444/wd/hub', $capabilities);
$TelegramClient->sessionStart();

// $TelegramClient->observer();
$TelegramClient->loop(function(TelegramClient $client, $messages) {
foreach ($messages as $message) {
$client->telegram()->sendMessage([
'chat_id' => $_ENV['TELEGRAM_CHAT_ID'],
'text' => $message['body']
]);
}
});
// $TelegramClient->WsapiWrapper->getProfilePicFromId('[email protected]');
$TelegramClient->WsapiWrapper->sendMessage('[email protected]', '<3');
// $TelegramClient->WsapiWrapper->sendMessage('[email protected]', '<3');

0 comments on commit d8d2bd8

Please sign in to comment.