=== Arb WhatsApp Business ===
Contributors: arbdigital
Tags: whatsapp, whatsapp business, chat, woocommerce, click to chat, support, cloud api
Requires at least: 5.6
Tested up to: 6.7
Requires PHP: 7.0
Stable tag: 2.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Enterprise WhatsApp + AI suite: floating widget, Cloud API 2-way chat, Claude AI auto-replies on WhatsApp & website with human handoff, live inbox, WooCommerce, analytics.

== Description ==

Arb WhatsApp Business turns your WordPress / WooCommerce site into a complete WhatsApp + AI customer-engagement channel — like the assistants used by banks and big brands.

**AI assistant (new in 2.0)**

* AI auto-answers customers in their own language (English / Urdu / Roman Urdu) — choose your engine: Claude, OpenAI (ChatGPT), Google Gemini, DeepSeek, xAI Grok, OpenRouter, or any OpenAI-compatible endpoint
* Works on BOTH WhatsApp (Cloud API webhook) and an on-site website chat box
* RAG grounding: answers from your store products, prices and FAQ — no hallucinated info
* Tool use: live product search and WooCommerce order-status lookup
* Smart human handoff — escalates to a live agent on request or its own judgement
* Admin live inbox: read every chat, take over from the AI, reply in real time
* Prompt caching keeps API costs ~90% lower

**Click-to-chat & messaging**

* Floating click-to-chat widget with branded popup
* Unlimited agents with avatars, roles, and per-agent pre-filled messages
* Working hours with online/offline status and away message
* Page & device targeting, logged-in-only mode
* WooCommerce: product "Order on WhatsApp" button, share product, order-received button, share-cart button
* WhatsApp Cloud API: 2-way chat, admin order alerts, status-change messages, templates
* Click analytics dashboard (clicks by source, agent, device, daily trend)
* Shortcodes: [awb_button], [awb_link]
* GDPR consent gate, import/export config, custom CSS, i18n + RTL
* No external dependencies — the AI talks to Claude directly over HTTPS

== Installation ==

1. Upload the `arb-whatsapp-business` folder to `/wp-content/plugins/` (or install the ZIP via Plugins → Add New → Upload).
2. Activate the plugin through the **Plugins** menu.
3. Go to **WhatsApp** in the admin sidebar.
4. Under **General**, enter your WhatsApp number in international format (digits only, e.g. `923001234567`).
5. (Optional) Add team members under **Agents**, set **Working Hours**, and enable **WooCommerce** / **Cloud API** features.

== Cloud API setup ==

1. Create an app at https://developers.facebook.com/ and add the **WhatsApp** product.
2. Copy the temporary or permanent **Access Token** and the **Phone Number ID**.
3. Paste both into **WhatsApp → Cloud API**, enable it, and click **Send test message**.
4. For production, generate a permanent System User token and create approved message templates.

== Shortcodes ==

* `[awb_button text="Order Now" number="923001234567" message="Hi" size="lg" block="yes"]`
* `[awb_link number="923001234567" message="Hello"]Message us[/awb_link]`

== Setup the AI assistant ==

1. Get a Claude API key from console.anthropic.com and paste it under WhatsApp → AI Assistant.
2. Fill in your business name, persona and a Knowledge base / FAQ (shipping, returns, payment, hours).
3. Enable "Use WooCommerce products" so the AI can quote live prices.
4. For website chat: turn on "Enable AI chat box on website".
5. For WhatsApp AI: finish the Cloud API + webhook setup (Cloud API tab), then enable "AI auto-reply on WhatsApp".
6. Use the "Test AI" button to confirm everything works.
7. Manage live conversations and take over from the AI under WhatsApp → Inbox.

== Webhook setup (2-way WhatsApp) ==

1. In WhatsApp → Cloud API, copy the Callback URL (/wp-json/awb/v1/webhook) and set a Verify token.
2. In Meta → WhatsApp → Configuration, paste both, then subscribe to the "messages" field.
3. Add your Meta App Secret in the plugin for signature verification.

== Changelog ==

= 2.0.2 =
* Forward-compatibility hardening for future PHP (8.4 / 8.5+): audited out all deprecated/removed APIs, no dynamic properties, no implicitly-nullable params.
* Added mbstring fallback so the plugin never fatals on servers without the mbstring extension.

= 2.0.1 =
* Multi-provider AI: choose Claude, OpenAI (ChatGPT), Google Gemini, DeepSeek, xAI Grok, OpenRouter, or a custom OpenAI-compatible endpoint.
* Working Hours: timezone is now a proper dropdown (all WordPress timezones).
* Dashboard now shows conversation / needs-human / unread counts with a quick link to the Inbox.
* Auto-creates new database tables on update (no reactivation needed).
* PHP 7.0–8.3 compatible; added index.php hardening; tidy uninstall.

= 2.0.0 =
* Added Claude AI assistant: auto-replies on WhatsApp + website, RAG product/FAQ grounding, tool use, human handoff.
* Added WhatsApp Cloud API inbound webhook (2-way chat).
* Added admin live inbox with agent takeover.
* Added website AI chat box.

= 1.0.0 =
* Initial release.
