=== TGSend Notifications for Telegram ===
Contributors: artcevvv
Donate link: https://artcevvv.com
Tags: telegram, notifications, woocommerce, contact form 7, wpforms
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send instant Telegram notifications when Contact Form 7, WPForms, or WooCommerce orders are submitted.

== Description ==

**TGSend** integrates your WordPress site directly with Telegram. Get real-time alerts delivered straight to your Telegram chat, group, or channel whenever a user submits a form or places an order on your store.

### Features
* **Contact Form 7 Integration**: Instant alerts on every form submission with dynamic form field data.
* **WPForms Integration**: Instant notifications for WPForms submissions.
* **WooCommerce Integration**: Get detailed order alerts including items, quantities, totals, customer details, and payment methods.
* **Custom Fields Discovery**: Automatic scanning and mapping of custom checkout and product item meta fields.
* **Customizable Message Templates**: Personalize notification messages using easy-to-use template tags and HTML formatting.
* **Event Logging**: In-depth log viewer to monitor delivery status and debug potential API issues.
* **Multilingual Ready**: Built-in support for English and Russian with seamless translation options.

== Installation ==

1. Upload the `tgsend-telegram-integration` folder to the `/wp-content/plugins/` directory, or install the plugin directly through the WordPress plugins screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Obtain a Bot Token from [@BotFather](https://t.me/BotFather) on Telegram.
4. Retrieve your Chat ID (or group/channel ID).
5. Navigate to **TGSend** in your WordPress admin menu, enter your Bot Token and Chat ID, and click **Save Settings**.
6. Switch to the **Integrations** tab to enable and customize your preferred integrations (Contact Form 7, WPForms, WooCommerce).

== Frequently Asked Questions ==

= How do I create a Telegram Bot? =
1. Open Telegram and search for [@BotFather](https://t.me/BotFather).
2. Send the `/newbot` command and follow the prompts to choose a name and username.
3. BotFather will provide an API token (e.g. `123456789:ABCdefGhIjklMnopQrstUvwxYZ`).
4. Copy and paste this token into TGSend settings.

= How do I get my Chat ID? =
* **Personal Chat**: Send any message to your bot, then open `https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates` in your browser. Look for the `chat.id` value.
* **Group or Channel**: Add your bot as an administrator to your group or channel, post a message, and check the same `getUpdates` URL (the group ID will be a negative number, e.g. `-1001234567890`).

= Can I customize the notification message layout? =
Yes! In the **Integrations** tab, you can customize message templates using HTML formatting (`<b>`, `<i>`, `<a>`, `<code>`) and dynamic tags such as `{order_number}`, `{customer_name}`, `{items}`, `{fields}`, etc.

== Screenshots ==

1. TGSend Bot Configuration & Settings screen.
2. Integrations and custom message templates management.
3. Custom WooCommerce field detection and mapping.
4. Event logs and transmission history.

== External Services ==

This plugin connects to the **Telegram Bot API** (a third-party external service) to deliver notifications.

**What is it used for?**
When a Contact Form 7 or WPForms submission is received, or a WooCommerce order is placed, this plugin sends a notification message to a Telegram chat, group, or channel configured by the site administrator.

**What data is sent?**
The data sent depends on which integrations are enabled and how message templates are configured. It may include form field values (e.g. name, email, message) and/or WooCommerce order details (e.g. order number, items, totals, customer name and address). Data is transmitted only when the relevant form submission or order event occurs and only if a valid Bot Token and Chat ID have been configured.

**Service provider:** Telegram Messenger Inc.
* Service endpoint: `https://api.telegram.org/`
* [Telegram Terms of Service](https://telegram.org/tos)
* [Telegram Privacy Policy](https://telegram.org/privacy)

This plugin is not affiliated with or endorsed by Telegram Messenger Inc.

== Changelog ==

= 1.1.1 =
* Resolved Plugin Check compliance requirements.
* Added full Russian language translation.
* Improved template placeholders and translators documentation.
* Sanitization and security improvements across admin and database queries.

= 1.0.0 =
* Initial public release.

== Upgrade Notice ==

= 1.1.2 =
Maintenance release with Plugin Check compliance fixes and security improvements. Upgrade recommended.
