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.
Available recipes
Section titled “Available recipes”| CMS / platform | What we cover |
|---|---|
| WordPress | Comments, registrations, updates, WooCommerce orders |
| 1C-Битрикс | Orders, forms, errors, agent jobs |
| Drupal | Node hooks, watchdog, new users |
| MODX | Form events, resources, plugins |
Universal helper function for PHP
Section titled “Universal helper function for PHP”All four recipes use the same micro-function. Put it into the CMS system autoload script:
<?phpfunction 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.
General principles
Section titled “General principles”- 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_cachewill do.