Changeset 3415156
- Timestamp:
- 12/09/2025 10:02:08 AM (4 months ago)
- Location:
- refatbd-notifications-with-telegram-for-woocommerce
- Files:
-
- 48 added
- 4 edited
-
tags/2.0.1 (added)
-
tags/2.0.1/admin (added)
-
tags/2.0.1/admin/class-rntfw-admin.php (added)
-
tags/2.0.1/admin/css (added)
-
tags/2.0.1/admin/css/admin-styles.css (added)
-
tags/2.0.1/admin/js (added)
-
tags/2.0.1/admin/js/admin-scripts.js (added)
-
tags/2.0.1/admin/js/rntfw-alerts.js (added)
-
tags/2.0.1/admin/js/schedule-sms.js (added)
-
tags/2.0.1/admin/views (added)
-
tags/2.0.1/admin/views/api-connection-page.php (added)
-
tags/2.0.1/admin/views/faq-page.php (added)
-
tags/2.0.1/admin/views/history-page.php (added)
-
tags/2.0.1/admin/views/how-to-page.php (added)
-
tags/2.0.1/admin/views/logs-page.php (added)
-
tags/2.0.1/admin/views/notification-rules-page.php (added)
-
tags/2.0.1/admin/views/partials (added)
-
tags/2.0.1/admin/views/partials/conditions-template.php (added)
-
tags/2.0.1/admin/views/schedule-sms-page.php (added)
-
tags/2.0.1/admin/views/settings-page.php (added)
-
tags/2.0.1/assets (added)
-
tags/2.0.1/assets/js (added)
-
tags/2.0.1/assets/js/rntfw-abandoned-checkout.js (added)
-
tags/2.0.1/assets/js/rntfw-settings-conditions.js (added)
-
tags/2.0.1/assets/lib (added)
-
tags/2.0.1/assets/lib/flatpickr (added)
-
tags/2.0.1/assets/lib/flatpickr/flatpickr.min.css (added)
-
tags/2.0.1/assets/lib/flatpickr/flatpickr.min.js (added)
-
tags/2.0.1/assets/lib/select2 (added)
-
tags/2.0.1/assets/lib/select2/select2.full.min.js (added)
-
tags/2.0.1/assets/lib/select2/select2.min.css (added)
-
tags/2.0.1/assets/lib/sweetalert2 (added)
-
tags/2.0.1/assets/lib/sweetalert2/sweetalert2.all.min.js (added)
-
tags/2.0.1/assets/lib/sweetalert2/sweetalert2.min.css (added)
-
tags/2.0.1/includes (added)
-
tags/2.0.1/includes/activation.php (added)
-
tags/2.0.1/includes/class-rntfw-api-manager.php (added)
-
tags/2.0.1/includes/class-rntfw-condition-evaluator.php (added)
-
tags/2.0.1/includes/class-rntfw-core.php (added)
-
tags/2.0.1/includes/class-rntfw-db.php (added)
-
tags/2.0.1/includes/class-rntfw-logger.php (added)
-
tags/2.0.1/includes/class-rntfw-telegram.php (added)
-
tags/2.0.1/includes/class-rntfw-woocommerce-commands.php (added)
-
tags/2.0.1/includes/deactivation.php (added)
-
tags/2.0.1/languages (added)
-
tags/2.0.1/languages/refatbd-notifications-with-telegram-for-woocommerce.pot (added)
-
tags/2.0.1/readme.txt (added)
-
tags/2.0.1/refatbd-notifications-with-telegram-for-woocommerce.php (added)
-
trunk/includes/class-rntfw-condition-evaluator.php (modified) (1 diff)
-
trunk/includes/class-rntfw-core.php (modified) (12 diffs)
-
trunk/readme.txt (modified) (6 diffs)
-
trunk/refatbd-notifications-with-telegram-for-woocommerce.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
refatbd-notifications-with-telegram-for-woocommerce/trunk/includes/class-rntfw-condition-evaluator.php
r3390586 r3415156 564 564 $type = $conditions['type'] ?? 'any_coupon_status'; 565 565 $target_coupon_codes = array_map( 'wc_format_coupon_code', $conditions['coupon_codes'] ?? [] ); 566 $used_coupons = $order_obj->get_ used_coupons(); // Returns an array of coupon codes566 $used_coupons = $order_obj->get_coupon_codes(); // Returns an array of coupon codes 567 567 568 568 $has_used_any_coupon = ! empty( $used_coupons ); -
refatbd-notifications-with-telegram-for-woocommerce/trunk/includes/class-rntfw-core.php
r3390586 r3415156 45 45 } 46 46 47 /** 48 * Default Templates Method 49 * Moved from Admin class to Core to ensure availability on frontend/REST requests. 50 */ 51 public static function get_default_status_templates() { 52 return [ 53 'pending' => "🕒 Order Pending Payment Notification 🔴\n\nHello Admin,\n\nAn order has been received but the payment is still pending. 🛑\n\n📦 Order Details:\n\nOrder ID: {order_id} 🆔\nCustomer Name: {customer_name} 👤\nTotal Due: {total_price_formatted} 💰\nPayment Method: {payment_method} 💳\nBilling Address: {billing_address} 🏠\nEmail: {billing_email} 📧\nPhone: {billing_phone} 📱\n\n📅 Order Timeline:\n\nOrder Placed: {date_created} ⏳\n\n📝 Notes from Customer: {customer_note} ✏️\n\nAction: Please follow up with the customer to complete the payment or address any issues. 🚨\n\n— {site_title} Team 🤝", 54 'processing' => "🎉 Order Processing Update 🔵\n\nHello Admin,\n\nA new order is now being processed! 🚀\n\n📦 Order Details:\n\nOrder ID: {order_id} 🆔\nCustomer Name: {customer_name} 👤\nTotal Paid: {total_price_formatted} 💰\nPayment Method: {payment_method} 💳\nBilling Address: {billing_address} 🏠\nEmail: {billing_email} 📧\nPhone: {billing_phone} 📱\n\n📅 Order Timeline:\n\nOrder Placed: {date_created} ⏳\nPayment Received: {date_paid} ✅\n\n📝 Customer Notes: {customer_note} ✏️\n\nAction: Order is now in processing. Ensure timely shipping and handling. 🚚\n\n— {site_title} Team 🤝", 55 'on-hold' => "⏸️ Order On Hold Alert 🟡\n\nHello Admin,\n\nThe following order is currently on hold. 🛑\n\n📦 Order Details:\n\nOrder ID: {order_id} 🆔\nCustomer Name: {customer_name} 👤\nTotal Paid: {total_price_formatted} 💰\nPayment Method: {payment_method} 💳\nBilling Address: {billing_address} 🏠\nEmail: {billing_email} 📧\nPhone: {billing_phone} 📱\n\n📅 Order Timeline:\n\nOrder Placed: {date_created} ⏳\n\n📝 Customer Notes: {customer_note} ✏️\n\nAction: Investigate the reason for the hold and update the customer accordingly. 🔍\n\n— {site_title} Team 🤝", 56 'completed' => "🎉 Order Completion Notice ✅\n\nHello Admin,\n\nAn order has been successfully completed! 🏅\n\n📦 Order Details:\n\nOrder ID: {order_id} 🆔\nCustomer Name: {customer_name} 👤\nTotal Paid: {total_price_formatted} 💰\nPayment Method: {payment_method} 💳\nBilling Address: {billing_address} 🏠\nEmail: {billing_email} 📧\nPhone: {billing_phone} 📱\n\n📅 Order Timeline:\n\nOrder Placed: {date_created} ⏳\nPayment Received: {date_paid} ✅\nOrder Completed: {date_completed} 🎯\n\n📝 Customer Notes: {customer_note} ✏️\n\nAction: Ensure that the order is dispatched promptly. 🚚\n\n— {site_title} Team 🤝", 57 'cancelled' => "❌ Order Cancelled Notification ❌\n\nHello Admin,\n\nThe following order has been cancelled. 🚫\n\n📦 Order Details:\n\nOrder ID: {order_id} 🆔\nCustomer Name: {customer_name} 👤\nTotal Paid: {total_price_formatted} 💰\nBilling Address: {billing_address} 🏠\nEmail: {billing_email} 📧\nPhone: {billing_phone} 📱\n\n📅 Order Placed: {date_created} ⏳\n\n📝 Customer Notes: {customer_note} ✏️\n\nAction: Follow up with the customer for any further questions or support. 🔄\n\n— {site_title} Team 🤝", 58 'refunded' => "💸 Order Refunded Notification 💸\n\nHello Admin,\n\nThe following order has been refunded. 💵\n\n📦 Order Details:\n\nOrder ID: {order_id} 🆔\nCustomer Name: {customer_name} 👤\nTotal Refunded: {total_price_formatted} 💰\nPayment Method: {payment_method} 💳\nBilling Address: {billing_address} 🏠\nEmail: {billing_email} 📧\nPhone: {billing_phone} 📱\n\n📅 Order Timeline:\n\nOrder Placed: {date_created} ⏳\nPayment Received: {date_paid} ✅\nRefunded: {date_completed} 🔄\n\n📝 Customer Notes: {customer_note} ✏️\n\nAction: Investigate the reason for the refund and ensure proper follow-up. 🔍\n\n— {site_title} Team 🤝", 59 'failed' => "🔥 Order Failed Notification ❌\n\nHello Admin,\n\nThe payment for the following order has failed. 🚨\n\n📦 Order Details:\n\nOrder ID: {order_id} 🆔\nCustomer Name: {customer_name} 👤\nOrder Total: {total_price_formatted} 💰\nPayment Method: {payment_method} 💳\nBilling Address: {billing_address} 🏠\nEmail: {billing_email} 📧\nPhone: {billing_phone} 📱\n\n📅 Order Placed: {date_created} ⏳\n\n📝 Customer Notes: {customer_note} ✏️\n\nAction: Contact the customer to assist with payment issues. 🔄\n\n— {site_title} Team 🤝", 60 'checkout-draft' => "📝 Order Draft Notification 🟡\n\nHello Admin,\n\nAn order draft has been created but hasn’t been finalized or paid yet. 📝\n\n📦 Order Details:\n\nOrder ID: {order_id} 🆔\nCustomer Name: {customer_name} 👤\nTotal (Unpaid): {total_price_formatted} 💰\nBilling Address: {billing_address} 🏠\nEmail: {billing_email} 📧\nPhone: {billing_phone} 📱\n\n📅 Order Created: {date_created} ⏳\n\n📝 Customer Notes: {customer_note} ✏️\n\nAction: Follow up with the customer to encourage completing the order. 🛒\n\n— {site_title} Team 🤝", 61 'new_user' => "🎉 New User Registration 👤\n\nHello Admin,\n\nA new user has registered on {site_title}. 🎉\n\n📧 User Details:\n\nUsername: {user_login} 🆔\nEmail: {user_email} 📧\n\nAction: Welcome the new user and ensure their account is set up properly. ✅\n\n— {site_title} Team 🤝", 62 'stock' => "🔔 Product Stock Update 📦\n\nHello Admin,\n\nThe following product has been updated in stock. 📊\n\n📦 Product Details:\n\nProduct Name: {product_name} 🏷️\nSKU: {product_sku} 🆔\nStock Status: {stock_status} 🏬\n\nAction: Update product listings accordingly and ensure inventory levels are accurate. ✅\n\n— {site_title} Team 🤝", 63 'abandoned_cart' => "⚠️ Abandoned Checkout Alert 🛑\n\nHello Admin,\n\nA potential customer has started checkout but left without completing it. 🚨\n\n📧 Customer Details:\n\nName: {customer_name} 👤\nEmail: {customer_email} 📧\nPhone: {customer_phone} 📱\n\n📅 Date Created: {date_created} ⏳\n\n📦 Cart Items:\n{product_list} 🛒\n{variation_data} 🔄\n\nAction: Consider reaching out to the customer to offer assistance or a discount to complete the purchase. 🎁\n\n— {site_title} Team 🤝", 64 'product_low_out_stock' => "📉 Product Stock Alert for {site_title} 🚨\n\nHello Admin,\n\nThe product '{product_name}' (SKU: {product_sku}) is now {alert_type}!\n\n📦 Current Stock: {stock_quantity}\n\nAction: Please restock or update inventory as soon as possible. urgent", 65 'new_review' => "⭐ New Product Review on {site_title}! 🎉\n\nHello Admin,\n\nA new review has been submitted for '{product_name}'.\n\n👤 Reviewer: {reviewer_name} ({reviewer_email})\n⭐ Rating: {review_rating}\n\n📝 Review Content:\n{review_content}\n\n🔗 View Product: {product_link}\n🔗 View Review: {review_link}\n\nAction: Moderate the review and engage with customer feedback. 💬", 66 'coupon_usage' => "🏷️ Coupon Usage Alert on {site_title}!💰\n\nHello Admin,\n\nA coupon has been used in a new order.\n\n🛒 Order ID: {order_id}\n👤 Customer: {customer_name}\n💲 Total: {total_price_formatted}\n🎟️ Coupon(s) Used ({coupon_count}): {coupon_codes}\n\nAction: Review promotional effectiveness and customer segments. 📈", 67 'admin_user_registration' => "🔒 New Admin User Registered on {site_title}! 🚨\n\nHello Admin,\n\nA new user with administrative privileges has registered or been created.\n\n👤 Username: {user_login}\n📧 Email: {user_email}\n🔑 Roles: {user_roles}\n\nAction: Verify this new user. If unauthorized, take immediate action to secure your site! 🛑", 68 'failed_login_attempts' => "🚫 Multiple Failed Login Attempts on {site_title}! 🛑\n\nHello Admin,\n\nThere have been {failed_attempts} failed login attempts for user '{username}' from IP address '{ip_address}'.\n\nThis exceeds your configured threshold of {threshold} attempts.\n\nAction: Investigate immediately for potential brute-force attacks! Consider blocking the IP. 🛡️", 69 'product_price_change' => "💲 Product Price Change Alert on {site_title}! 📊\n\nHello Admin,\n\nThe price for '{product_name}' (SKU: {product_sku}) has {price_change_text}.\n\nOriginal Price: {old_price}\nNew Price: {new_price}\nPercentage Change: {percentage_change}\n\n🔗 View Product: {product_link}\n\nAction: Verify the price change and update any marketing materials if necessary. ✅", 70 ]; 71 } 47 72 48 73 /** … … 206 231 // Pass user_info object to check function 207 232 if ( $this->_should_send_notification( 'new_user', null, $user_info ) ) { 208 $template = $notification_settings_user['template'] ?? RNTFW_Admin::get_default_status_templates()['new_user'] ?? ''; // Add fallback default233 $template = $notification_settings_user['template'] ?? self::get_default_status_templates()['new_user'] ?? ''; // Fixed call 209 234 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 210 235 … … 247 272 // Pass user_info object to check function 248 273 if ( $this->_should_send_notification( 'admin_user_registration', null, $user_info ) ) { 249 $template = $notification_settings_admin_user['template'] ?? RNTFW_Admin::get_default_status_templates()['admin_user_registration'] ?? ''; // Add fallback default274 $template = $notification_settings_admin_user['template'] ?? self::get_default_status_templates()['admin_user_registration'] ?? ''; // Fixed call 250 275 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 251 276 … … 296 321 // Pass product object to check function 297 322 if ( $this->_should_send_notification( 'stock', null, null, $product ) ) { 298 $template = $notification_settings_stock['template'] ?? RNTFW_Admin::get_default_status_templates()['stock'] ?? ''; // Add fallback default323 $template = $notification_settings_stock['template'] ?? self::get_default_status_templates()['stock'] ?? ''; // Fixed call 299 324 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 300 325 … … 335 360 // Pass product object to check function 336 361 if ( $this->_should_send_notification( 'product_low_out_stock', null, null, $product ) ) { 337 $template = $notification_settings_low_stock['template'] ?? RNTFW_Admin::get_default_status_templates()['product_low_out_stock'] ?? ''; // Add fallback default362 $template = $notification_settings_low_stock['template'] ?? self::get_default_status_templates()['product_low_out_stock'] ?? ''; // Fixed call 338 363 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 339 364 … … 422 447 } 423 448 424 $template = $ac_settings['template'] ?? RNTFW_Admin::get_default_status_templates()['abandoned_cart'] ?? ''; // Add fallback default449 $template = $ac_settings['template'] ?? self::get_default_status_templates()['abandoned_cart'] ?? ''; // Fixed call 425 450 426 451 // *** MODIFIED CHECK *** (Removed chat_id check here, handled above) … … 543 568 if ( ! $this->_should_send_notification( 'new_review', null, null, $product, [ 'comment_ID' => $comment_ID ] ) ) return; 544 569 545 $template = $notification_settings['template'] ?? RNTFW_Admin::get_default_status_templates()['new_review'] ?? ''; // Add fallback default570 $template = $notification_settings['template'] ?? self::get_default_status_templates()['new_review'] ?? ''; // Fixed call 546 571 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 547 572 … … 595 620 } 596 621 597 $used_coupons = $order->get_used_coupons(); 622 // FIX: Replace deprecated get_used_coupons() with get_coupon_codes() 623 $used_coupons = $order->get_coupon_codes(); 598 624 if ( empty( $used_coupons ) ) { 599 625 return; // No coupons used … … 607 633 if ( ! $this->_should_send_notification( 'coupon_usage', $order ) ) return; // Pass order object 608 634 609 $template = $notification_settings['template'] ?? RNTFW_Admin::get_default_status_templates()['coupon_usage'] ?? ''; // Add fallback default635 $template = $notification_settings['template'] ?? self::get_default_status_templates()['coupon_usage'] ?? ''; // Fixed call 610 636 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 611 637 … … 685 711 } 686 712 687 $template = $notification_settings['template'] ?? RNTFW_Admin::get_default_status_templates()['failed_login_attempts'] ?? ''; // Add fallback default713 $template = $notification_settings['template'] ?? self::get_default_status_templates()['failed_login_attempts'] ?? ''; // Fixed call 688 714 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 689 715 … … 796 822 delete_transient( 'rntfw_old_product_price_' . $product_id ); 797 823 798 $template = $notification_settings['template'] ?? RNTFW_Admin::get_default_status_templates()['product_price_change'] ?? ''; // Add fallback default824 $template = $notification_settings['template'] ?? self::get_default_status_templates()['product_price_change'] ?? ''; // Fixed call 799 825 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 800 826 … … 910 936 } 911 937 912 $notification_data = $status_notifications[ $status_key ] ;913 $template = $notification_data['template'] ?? RNTFW_Admin::get_default_status_templates()[$status_key] ?? ''; // Add fallback default938 $notification_data = $status_notifications[ $status_key ] ?? []; 939 $template = $notification_data['template'] ?? self::get_default_status_templates()[$status_key] ?? ''; // Fixed call 914 940 $is_pro_active = class_exists('RNTFW_Pro_Init'); // Check if Pro is active 915 941 -
refatbd-notifications-with-telegram-for-woocommerce/trunk/readme.txt
r3390586 r3415156 4 4 Tags: woocommerce, telegram, notifications, abandoned cart, conditional logic 5 5 Requires at least: 5.0 6 Tested up to: 6. 87 Stable tag: 2.0. 06 Tested up to: 6.9 7 Stable tag: 2.0.1 8 8 Requires PHP: 7.4 9 9 License: GPL v2 or later … … 26 26 27 27 * **WooCommerce HPOS Compatible:** Fully supports WooCommerce High-Performance Order Storage (HPOS). 28 * **Secure API Integration:** Connects to a private Telegram API Backend (`https://tgapi.refat.ovh/api.php`), keeping your sensitive Bot Token secure and off your server. See "External Services" section below for details. 28 * **Secure API Integration:** Connects to a private Telegram API Backend (`https://tgapi.refat.ovh/api.php`), keeping your sensitive Bot Token secure and off your server. 29 See "External Services" section below for details. 29 30 * **Comprehensive Notifications:** Get alerts for order status changes, new user registrations (including admins), stock changes, low/out of stock alerts, abandoned checkouts, new product reviews, coupon usage, failed login attempts, and product price changes. 30 31 * **Advanced Conditional Logic:** Create rules based on product IDs, categories, tags, order total, quantity, customer details (ID, role, guest status), payment methods, shipping zones, coupon codes, custom fields, time of day, and stock levels. … … 47 48 1. **Connect Your Website:** 48 49 * In your WordPress admin, go to **Telegram Sync -> API Connection**. 49 * The default API URL (`https://tgapi.refat.ovh/api.php`) is provided. Ensure this is correct. If you self-host the backend, enter your URL and click "Save API URL". 50 * Click the **"Fetch API Key"** button. This securely connects your site to the backend and saves your API key automatically. 50 * The default API URL (`https://tgapi.refat.ovh/api.php`) is provided. Ensure this is correct. 51 If you self-host the backend, enter your URL and click "Save API URL". 52 * Click the **"Fetch API Key"** button. 53 This securely connects your site to the backend and saves your API key automatically. 51 54 * Verify that the API Status and Site Connection show as "Connected". Click "Refresh" if needed. 55 52 56 2. **Configure Chat ID:** 53 57 * Go to **Telegram Sync -> Settings -> Chat Management**. 54 * Find the active bot's username on the **API Connection** page. Send the command `/myid` to that bot in Telegram. It will reply with your unique Chat ID (a number, possibly starting with a hyphen for groups). 58 * Find the active bot's username on the **API Connection** page. Send the command `/myid` to that bot in Telegram. 59 It will reply with your unique Chat ID (a number, possibly starting with a hyphen for groups). 55 60 * Enter a name for your reference (e.g., "Admin Chat") and the Chat ID you received into the fields on the Chat Management tab. 56 61 * Click "Save Changes". 57 62 * You can use the "Test" button to verify the Chat ID is correct. 63 58 64 3. **Configure Notifications:** 59 65 * Go through the tabs under **Telegram Sync -> Settings** (General, Order Status, User & Stock, etc.). 60 66 * Use the toggle switches to enable the notifications you want to receive. 61 67 * Customize the message templates using the available placeholders listed below each template field. 68 62 69 4. **Set Up Notification Rules (Optional):** 63 70 * Navigate to the **Notification Rules** tab to create advanced conditions for any enabled notification event, giving you precise control over when alerts are sent. 71 64 72 5. **Enable the Plugin:** 65 73 * Ensure the "Enable Plugin" toggle is switched on in the **General** tab. … … 82 90 83 91 This plugin relies on a mandatory third-party API service hosted at `https://tgapi.refat.ovh/api.php` to function. 84 85 * **What the service is and what it is used for:** The service acts as a secure intermediary between your WooCommerce store and the Telegram messaging service. It receives notification requests (containing message content and recipient ID) from your website via a secure API key, processes them, and delivers them to the specified Telegram chat using a bot managed by the service provider. This is necessary to avoid exposing your sensitive Telegram Bot Token directly on your website and allows the service to manage bot operations and message delivery. The service also enforces message usage limits for users of this free plugin. 92 * **What the service is and what it is used for:** The service acts as a secure intermediary between your WooCommerce store and the Telegram messaging service. 93 It receives notification requests (containing message content and recipient ID) from your website via a secure API key, processes them, and delivers them to the specified Telegram chat using a bot managed by the service provider. 94 This is necessary to avoid exposing your sensitive Telegram Bot Token directly on your website and allows the service to manage bot operations and message delivery. 95 The service also enforces message usage limits for users of this free plugin. 86 96 * **What data is sent and when:** 87 97 * **Connection:** When you click "Fetch API Key" on the API Connection page, your website's domain (e.g., `yourstore.com`) and a unique, auto-generated secret key are sent to the service to register your site and issue your API Key. 88 * **Notifications:** Whenever a configured WooCommerce event occurs (e.g., new order, stock change), the plugin constructs a message based on your template and sends the final message content along with your configured Telegram Chat ID and your API Key to the service. The message content may include order details, product names, customer information (name, email, phone - depending on your template configuration), etc., as needed to fulfill the notification's purpose. 89 * **Chat Commands:** When you send a command (like `/sales`) from Telegram to the service's bot, the service sends the command details (command name, arguments, your chat ID) along with your API Key to your website's REST API endpoint (`/wp-json/rntfw/v1/command`). Your website processes the command and sends the result back to the service, which then relays it to you in Telegram. 98 * **Notifications:** Whenever a configured WooCommerce event occurs (e.g., new order, stock change), the plugin constructs a message based on your template and sends the final message content along with your configured Telegram Chat ID and your API Key to the service. 99 The message content may include order details, product names, customer information (name, email, phone - depending on your template configuration), etc., as needed to fulfill the notification's purpose. 100 * **Chat Commands:** When you send a command (like `/sales`) from Telegram to the service's bot, the service sends the command details (command name, arguments, your chat ID) along with your API Key to your website's REST API endpoint (`/wp-json/rntfw/v1/command`). 101 Your website processes the command and sends the result back to the service, which then relays it to you in Telegram. 90 102 * **Status Checks:** Periodically, and when you click "Refresh" or "Test Connection", the plugin sends your domain, secret key, and API key to the service to verify the connection status and retrieve the current bot username. 91 * **Service's Terms of Use and Privacy Policy:** Connection to and use of this external service are subject to its terms and policies. Please review them carefully: 103 * **Service's Terms of Use and Privacy Policy:** Connection to and use of this external service are subject to its terms and policies. 104 Please review them carefully: 92 105 * [Terms of Use](https://refat.ovh/tgapi-terms-of-service) 93 106 * [Privacy Policy](https://refat.ovh/tgapi-privacy-policy) … … 102 115 103 116 = How do I get my Telegram Chat ID? = 104 First, connect your site on the **Telegram Sync -> API Connection** page to get the current bot username. Then, send the command `/myid` to that bot username in your Telegram app. The bot will reply with your unique Chat ID. Enter this ID in **Telegram Sync -> Settings -> Chat Management**. 117 First, connect your site on the **Telegram Sync -> API Connection** page to get the current bot username. 118 Then, send the command `/myid` to that bot username in your Telegram app. 119 The bot will reply with your unique Chat ID. Enter this ID in **Telegram Sync -> Settings -> Chat Management**. 105 120 106 121 = Why am I not receiving notifications? = 107 122 Please check the following: 108 1. **API Connection:** Go to **Telegram Sync -> API Connection**. Are the API Status and Site Connection both showing as "Connected"? If not, save the API URL and click "Fetch API Key". 109 2. **Bot Started:** Have you sent the `/start` command to the bot username shown on the API Connection page in Telegram? If the bot seems unresponsive, click "Refresh" on the API Connection page to get the latest username. 110 3. **Chat ID Correct:** Is the Chat ID entered in **Settings -> Chat Management** correct? Use the "Test" button there to verify. 111 4. **Notifications Enabled:** In **Settings -> General**, is the main "Enable Plugin" switch turned on? Also, in the specific notification tabs (e.g., Order Status, User & Stock), is the switch for the notification type you expect turned on? 123 1. **API Connection:** Go to **Telegram Sync -> API Connection**. 124 Are the API Status and Site Connection both showing as "Connected"? 125 If not, save the API URL and click "Fetch API Key". 126 2. **Bot Started:** Have you sent the `/start` command to the bot username shown on the API Connection page in Telegram? 127 If the bot seems unresponsive, click "Refresh" on the API Connection page to get the latest username. 128 3. **Chat ID Correct:** Is the Chat ID entered in **Settings -> Chat Management** correct? 129 Use the "Test" button there to verify. 130 4. **Notifications Enabled:** In **Settings -> General**, is the main "Enable Plugin" switch turned on? 131 Also, in the specific notification tabs (e.g., Order Status, User & Stock), is the switch for the notification type you expect turned on? 112 132 5. **Conditions Met:** If you configured rules under the **Notification Rules** tab, ensure all conditions for the specific event are being met for the notification to be sent. 113 6. **Message Limits:** This free version has message limits enforced by the API service. If you exceed the daily or monthly limit, notifications will stop until the limit resets. Check the **Logs** tab for any "Limit Reached" errors. Consider upgrading to Pro for unlimited messages. 133 6. **Message Limits:** This free version has message limits enforced by the API service. 134 If you exceed the daily or monthly limit, notifications will stop until the limit resets. 135 Check the **Logs** tab for any "Limit Reached" errors. Consider upgrading to Pro for unlimited messages. 114 136 7. **Plugin Logs:** Check the **Telegram Sync -> Logs** tab for any specific error messages related to sending the notification. 115 137 … … 118 140 119 141 == Changelog == 142 143 144 = 2.0.1 = 145 * COMPATIBILITY: Tested up to WordPress 6.9. 146 * FIX: Resolved fatal error "Class RNTFW_Admin not found" occurring during frontend checkout events. 147 * FIX: Fixed PHP warning for undefined "processing" array key in order status notifications. 120 148 121 149 = 2.0.0 = -
refatbd-notifications-with-telegram-for-woocommerce/trunk/refatbd-notifications-with-telegram-for-woocommerce.php
r3390586 r3415156 4 4 * Plugin URI: https://refat.ovh/refatbd-notifications-with-telegram-for-woocommerce 5 5 * Description: Sends instant, secure, and custom-templated notifications to Telegram for WooCommerce events with advanced conditional logic to a single chat ID. 6 * Version: 2.0. 06 * Version: 2.0.1 7 7 * Author: Refat 8 8 * Author URI: https://refat.ovh … … 29 29 30 30 // --- Constants --- 31 define( 'RNTFW_VERSION', '2.0. 0' ); // Updated version31 define( 'RNTFW_VERSION', '2.0.1' ); // Updated version 32 32 define( 'RNTFW_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 33 33 define( 'RNTFW_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.