=== Pingtrix – Notifications for Telegram and MAX ===
Contributors: akklex
Tags: telegram, notifications, woocommerce, contact form 7, max
Requires at least: 6.2
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

Get WooCommerce orders, form submissions, comments, registrations and admin logins in Telegram and MAX. Free, with no limits.

== Description ==

Pingtrix sends site events to your Telegram and MAX chats the moment they happen: a new order, a request from a contact form, a comment waiting for moderation. Everything described here is free, with no limits or ads. An optional add-on, Pingtrix Pro, adds separate recipients for each event, message buttons and quiet hours.

Plugin homepage with screenshots and setup steps (in Russian): [genius-bot.ru/plugins/pingtrix/](https://genius-bot.ru/plugins/pingtrix/)

= Channels =

* **Telegram** – a bot created with @BotFather sends messages to you, a group or a channel.
* **MAX** – a bot from the MAX partner platform sends messages to a chat or a user.
* Use one channel or both at the same time.
* "Send a test message" and "Find chat ID" buttons on the settings page.

= Events =

* New WooCommerce order: number, total, customer name, phone and e-mail, items, payment and shipping method, link to the order. Classic and block checkout, HPOS compatible.
* WooCommerce order status changed (off by default).
* Contact Form 7, WPForms and Elementor Pro form submissions with all fields.
* New comment awaiting moderation.
* New user registration.
* Administrator login (off by default) – useful as a security alert.

Every event can be turned on or off, and every message can be edited with placeholders such as `{order_number}`, `{customer_phone}` or `{fields}`. A line disappears when its placeholders are empty, so messages stay clean.

= Privacy and safety =

* Password, payment card, CVV and captcha fields are never sent. Values that look like a card number are skipped as well.
* Bot tokens are stored in the site options and never shown in full on the settings page.
* Messages are sent in the background after the page is served, so forms and checkout are not slowed down. A failed message is retried once.
* The Log tab shows the last 50 delivery attempts (without message texts).

== Installation ==

1. Install and activate the plugin.
2. Open **Settings → Pingtrix**.
3. Telegram: create a bot with @BotFather, paste the token, send any message to the bot, click **Find chat ID** and **Save Changes**.
4. MAX: create a bot on the MAX partner platform (business.max.ru), paste the token, start a dialog with the bot or add it to a chat, click **Find chat ID** and **Save Changes**.
5. Click **Send a test message**, then choose the events on the **Events** tab.

== Frequently Asked Questions ==

= Does the plugin send data anywhere? =

Only to the messengers you enable, and only the notifications you turn on. See "External services" below. There is no tracking and no other external requests.

= How do I send notifications to a Telegram group or channel? =

Add the bot to the group (for a channel – as an administrator), send a message there and click **Find chat ID**. Group and channel IDs start with -100. For a public channel you can also enter @channelname.

= Who can create a MAX bot? =

MAX allows bots only for verified organizations and entrepreneurs registered in Russia. The token is in the bot settings on the partner platform.

= "Find chat ID" does not work for MAX. =

The bot can receive updates either by webhook or by request, not both. If the bot is already connected to another service with a webhook, enter the chat ID manually.

= MAX test message fails with an SSL certificate error. =

The MAX API may use a certificate issued by the Russian Trusted Root CA, which some servers do not trust. Ask your hosting to add this root certificate, or pass your own CA bundle with the `pingtrix_max_request_args` filter (`sslcertificates` argument). The plugin never disables certificate checks.

= Messages arrive late. =

By default messages are sent by WP-Cron right after the page is served. If your hosting blocks WP-Cron loopback requests, choose **Delivery: At the end of the request** on the Channels tab, or run WP-Cron from the server scheduler.

= Where can I get help? =

Use the plugin support forum on WordPress.org or write to the developer in Telegram: https://t.me/Alex_mlr_dev

= Developer hooks =

* `pingtrix_message_vars` (filter) – placeholder values of a message.
* `pingtrix_message_text` (filter) – final text; return an empty string to skip the message.
* `pingtrix_sensitive_pattern` (filter) – regular expression for field names that are never sent.
* `pingtrix_telegram_request_args`, `pingtrix_max_request_args` (filters) – HTTP request arguments.

== External services ==

This plugin connects to the messenger APIs below only when you enable a channel and enter its bot token. Nothing is sent before that.

= Telegram Bot API =

Provided by Telegram (api.telegram.org). Used to deliver notifications to the chat you choose.

* When: each time an enabled event happens on the site (new order, order status change, form submission, comment awaiting moderation, user registration, administrator login), when you click "Send a test message", and when you click "Find chat ID".
* What is sent: the bot token (as part of the request URL), the chat ID and the text of the notification built from your template. Depending on the event the text can contain order details (number, total, items, customer name, phone, e-mail, payment and shipping method), form fields entered by visitors (except passwords, payment card and captcha fields), comment author name, e-mail and text, the username, e-mail and role of a new user, or the username and IP address of an administrator who logged in, plus the site name and admin links. "Find chat ID" requests the bot's recent updates (getUpdates).
* Terms of service: https://telegram.org/tos
* Privacy policy: https://telegram.org/privacy

= MAX Bot API =

Provided by LLC "MAX" (platform-api2.max.ru). Used to deliver notifications to the MAX chat or user you choose.

* When: each time an enabled event happens on the site (the same events as above), when you click "Send a test message", and when you click "Find chat ID".
* What is sent: the bot token (in the Authorization header), the chat or user ID and the text of the notification built from your template, with the same data as listed for Telegram. "Find chat ID" requests the bot's recent updates (GET /updates).
* Terms of use: https://legal.max.ru/ps
* Privacy policy: https://legal.max.ru/pp

== Screenshots ==

1. Channels: Telegram and MAX settings with test buttons.
2. Events with editable message templates.
3. Delivery log.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
