=== markhubs Store Manager for Telegram ===
Contributors: markhubs
Tags: woocommerce, telegram, bot, ecommerce, chatbot
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Turn your WooCommerce store into a Telegram sales bot with 25 core commands.

== Description ==

markhubs Store Manager for Telegram lets your customers browse products, place orders, track shipments and chat with your store, directly inside Telegram.

**Included in this plugin:**

* Single bot + single admin agent
* 25 core bot commands (/start, /help, /products, /search, /cart, /track, /myorders, etc.)
* New order notifications to admin
* Order status updates to customers
* Product search
* Order tracking
* Basic cart & checkout
* English language
* Webhook auto-setup, protected with a per-site secret key
* HPOS compatible

A separately hosted Premium edition with AI customer support, a full CRM with Kanban pipeline, an automation rules engine, multi-agent support, more languages, WhatsApp Business API, a REST API, PDF reports and forecasting is available from the developer's own site: https://nayanray.com/markhubs-store-manager-for-telegram. Nothing in this plugin is locked or time-limited; the Premium edition is separate, additional software.

Source code / issue tracker: https://github.com/dev-nayanray/markhubs-store-manager-for-telegram

= Key Features =

* Native Telegram bot integration
* Real-time order notifications
* Product search & catalog browsing
* Cart management with inline keyboards
* Order tracking by ID
* Customer self-service
* Webhook auto-setup
* Lightweight, only 2 DB tables

== Installation ==

= Automatic installation =

1. Log into your WordPress admin
2. Go to Plugins → Add New → Upload Plugin
3. Choose `markhubs-store-manager-for-telegram.zip` and click Install Now
4. Activate the plugin
5. Go to TG Manager → Settings to configure your bot

= Manual installation =

1. Extract the zip file
2. Upload the `markhubs-store-manager-for-telegram` folder to `/wp-content/plugins/`
3. Activate the plugin in WordPress admin
4. Go to TG Manager → Settings

= Setup =

1. Create a bot with @BotFather on Telegram (https://t.me/BotFather)
2. Copy the bot token
3. Paste it into TG Manager → Settings → Bot Token
4. Enter your Admin Chat ID (message your bot with /id to find it)
5. Click "Set webhook"
6. Open your bot in Telegram and send /start

== External services ==

This plugin connects to the **Telegram Bot API** (api.telegram.org) so your store can send and receive messages through your own Telegram bot. This is core to the plugin's functionality and only runs once you enter a Bot Token in TG Manager → Settings.

**What is sent, and when:**

* When an order is placed or its status changes, the order details (order number, status, items, totals) and the customer's Telegram Chat ID are sent to `https://api.telegram.org/bot<your-token>/sendMessage` (and `/sendPhoto` for product images) so the notification can be delivered.
* When a customer messages your bot, Telegram forwards that message (chat ID, first/last name, username, message text) to your site's webhook URL (`https://yoursite.com/?wtm_free_webhook=1&key=<your-site-secret>`), which the plugin sanitizes and stores locally in two custom database tables (`wp_wtm_users`, `wp_wtm_chats`) so conversations and registered customers can be tracked. The `key` parameter is a secret generated on your own site at activation and is required for the webhook to accept a request.
* When you click "Set webhook" / "Delete webhook" or the bot connection status is checked, a request is sent to `https://api.telegram.org/bot<your-token>/setWebhook`, `/deleteWebhook`, or `/getMe`.

No data is sent to any server operated by the plugin author. All communication is directly between the site and Telegram, using the site owner's own bot token.

Telegram's Terms of Service: https://telegram.org/tos
Telegram's Privacy Policy: https://telegram.org/privacy

== Frequently Asked Questions ==

= Is this plugin really free? =
Yes. 100% free, GPL-licensed, fully functional, no time limits, no nag screens.

= Does it work with HPOS? =
Yes, the plugin is fully compatible with WooCommerce's High-Performance Order Storage.

= Does it require SSL? =
Yes, Telegram only delivers webhooks over HTTPS. You can get a free Let's Encrypt certificate from your host.

= How do I find my Chat ID? =
After setup, message your bot with /start, then /id, it will reply with your chat ID.

= Is there a Premium edition? =
Yes, a separately hosted Premium edition with more features is available from the developer's own site, and it is entirely optional.

== Screenshots ==

1. Bot configuration screen
2. Customer chat with inline keyboards
3. Order notification in admin chat
4. Product search results

== Changelog ==

= 1.0.0 =
* Initial release
* 25 core bot commands
* Order notifications and tracking
* Product search and cart
* Webhook auto-setup with per-site secret key authentication
* HPOS compatibility
* All webhook-sourced input sanitized before database storage

== Upgrade Notice ==

= 1.0.0 =
Initial release.
