=== AlertHub ===
Contributors: pericodes
Tags: monitoring, alerts, notification, security, logs
Requires at least: 6.2
Tested up to: 7.0
Stable tag: 1.1.5
Requires PHP: 7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Integrate your WordPress site with AlertHub to receive real-time notifications for critical events, manage custom alerts, and track logs.

== Description ==

AlertHub is a powerful notification management platform that centralizes alerts from all your services into one dashboard and routes them to your preferred channels like Slack, Email, or Mobile Push.

This WordPress plugin connects your site directly to AlertHub, enabling you to turn any WordPress action (Hook) into a notification. Whether you want to know if an administrator logs in, a payment fails, or a critical error occurs, AlertHub keeps you informed in real-time.

By configuring a simple Project Key, you can start monitoring your site within seconds.

**Key Features:**

*   **Easy Integration:** Just paste your AlertHub Project Key.
*   **Custom Alerts Manager:** Create your own alerts for any WordPress hook (e.g., `wp_login_failed`, `wc_order_status_completed`).
*   **Hook Helper:** Includes a dropdown to quickly fill common WordPress hooks into the alert form.
*   **Variable Support:** Use placeholders like `{{0}}` or `{{1.user_email}}` to inject dynamic data from hooks into your alert messages.
*   **Alert History Log:** Keep a local record of all sent alerts with filtering by date, level, and ID.
*   **Performance:** Alerts are sent asynchronously to ensure your site speed is never affected.

== Installation ==

1.  Upload the `alerthub` folder to the `/wp-content/plugins/` directory.
2.  Activate the plugin through the 'Plugins' menu in WordPress.
3.  Go to **Tools -> AlertHub**.
4.  Enter your **Project Key** (found in your AlertHub dashboard).
5.  (Optional) configure a Shared Source name (e.g., "My Shop").
6.  Go to the **Alerts** tab to create your first custom alert.

== Frequently Asked Questions ==

= Where do I get the Project Key? =
You can find your Project Key in your AlertHub project settings page (https://app.thealerthub.com).

= Can I use custom hooks? =
Yes! In the alerts manager, you can type any action hook name triggered by WordPress or other plugins.

= How do I include dynamic data in alerts? =
You can use `{{0}}` for the first argument passed to the hook, `{{1}}` for the second, etc. You can also access object properties like `{{1.post_title}}`.

== External services ==

This plugin connects to the **AlertHub** notification platform to deliver alerts from your WordPress site to your AlertHub dashboard and configured channels (Slack, Email, Telegram, etc.).

**Service:** AlertHub API (`https://api.thealerthub.com/sendAlert`), operated by AlertHub (https://thealerthub.com).

**What it is used for:** Sending alert notifications when a configured WordPress hook fires (for example, a failed login or a custom alert you create in the plugin). Alerts are only sent if you have saved a valid **Project Key** in **Tools → AlertHub**.

**What data is sent and when:** Each time an alert is triggered, the plugin sends a non-blocking HTTPS POST request with a JSON body containing:

* `ah_key` — your AlertHub Project Key (stored in WordPress options after you configure the plugin).
* `ah_title` — the alert title (may include dynamic values from the WordPress hook).
* `ah_description` — the alert message (may include dynamic values from the WordPress hook).
* `ah_level` — severity level (`info`, `warning`, or `critical`).
* `ah_source` — a source label (defaults to your site name, or a name you configure).
* `url` — your WordPress site URL (`get_site_url()`).
* `timestamp` — the date and time the alert was generated on your site.

No data is sent until you enter a Project Key and an alert condition occurs. If the Project Key is empty, the plugin does not contact the API.

**Legal:** This service is provided by AlertHub: [Terms of Service](https://thealerthub.com/terms-of-service), [Privacy Policy](https://thealerthub.com/privacy-policy).

== Screenshots ==
1. Settings page with Project Key configuration.
2. Alerts Manager with hook selection.
3. Alert History Logs.

== Changelog ==

= 1.1.5 =
*   Documented AlertHub external API usage in the readme (WordPress.org compliance).

= 1.0.0 =
*   Initial release with Project Key integration.
*   Added Custom Alerts Manager with native hook selector.
*   Added Alert History Logs with filtering.
*   Added support for dynamic placeholders in alert messages.
