Skip to content

Notifly from CMS

CMS, in which dozens or hundreds of sites run, usually send mail themselves, but that’s slow and often doesn’t arrive. Notifly provides an instant channel for the site admin: new comment — push, new order — push, PHP error — push.

CMS / platformWhat we cover
WordPressComments, registrations, updates, WooCommerce orders
1C-БитриксOrders, forms, errors, agent jobs
DrupalNode hooks, watchdog, new users
MODXForm events, resources, plugins

All four recipes use the same micro-function. Put it into the CMS system autoload script:

<?php
function notifly_send(string $title, string $message, int $priority = 5): void {
$url = getenv('NOTIFLY_URL') ?: 'https://your-notifly.example.com';
$token = getenv('NOTIFLY_TOKEN') ?: 'AGdjfk_L.dKe8q';
$body = json_encode([
'title' => mb_substr($title, 0, 200),
'message' => mb_substr($message, 0, 1500),
'priority' => $priority,
], JSON_UNESCAPED_UNICODE);
$ch = curl_init("$url/message?token=$token");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => $body,
CURLOPT_TIMEOUT => 5,
CURLOPT_CONNECTTIMEOUT => 3,
]);
curl_exec($ch);
curl_close($ch);
}

It’s best to set NOTIFLY_URL and NOTIFLY_TOKEN via the PHP-FPM environment or .htaccess/SetEnv, so you don’t store the token in the code.

  • No frontend notifications. All calls — only from server-side PHP.
  • Do not send PII (names, email, addresses) unnecessarily. Show a short link to the CMS admin.
  • Throttling. During a spam wave of comments, don’t turn Notifly into a Telegram channel. A simple cache in wp_cache/bx_cache will do.