=== Parvizi NotiFlow – Universal Multi-Channel Notifications & Automation ===
Contributors: parvizi
Donate link: https://NotiFlow.parvizi.cloud
Tags: notifications, telegram, discord, woocommerce, automation
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 3.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Instant, reliable Telegram and Discord notification automation for WooCommerce orders, posts, comments and users with a zero-latency queue.

== Description ==

NotiFlow turns your store and site events into instant messages in the places your team already works. Connect a Telegram bot or Discord webhook once, register destinations, then compose automations in a Notion-inspired rule builder with live dynamic tags.

Built for production WordPress: every delivery runs through a hardened background queue, every credential stays on your own server, and every message template is yours to write.

= Core Features =

🚀 **Two Free Channels**
* **Telegram Bot API** — channels, groups/supergroups and private chats with inline button keyboards and HTML formatting.
* **Discord** — Rich Embeds with event-tinted color bars, custom bot name and avatar, footer branding and ISO timestamps.

✅ **WordPress & WooCommerce Triggers**
* WooCommerce orders (new, processing, completed, on-hold, failed, cancelled, refunded) with buyer, totals, coupons, items and admin links as dynamic tags.
* Stock protection: low-stock and out-of-stock alerts plus backorder events.
* Posts: published, submitted for review and trashed.
* Comments: new comments, comment approvals and product reviews.
* Users: registrations, role changes and failed login attempts — IP address included.
* WordPress updates: core updates and plugin updates, so you know when something changed on your own site.

🎯 **Conditional Filters**
Send only what matters. Combine AND-ed conditions per rule: order total comparisons, payment gateway, shipping method, billing city/state, products in the cart, coupon usage, post categories, post type, user role and comment status — each with sensible operators.

