Quick Installation
- Purchase the module and download
haikhavan_notification_hub-ioncube-8.2-1.0.0-install.zipfrom your VPSrv Client Area Downloads. - Upload and extract the ZIP into your WHMCS root directory so files land in
modules/addons/haikhavan_notification_hub/. - Verify PHP 8.2–8.4 with ionCube PHP Loader 14+ / 15.5+ is enabled on your server.
- Go to System Settings → Addon Modules in WHMCS Admin, click Activate next to Haikhavan Multi-Channel Notification & SMS Hub, and assign administrator role access.
Version: 1.0.0 | Module Slug: haikhavan_notification_hub | WHMCS Compatibility: 9.1.x (8.10+ compatible) | PHP: 8.2 / 8.3 / 8.4
Haikhavan Multi-Channel Notification & SMS Hub unifies SMS Center and multi-channel ops alerting inside WHMCS. Route client and staff notifications across Twilio SMS, Twilio WhatsApp, Meta WhatsApp Cloud API, Slack, Discord, Telegram, Vonage/Nexmo SMS, and HMAC-signed Generic Webhooks—complete with automatic channel failover, Quiet Hours / DND queueing, client 6-digit OTP verification, segmented bulk broadcast campaigns, and zero-CDN delivery & cost analytics.
Haikhavan Multi-Channel Notification & SMS Hub — Technical Documentation
Module Slug: haikhavan_notification_hub | Namespace: Haikhavan\NotificationHub\ | Version: 1.0.0 | Target: WHMCS 9.1.2 (PHP 8.3+, MySQL 8.4)
1. Architecture & File Inventory
modules/addons/haikhavan_notification_hub/
├── haikhavan_notification_hub.php # WHMCS addon lifecycle callbacks & PSR-4 autoloader
├── hooks.php # 13 WHMCS hooks (10 lifecycle events + Navbar + Admin Home Widget + Cron)
├── whmcs.json # WHMCS Marketplace manifest (schema 1.0)
├── lib/
│ ├── Database.php # Schema installer (7 tables), default channels/templates/rules seeder, AES-256-CBC+HMAC crypto
│ ├── ChannelDriver.php # 8 live HTTP/cURL drivers + Sandbox Simulator (incl. FAILOVER_TEST trigger)
│ ├── NotificationEngine.php # Merge var engine, Quiet Hours/DND deferral, automatic failover, queue processor, campaigns, OTP
│ ├── AnalyticsService.php # Delivery rate, failover/DND KPIs, 7-day series, per-driver cost breakdown, sandbox seeder
│ ├── AdminController.php # 7-tab Admin UI dispatcher & CSRF-protected AJAX JSON API
│ └── ClientController.php # Client Area portal dispatcher & ownership-scoped preference/OTP AJAX handlers
├── templates/
│ ├── admin/dashboard.php # 7-tab Admin dashboard + zero-CDN HDPI Canvas charts + Test Message modal
│ └── client/portal.tpl # Smarty Client Area Preferences, OTP verification & Delivery Log
└── assets/
├── css/haikhavan_notification_hub.css # Scoped design system (.hk-notif-*)
└── js/haikhavan_notification_hub.js # Vanilla JS AJAX + HDPI HTML5 Canvas charts
2. Database Schema (mod_hk_notif_*)
2.1 mod_hk_notif_channels
Provider driver registry with encrypted credentials (slug UNIQUE, driver INDEX, display_name, enabled, priority, cost_per_msg DECIMAL(8,4), currency, config_encrypted LONGTEXT, failover_channel_id, last_test_status, last_test_at).
2.2 mod_hk_notif_templates
Merge-variable message templates (slug UNIQUE, name, event_key INDEX, channel_type, audience, subject, body, is_active).
2.3 mod_hk_notif_rules
WHMCS event-to-channel routing rules (name, event_key INDEX, audience [client|admin|staff_role|ops_channel], staff_role_id, channel_id, fallback_channel_id, template_id, respect_quiet_hours, enabled, conditions_json).
2.4 mod_hk_notif_client_prefs
Per-client bindings, opt-ins, Quiet Hours & hashed OTP state (userid UNIQUE, phone_e164, whatsapp_number, telegram_chat_id, phone_verified, whatsapp_verified, telegram_verified, opt_in_sms, opt_in_whatsapp, opt_in_telegram, events_json, quiet_hours_enabled, quiet_start, quiet_end, timezone, otp_code_hash, otp_channel, otp_expires_at).
2.5 mod_hk_notif_queue
Outbound delivery log, failover ledger & Quiet-Hours deferred queue (userid, recipient, event_key, channel_id, fallback_channel_id, driver, subject, message_body, status [queued|deferred_dnd|sent|failover_sent|failed], attempts, max_attempts, estimated_cost, provider_msg_id, error_message, failover_used, is_sandbox, scheduled_for, sent_at).
2.6 mod_hk_notif_campaigns
Bulk broadcast campaign history (name, channel_id, segment_status, segment_group_id, segment_product_id, message_body, total_recipients, sent_count, failed_count, estimated_cost, status, created_by_admin, is_sandbox, sent_at).
2.7 mod_hk_notif_audit_log
Operational audit log (userid, adminid, action, status, summary, details_json, ip_address, created_at).
3. Security Model
- Authenticated Credential Encryption: All provider secrets (
config_encrypted) are encrypted at rest viaAES-256-CBC+HMAC-SHA256(Encrypt-then-MAC, constant-timehash_equals()verification) using subkeys derived from WHMCS$cc_encryption_hash. Secret form fields remain blank/masked in Admin HTML and preserve existing encrypted values unless explicitly replaced. - Signed Generic Webhooks: Outbound generic webhooks sign every JSON payload with
X-HK-NOTIF-Signature-256: sha256=<hmac>using the configuredsigning_secret. - Salted OTP Hashing: Client 6-digit OTP codes are never stored in plaintext;
hash('sha256', "$userId|$channelType|$otp")is compared viahash_equals()with strict expiration checks. - CSRF & Client Isolation: Separate session CSRF tokens (
hk_notif_admin_csrf,hk_notif_client_csrf) enforced on every AJAX POST (HTTP403on mismatch). All client queries strictly binduserid = (int) $_SESSION['uid'].
4. Provider Drivers (ChannelDriver.php)
| Driver Key | Endpoint / Protocol | Authentication |
|---|---|---|
twilio_sms / twilio_whatsapp |
POST https://api.twilio.com/2010-04-01/Accounts/{SID}/Messages.json |
HTTP Basic (SID:Token) |
meta_whatsapp |
POST https://graph.facebook.com/v20.0/{phone_number_id}/messages |
Bearer Access Token |
slack |
Incoming Webhook URL (Block Kit JSON) | Webhook URL secret |
discord |
Discord Webhook URL (Color-coded Embeds JSON) | Webhook URL secret |
telegram |
POST https://api.telegram.org/bot{token}/sendMessage |
Bot Token |
vonage_sms |
POST https://rest.nexmo.com/sms/json |
api_key + api_secret |
webhook |
Custom HTTPS Endpoint | X-HK-NOTIF-Signature-256 HMAC |
sandbox |
Local deterministic simulator (supports FAILOVER_TEST trigger) |
None |
5. WHMCS Hooks (hooks.php)
- 10 Event Hooks:
InvoiceCreated,InvoicePaid,InvoicePaymentReminder,TicketOpen,TicketAdminReply,TicketUserReply,AfterModuleCreate,AfterModuleSuspend,ClientAdd,OrderPaid. - UI & Cron Hooks:
ClientAreaPrimaryNavbar,AdminHomeWidgets,AfterCronJob(dispatches duedeferred_dndandqueueditems).
6. AJAX API Reference
Admin (addonmodules.php?module=haikhavan_notification_hub&ajax=1 — POST + csrf_token)
save_channel, send_test, toggle_rule, create_rule, delete_rule, save_template, launch_campaign, retry_queue_item, process_queue, seed_sandbox, clear_sandbox, save_settings.
Client (index.php?m=haikhavan_notification_hub&ajax=1 — POST + csrf_token)
save_preferences, send_otp, verify_otp.