1. Go to this page and download the library: Download rakshazi/telegram-notify library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rakshazi / telegram-notify example snippets
$config = [
'token' => '<BOT TOKEN>',
'notifications' => [
[
'chat_id' => '<YOUR CHAT ID>',
'parse_mode' => 'HTML', //currently supported only 'HTML'
'notify' => [ //List of integrations, you can add multiple accounts for each service and multiple services
[
//RSS integration will post you messages with new items in feed
'type' => 'RSS', //Integration type
'source' => 'https://www.teamoctos.com/category/changelog/feed/' //Feed source URL
],
[
'type' => 'Email', //Works with any IMAP server
'source' => [
'mailbox' => '{imap.gmail.com:993/imap/ssl}INBOX', //@link https://secure.php.net/manual/ru/function.imap-open.php
'user' => '[email protected]', // your login
'password' => 'example-password' // your password
]
],
[
'type' => 'Trello', //Get all unread notifications from trello
'source' => [
'api_key' => 'trello-app-key', //https://trello.com/app-key
'token' => 'trello-user-token' //https://developers.trello.com/authorize
],
]
],
],
],
];
//Arguments: chat id, message text
//Must return bool
$isSent = function (string $chatId, string $message) {
$key = md5($chatId.$message);
$sent = new \Packer\Packer('./sent.pack');
if ($sent->exists($key)) {
return true;
}
$sent->write($key, $message);
return false;
};