📸 **Featured Image Tag**
The `{featured_image}` dynamic tag resolves to the product, post or review image an event is about, so templates can link it inline without any code. (Automatic photo *attachments* across every channel are part of [NotiFlow Pro](https://NotiFlow.parvizi.cloud).)

⚡ **Zero-Latency Async Queue**
A non-blocking background worker built on WooCommerce Action Scheduler, with automatic WP-Cron fallback and an optional internal runner for hosts without cron. Checkout and front-end requests are never delayed by a Telegram API call.

🎨 **Notion-Inspired UI**
A warm-paper, minimalist admin experience: vertical RTL-aware sidebar navigation, live connection health badges, grouped destination pickers, contextual condition rows, dynamic tag chips inserted at your cursor, and brand-colored platform badges across rules and activity logs.

🌐 **7 Languages Out of the Box**
English, Persian (فارسی), Arabic (العربية), Spanish (Spain), German, Russian and Portuguese (Brazil) — full PHP + JavaScript translation bundles ship with the plugin.

🛡️ **Hardened Security & Proxy Support**
HTTP and SOCKS5 proxy routing for restricted hosting environments, request timeouts, retry budgets with hard attempt ceilings, loop-proof worker execution, masked token storage and granular delivery logs with full API diagnostics.

= Looking for more? =

[NotiFlow Pro](https://NotiFlow.parvizi.cloud) adds WhatsApp Business, Slack Block Kit and custom webhooks, scheduled sales & stock digests, featured-image attachments on every channel, advanced form/course/quiz filters, and 15+ ecosystem integrations (form builders, LMS platforms, memberships, bookings, helpdesks, security).

Free core features are never crippled to upsell Pro; Pro simply extends this plugin through documented hooks.

== Installation ==

1. Upload the `parvizi-notiflow` folder to `/wp-content/plugins/`, or install through *Plugins → Add New → Upload Plugin*, and activate.
2. Open **NotiFlow**, connect your Telegram bot (BotFather token) or paste a Discord webhook URL, and register your first destinations.
3. Create your first automation in **Rules**: pick an event, choose destinations, drop in dynamic tags — done.

Minimum requirements: WordPress 6.0, PHP 8.0. WooCommerce is optional — core triggers work standalone; activating WooCommerce unlocks the order and stock triggers automatically.

== Frequently Asked Questions ==

= Does NotiFlow slow down my WooCommerce checkout? =

No. In asynchronous mode (default) every notification is handed to a background queue powered by Action Scheduler, so the shopper's request completes without waiting for Telegram or Discord APIs. Retries happen in the background too. If you deliberately switch to synchronous mode, deliveries run inline — useful for debugging, not recommended for stores.

= Which triggers can I automate? =

Everything in the free catalog: order lifecycle events, low/out-of-stock alerts, backorders, published/review/trashed posts, comments and reviews, user registrations, role changes, failed logins, and WordPress core/plugin updates. The catalog also shows locked placeholders for the Pro-only integrations, each explaining exactly what it unlocks.

= Do I need external server cron? =

Not for instant notifications — the queue drains at the end of the same request that produced the event. The one exception inside the free core is nothing at all: no free feature depends on scheduled background jobs. (Scheduled digests are a Pro feature and use WP-Cron/Action Scheduler.)

= Is my bot token secure? =

Yes. Tokens are stored only on your server inside the options table, never printed in plain text (the UI shows masked values), never embedded in pages or REST responses, and never transmitted anywhere except directly to the provider you configured. Outbound traffic can additionally be forced through your own HTTP/SOCKS5 proxy.

= Can I build my own integration on top of it? =

Yes — the free core is designed as a platform:

* `notiflow_register_channels` registers a delivery channel (driver, formatter, validator, credential hooks).
* `notiflow_tag_values` adds dynamic tags for custom events.
* `notiflow_trigger_groups` / `notiflow_trigger_contexts` / `notiflow_condition_fields` extend the rule builder catalog.
* `notiflow_featured_image_url` plugs into dispatch-time media resolution.
* `notiflow_loaded` fires when the whole engine (parser, logger, queue, listener) is wired on every request type, including cron.

The Pro add-on uses exactly these hooks and no other file of yours is touched.

== Screenshots ==

1. Dashboard with live metrics and platform health
2. Destinations manager grouped by channel
3. Notion-style Rule Builder with dynamic tags
4. Advanced Conditional Filters
5. Activity Logs & Diagnostics

== External services ==

This plugin connects to external third-party messaging services to deliver notifications configured by the site administrator:

1. Telegram Bot API (https://api.telegram.org)
- Purpose: Used to send notification messages and order alerts to administrator-configured Telegram channels, groups, and private chats.
- Data Transmitted: Notification message content, order summaries, and optional action buttons as configured in automation rules. Data is sent only when an enabled trigger event occurs.
- Terms of Service: https://core.telegram.org/api/terms
- Privacy Policy: https://telegram.org/privacy

2. Discord Webhook API (https://discord.com)
- Purpose: Used to dispatch formatted Rich Embed notifications to administrator-configured Discord server channels.
- Data Transmitted: Event summaries and embed fields. Data is sent only when an enabled trigger event occurs.
- Terms of Service: https://discord.com/terms
- Privacy Policy: https://discord.com/privacy

== Changelog ==

= 3.0.5 =
Feature release: Customer Automation Rules engine (Phase 20.2, Pro).

* New "Customer Rules" sub-tab in the Rules view: automated personal notifications for buyers/students.
* Customer rules target the buyer directly: personal Telegram chat, WhatsApp via phone and SMS via phone (Twilio).
* Filtered customer trigger catalog (order status, course enrollment/quiz, booking confirmation, support reply) with personalized default templates.
* Direct dispatch pipeline listens to every deduplicated event and queues one job per enabled customer channel.
* Rules table gains a `rule_scope` column with an automatic upgrade migration.

= 3.0.4 =
Maintenance release: display name aligned with the assigned `parvizi-notiflow` slug.

* Plugin display name updated in the plugin header and readme to "Parvizi NotiFlow – Universal Multi-Channel Notifications & Automation".

= 3.0.3 =
Maintenance release: plugin-check compliance and hardening.

* Prefixed admin controller methods with the `notiflow_` prefix to eliminate WordPress.org naming-collision warnings.
* Normalized file line endings to Unix LF to satisfy the Plugin Checker.
* Tested-up-to declaration raised to WordPress 7.1.

= 3.0.0 =
Major architectural release: the plugin is now the open free core of a two-plugin system.

* Channel registry (`notiflow_register_channels`): delivery drivers, template conversion, destination validation, admin test pings and manual log retries all resolve through one registry, so add-ons add channels without touching core files.
* Documented extension seams for trigger catalogs, condition fields/contexts, tag values, condition resolution, featured images and runtime listeners; the ecosystem, digests, media attachments, WhatsApp/Slack/webhooks moved into the optional NotiFlow Pro add-on.
* Rules bound to Pro channels or Pro triggers degrade gracefully: existing rows are preserved, skipped with an explanatory log line while the add-on is inactive, and resume working the moment it returns. Nothing is deleted behind your back.
* Locked admin panels render clear upgrade placeholders instead of forms that cannot submit.
* Settings tab gained a licence card (activation lives in the Pro add-on).
* Hardened dispatch routing: unknown platforms are skipped with a logged reason instead of silently re-routing WhatsApp/webhook destinations to Telegram.

Earlier releases covered the pre-split single-plugin history; see the project site for details.

= 1.0.0 =
Initial official release.
