maximus Posted 5 hours ago Posted 5 hours ago Hi ProcessWire community! π I'm excited to share a new module I've been working on: TeleWire - a Telegram notifications module that brings instant messaging capabilities to your ProcessWire sites. The Problem with Current Notification Solutions After running several e-commerce sites and experimenting with different notification systems, I've encountered these recurring issues: π§ Email (SMTP/WireMail): Requires SMTP server configuration (WireMailSMTP) Google App Passwords setup complexity Emails constantly landing in spam folders Delayed delivery (sometimes 5-10 minutes) No guarantee the recipient will see it quickly π± SMS (Twilio, etc): Monthly fees just to keep a phone number active (~$1-15/month) Per-message charges (can add up quickly) US compliance requirements (verification, regulations) Not everyone wants to share their phone number π¬ WhatsApp Business API: Requires business verification Complex setup process API fees and restrictions Limited to business accounts π Push services (Pushover, etc): Requires purchasing apps ($5-10 per platform) Recipient needs to install and configure the app Additional barrier to entry Why Telegram? π Completely free - No monthly fees, no per-message charges, no app purchases π Universally accessible - 900+ million users worldwide, already installed on most devices β‘ Instant delivery - Messages arrive in 1-2 seconds, not minutes π― Zero configuration barrier - Just start a conversation with your bot, that's it π Reliable - No spam filters, no deliverability issues, no carrier restrictions π± Multi-platform - iOS, Android, Web, Desktop - works everywhere π¨ Rich features - HTML formatting, emojis, photos, documents, links Key Features π Send text notifications with HTML/Markdown formatting πΈ Send photos and documents π₯ Support for multiple recipients (users and groups) π§ Simple admin interface with test button π Optional logging and debug mode β‘ Optimized performance with configurable timeouts π― Easy to integrate with hooks Real-World Use Cases E-commerce order notifications: $wire->addHookAfter('FormBuilderProcessor::processInputDone', function($event) { $form = $event->object; if($form->name === 'order-form') { $telewire = $this->modules->get('TeleWire'); $message = 'π <b>New Order</b>' . "\n\n"; $message .= 'π€ Customer: ' . $form->get('customer_name')->value . "\n"; $message .= 'π° Total: $' . $form->get('total')->value; $telewire->send($message); } }); Failed login attempts monitoring: $wire->addHookAfter('Session::loginFailed', function($event) { $telewire = $this->modules->get('TeleWire'); $name = $event->arguments(0); $message = 'β οΈ <b>Failed Login Attempt</b>' . "\n\n"; $message .= 'Username: ' . $name . "\n"; $message .= 'IP: ' . $this->session->getIP(); $telewire->send($message); }); Content updates: $wire->addHookAfter('Pages::saved', function($event) { $page = $event->arguments(0); if($page->template == 'article' && !$page->isNew()) { $telewire = $this->modules->get('TeleWire'); $message = 'π <b>Article Updated</b>' . "\n"; $message .= 'Title: ' . $page->title . "\n"; $message .= 'By: ' . $this->user->name; $telewire->send($message); } }); Send photos with captions: $telewire = $modules->get('TeleWire'); // Product photo when new product added $telewire->sendPhoto( $page->images->first()->httpUrl, "New product: {$page->title} - \${$page->price}" ); Send documents (invoices, reports): $telewire = $modules->get('TeleWire'); // Send generated PDF invoice $telewire->sendDocument( '/site/assets/invoices/invoice-123.pdf', 'Invoice #123 for Order #456' ); Installation Get a bot token from @BotFather on Telegram (takes 30 seconds) Install the module from GitHub Configure your bot token and chat IDs Click "Send Test Message" to verify everything works Requirements: PHP 8.2+ and ProcessWire 3.0.210+ Admin Interface Features The configuration page includes: β Real-time connection status indicator π§ͺ One-click test message button (AJAX, no page reload) βοΈ Configurable parse mode (HTML/Markdown/MarkdownV2) π Optional logging with debug mode for troubleshooting β±οΈ Adjustable API timeouts π Silent mode option (no notification sound) π Message length handling (auto-split long messages) Production Ready This module is currently running on several production sites: π« E-commerce shop - order notifications, stock alerts π· Wine/liquor business - order confirmations, delivery updates π° News portal - content publishing notifications Average response time: ~150-300ms per notification Getting Your Chat ID Find @userinfobot in Telegram Send any message - it will reply with your Chat ID Important: Start conversation with your bot by sending /start Enter the Chat ID in module configuration For groups: Add the bot to your group, make it admin, and use the negative Chat ID API Documentation // Get module instance $telewire = $modules->get('TeleWire'); // Simple text message $telewire->send('Hello from ProcessWire!'); // HTML formatted message $message = '<b>Bold</b> <i>italic</i> <code>code</code>'; $telewire->send($message); // Send with custom options $telewire->send('Silent notification', [ 'disable_notification' => true, 'parse_mode' => 'Markdown' ]); // Send photo $telewire->sendPhoto('/path/to/photo.jpg', 'Optional caption'); // Send document $telewire->sendDocument('/path/to/file.pdf', 'Document caption'); Feedback Welcome! I'd love to hear your thoughts, use cases, and suggestions. If you've been frustrated with email deliverability or SMS costs for notifications, give this a try! GitHub: https://github.com/mxmsmnv/TeleWire Thanks to the ProcessWire community for the inspiration and all the great modules that helped me learn the PW module system! π Bottom line: If your users have Telegram (and most do), you can send them instant, reliable, free notifications without fighting spam filters or paying monthly fees. Simple as that.Β 2 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now