Configuring Notifications

Sending notifications

There are several ways to receive notifications in the Control panel:

  • via email;

You must specify your email address.

  • via SMS;

You need to purchase an SMS package to subscribe to SMS. You can replenish the balance on the “Contacts” page. Only Russian/Ukrainian phone numbers are allowed. This is due to the higher cost for SMS to phone numbers in other countries.

  • via HTTP requests.

Receiving and processing HTTP requests

For GET requests:

  1. Create a .php file in the directory with the site.
  2. Select MonitoringNotification centerContacts in the Control panel.
  3. Add the absolute address of the file link as an HTTP contact, for example: http://test-http-get.ru/log.php. The Control panel will display a message with the expected response, which the log.php script should give.
  4. Add the following code to the script file:

    ?php
    echo "5ca8ada39381ec79e881132b1fa3dac3"; // where 5ca8ada39381ec79e881132b1fa3dac3 is the code from the panel
    ?
  5. Click Confirm in the Control panel.

  6. Once the confirmation is complete, modify the log.php file and add a working script to it.

Script example

The specified script sends a message to Telegram messenger if a new entry appears in the monitoring message log:

  1. Create a log directory in the root of the site.
  2. Create a file named get.log to log GET requests.
  3. Add the log.php to the same directory with the following contents:

    ?php
    $file_get = $_SERVER["DOCUMENT_ROOT"] . "/modules/log/get.log";
    if (!empty($_GET)) {
    $fw = fopen($file_get, "a");
    fwrite($fw, "GET " . var_export($_GET, true));
    fclose($fw);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,
    "https://api.telegram.org/bot864190220:AAGY3To77NuySjaGmupS7PfEQy952V08QOA/sendMessage?chat_id=217490943&text='New entry in the monitoring file: http://test-http-get.ru/modules/log/get.log'");
    $result=curl_exec($ch);
    curl_close($ch);
    	}
    ?

To get a chat ID:

  1. Start a chat with the bot from your account.
  2. Get the list of updates for your bot:

    https://api.telegram.org/bot<YourBOTToken>/getUpdates
  3. Copy the value of the chat_id parameter.

The script is configured as follows:

  1. Using the var_export function, the script records information about the GET request to get.log.
  2. Specify the key (token) of the Telegram bot instead of 864190220:AAGY3To77NuySjaGmupS7PfEQy952V08QOA.
  3. Specify the chat ID with the bot in the chat_id parameter.
  4. Specify the address of the link to the file instead of http://test-http-get.ru/get.log.