=== Fast2SMS - OTP Login & SMS Notifications ===
Contributors: fast2smsdev, sid2026
Tags: otp, sms, whatsapp, woocommerce, bulk-sms
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Free OTP login, WhatsApp & SMS order notifications, bulk campaigns, COD verification and abandoned cart recovery for WordPress & WooCommerce.

== Description ==

Add **OTP login**, **WhatsApp and SMS order notifications**, **abandoned cart recovery**, **COD verification** and **bulk campaigns** to WordPress and WooCommerce with the official Fast2SMS plugin.

The plugin is completely free. Bring your own Fast2SMS API key — messages are billed to your own Fast2SMS wallet at your account rates, and delivery reports stay in your own Fast2SMS panel. No monthly fee, no per-site licence.

= WooCommerce automations =
* Order placed, payment received, order completed, cancelled, refunded
* COD order alerts + one-tap COD OTP verification link (reduce RTO)
* Abandoned cart recovery with configurable delay
* SMS, WhatsApp, or both per event — pick approved DLT / WhatsApp templates straight from your Fast2SMS account with variable mapping

= OTP everywhere =
* Login with OTP on the WooCommerce login form and wp-login.php
* Phone verification on signup/registration
* `[fast2sms_otp_login]` shortcode for any page or Elementor
* OTP verification on Contact Form 7 (`[fast2sms_otp]` tag), WPForms and Elementor Pro Forms (`[fast2sms_otp_verify]`)
* Rate limits built in: per-phone, per-IP, attempt caps and resend cooldown

= Bulk campaigns =
* Send an approved template to all customers, all users, or a pasted/CSV list
* Queue-based sending with automatic retries and full logs

= More =
* Wallet balance and SMS count in the dashboard header
* Admin SMS/WhatsApp alert on form submissions
* Low-balance email alert
* Message logs with masked phone numbers
* Phone numbers and API key encrypted at rest (AES-256-GCM), automatic data retention purge

Works without WooCommerce too — OTP login, form OTP, form alerts and campaigns run on plain WordPress. WooCommerce-only features light up automatically when WooCommerce is installed.

= Requirements =
* A free account at [fast2sms.com](https://www.fast2sms.com) with your own API key
* For SMS: approved DLT templates in your Fast2SMS panel
* For WhatsApp: approved WhatsApp templates in your Fast2SMS panel
* For OTP: an OTP ID created in your Fast2SMS panel (Smart OTP section)
* Target market: India (10-digit Indian mobile numbers)

= Guides & documentation =
* [Complete setup guide](https://www.fast2sms.com/help/fast2sms-wordpress-plugin-setup-guide/) — every feature, step by step
* [OTP login for WordPress](https://www.fast2sms.com/help/free-otp-login-wordpress/) and [for WooCommerce](https://www.fast2sms.com/help/woocommerce-otp-login/)
* [SMS & WhatsApp order notifications](https://www.fast2sms.com/help/woocommerce-sms-whatsapp-order-notifications/) and [WhatsApp-only setup](https://www.fast2sms.com/help/woocommerce-whatsapp-notifications/)
* [WhatsApp OTP with SMS fallback](https://www.fast2sms.com/help/whatsapp-otp-wordpress/)
* [DLT registration explained for store owners](https://www.fast2sms.com/help/dlt-sms-wordpress/)
* [Bulk SMS campaigns from WordPress](https://www.fast2sms.com/help/bulk-sms-wordpress-plugin/)
* [WhatsApp Business API setup](https://www.fast2sms.com/help/whatsapp-business-api-wordpress/)

== Installation ==

1. Install and activate the plugin.
2. Open the Fast2SMS menu in wp-admin.
3. Paste your Fast2SMS API key — it is validated live against your account and stored encrypted.
4. Enable the automations you want and pick templates fetched from your account.
5. Recommended: add a real server cron for instant delivery (shown on the Dashboard tab). Without it, WP-Cron is used as a fallback.

== Frequently Asked Questions ==

= Does this plugin charge anything? =
No. You bring your own Fast2SMS API key; message costs are billed by Fast2SMS to your own wallet at your account's rates.

= Does it work without WooCommerce? =
Yes. OTP login, registration OTP, form OTP, form submission alerts and bulk campaigns work on plain WordPress. Order notifications, COD verification and abandoned cart recovery require WooCommerce and unlock automatically when it is installed.

= Which form plugins are supported? =
Contact Form 7, WPForms and Elementor Pro Forms — both for OTP verification and admin submission alerts.

= How is customer data protected? =
Phone numbers, message variables and your API key are encrypted at rest with AES-256-GCM. Phones are masked in all screens and logs, and old records are purged automatically on a schedule you control.

= Why do my messages need templates? =
Indian DLT regulations require pre-approved sender IDs and templates for SMS. Manage them in your Fast2SMS panel; the plugin fetches your approved templates for one-click selection.

= Which countries are supported? =
India only. Fast2SMS sends to Indian 10-digit mobile numbers with full DLT compliance as required by TRAI. If your customers are outside India, this plugin is not for you.

= Do I need DLT registration? =
For SMS, yes — it is mandatory in India for every business. Fast2SMS provides free dedicated DLT support to get you registered. WhatsApp messages need no DLT, only Meta template approval. [DLT explained in simple English](https://www.fast2sms.com/help/dlt-sms-wordpress/).

= Can OTPs be delivered on WhatsApp? =
Yes. Create a Smart OTP in your Fast2SMS panel with WhatsApp as the primary channel and SMS as automatic fallback (or the other way around). The plugin follows whatever the OTP ID is configured for — no code changes.

= Where do I get an API key? =
Create a free account at [fast2sms.com](https://www.fast2sms.com) and copy the key from the Dev API section. Paste it into the plugin dashboard and it is validated live.

== Screenshots ==

1. Dashboard — connected Fast2SMS account with wallet balance, setup checklist and 30-day stats.
2. Automations — one toggle per WooCommerce event, with template pickers and live phone previews.
3. OTP & Login — Smart OTP setup with an end-to-end test and login form options.
4. Forms — OTP verification for Contact Form 7, WPForms and Elementor Pro Forms.
5. Campaigns — bulk composer with audience selection, scheduling and live message preview.
6. Logs — full message history with one-click retry and CSV export.
7. Settings — consent checkbox, do-not-send list, admin numbers and data retention.
8. Login with OTP as your customers see it, right inside the login form.

== External services ==

This plugin connects to the Fast2SMS API (https://www.fast2sms.com) to send SMS/WhatsApp messages, send/verify OTPs, fetch your approved templates and read your wallet balance. Your API key and the recipient phone numbers of messages you configure are sent to Fast2SMS for this purpose. See the [Fast2SMS privacy policy](https://www.fast2sms.com/privacy-policy) and [terms](https://www.fast2sms.com/terms-conditions).

== Changelog ==

= 1.8.0 =
* Plugin review feedback: all scripts are now enqueued via wp_enqueue/wp_register_script (no inline script tags), every declaration/global/hook/stored key uses the full fast2sms_ prefix, and the terms URL is corrected.

= 1.7.2 =
* Nonce verification is now inline in every admin AJAX handler (visible to static analysis), in addition to the shared guard.

= 1.7.1 =
* Code-quality pass from Plugin Check feedback: fully literal table names in uninstall/privacy/storage queries, and the invoice snapshots table is now removed on uninstall too.

= 1.7.0 =
* Searchable template picker: find templates by message text, ID or sender — with the current selection highlighted.
* Auto-generated invoice PDFs: attach a professional PDF invoice to WhatsApp messages via {invoice_url} — rendered on the fly, never stored as files.
* WhatsApp previews now show your verified business name.
* Test-send panel: pick channel and send to your primary or all admin numbers, with per-number results and the Fast2SMS request_id for delivery-report tracing.
* "Also alert admin" toggle per automation sends a copy of every message to your admin numbers.
* Many new variables: {subtotal} {discount} {tax} {currency} {coupon_code} {shipping_method} {product_name} {order_status_url} {invoice_url} and more.
* Logs: hover any row for the raw API response, bulk "Retry all failed", CSV export with full numbers (admin-only).
* Data & storage panel: see what the plugin stores, clean old data on demand — plus automatic retention purging every cycle and a hard cap so storage can never fill up.
* Admin numbers are now stored encrypted and shown masked; GDPR personal-data eraser support.
* Do-not-send list now applies to marketing messages (cart reminders, campaigns, welcome, review requests) while transactional order updates still deliver.

= 1.6.4 =
* All Fast2SMS API calls now identify themselves with an xsource=wordpress parameter, so plugin traffic is distinguishable in the Fast2SMS backend.

= 1.6.3 =
* WordPress.org submission readiness: Plugin Check fixes (file encoding, fully prepared SQL, i18n comment) and plugin renamed to comply with directory naming rules.

= 1.6.1 =
* Settings now auto-save — no more scrolling to a Save button.
* Admin numbers are managed as chips (add one at a time, remove with one click), matching the do-not-send list UX.

= 1.6.0 =
* Opt-out / consent management: do-not-send list in Settings (queued messages skip it automatically) + optional "Send me order updates" consent checkbox at checkout.
* Review request automation: ask for a product review N days after order completion, with {review_url}.
* Scheduled campaigns: pick a date & time, the campaign fires then (site timezone).
* Multiple admin numbers: comma-separated list — every admin alert goes to all of them.
* Campaign SMS now uses Fast2SMS's multi-request bulk API (/dev/custom) — up to 500 messages per API call, dramatically faster large campaigns.

= 1.5.0 =
* OTP setup test: send a real Smart OTP to your own number and verify it, straight from the OTP tab — and see which channel (SMS or WhatsApp) your OTP ID is configured for at Fast2SMS.

= 1.4.1 =
* Clear guidance when the connected account has no approved templates yet: fetching now explains to add DLT templates / approve WhatsApp templates in the Fast2SMS panel first.

= 1.4.0 =
* Cleaner automation editor: SMS and WhatsApp configs are now separated into clearly-labelled channel cards.
* Fixed the WhatsApp preview header being cut by the phone notch.
* More variables for WordPress events: {email}, {message}, {username}, {first_name}, {site_url}, {date}, {time} on welcome/form events; {site_url} and {date} in campaigns.
* Header now shows the official plugin title, support email (support@fast2sms.com) and a one-click "Recharge wallet" link (the wallet chip links to fast2sms.com too).
* If your API key is changed or revoked in the Fast2SMS panel, wp-admin now shows a fix-it notice automatically (and clears it once a new key works).

= 1.3.0 =
* Send test: fire a real message with sample values from every automation and campaign, straight to your own number, before going live.
* Setup checklist on the dashboard (click an item to jump to the right tab).
* 30-day message stats (sent / failed / in queue) on the dashboard.
* Logs: one-click retry for failed messages + CSV export.
* Clear "Indian mobile numbers only" notes across the UI.

= 1.2.0 =
* Live phone-style previews: see the exact SMS and WhatsApp message (with mapped variables highlighted) beside every automation and campaign while you configure it.
* OTP login form customizer: light/dark theme, accent color, corner style and custom title — with live preview.
* UI polish across the admin.

= 1.1.0 =
* New automations: order processing, on hold, failed, note added to order, new-order admin alert, low-stock and out-of-stock admin alerts.
* WhatsApp media headers: attach an image/PDF (e.g. order invoice) via media URL + document filename, with per-message variables.
* Many more template variables: first/last name, order status, payment method, order date, item count, first item, city, pincode, order URL.
* OTP: SIM-swap protection — block OTP-only login for administrator accounts (on by default).
* New minimal white/grey UI with blue accents and the Fast2SMS logo.

= 1.0.0 =
* Initial release.
