=== Dynamic Webhook Automator ===
Contributors: kiyaanix, jogesh_pi
Donate link: https://bit.ly/4w8KepA
Tags: memberpress, webhooks, automation, crm, membership
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send MemberPress membership events to CRMs, automation tools, reporting systems, and internal apps with secure, flexible webhook rules.

== Description ==

Dynamic Webhook Automator for MemberPress helps WordPress membership sites connect MemberPress activity with the other tools their business depends on.

When something important happens in MemberPress, this plugin can automatically send the right information to another system. For example, you can send new member details to a CRM, notify your team about failed payments, update a reporting system after a transaction, or trigger an automation platform when a subscription changes.

The plugin adds a Webhook Automations area to each MemberPress Membership. From there, you can create one or more webhook rules that decide when data should be sent, where it should go, what information should be included, and how failed deliveries should be handled.

You do not need the MemberPress Developer Tools add-on to use this plugin.

= Built for MemberPress membership automation =

MemberPress is powerful for selling and managing memberships. Many businesses also need membership data to move into other systems, including:

* CRM platforms
* Email marketing tools
* Automation platforms
* Internal dashboards
* Reporting systems
* Accounting workflows
* Support and onboarding tools
* Custom business applications

Dynamic Webhook Automator for MemberPress gives you a structured way to send that data without hard-coding every integration.

= Create multiple webhook rules per membership =

Each MemberPress Membership can have multiple independent webhook rules.

For example, one membership can:

* Send new member details to a CRM.
* Send completed payment details to a reporting tool.
* Notify an internal workflow when a recurring payment fails.
* Trigger an automation when a subscription is paused or resumed.

Each rule has its own event, endpoint URL, payload fields, authentication settings, retry policy, and logging preferences.

= Choose the MemberPress events that matter =

Create webhook automations for important membership activity, such as:

* Member added
* Member signup completed
* Transaction completed
* Renewal transaction completed
* Recurring transaction completed
* Recurring transaction failed
* Transaction refunded
* Subscription created
* Subscription paused
* Subscription resumed
* Subscription stopped
* Subscription expired

This helps your external systems stay updated when members join, pay, renew, cancel, pause, resume, or run into billing issues.

= Send exactly the data the receiving app needs =

Every webhook rule includes payload mapping. This means you choose the fields that should be sent and where each value should come from.

You can include data such as:

* Member name
* Member email
* User ID
* Membership ID
* Membership title
* Transaction ID
* Transaction status
* Transaction total
* Subscription status
* Event name
* Event ID
* Site name
* Site URL
* Static values that you type yourself
* Dates and date/time values
* Tags or fixed labels

This gives non-technical administrators a clearer way to shape webhook data for CRMs, automation tools, and business systems.

= Static values, dates, and custom labels =

Not every field needs to come from MemberPress. You can also send static values.

Examples include:

* Campaign name
* Department
* Internal source label
* CRM tag
* Fixed status value
* Custom date
* Custom date and time

Static values are useful when the receiving app needs extra context that does not already exist in MemberPress.

= Transform values before sending =

Some receiving systems require data in a specific format. The plugin supports value transformations so your webhook payload can be cleaner and more useful.

Examples include:

* Trim extra spaces
* Convert text to lowercase
* Convert text to uppercase
* Convert comma-separated text into a list
* Convert a list into comma-separated text
* Format dates
* Convert values into numbers
* Convert values into true or false
* Add a prefix or suffix
* Normalize phone numbers
* Hash a value with SHA-256

= Decide what happens when data is missing =

Sometimes a value may not be available for a specific MemberPress event. For each payload field, you can choose how the plugin should handle missing data.

Options include:

* Skip the field
* Send an empty value
* Send null
* Use a default value
* Stop the webhook because the value is required

This helps prevent incomplete or incorrect data from being sent by mistake.

= Start faster with webhook presets =

Webhook presets provide a ready-made starting point for common workflows.

Instead of starting with a blank webhook rule, you can choose a preset, review its guidance, and customize it for your site.

You can still create a blank webhook rule whenever you want full control.

= Secure webhook authentication =

Different receiving systems require different authentication methods. The plugin supports common webhook authentication options, including:

* No authentication
* HMAC SHA-256 signing
* Bearer token
* Basic authentication
* Custom secret header
* Custom request headers

Saved secrets are not shown back in the admin screen. Rules store secret references instead of plain text secrets.

= HMAC signed webhook requests =

For systems that need to confirm a webhook really came from your WordPress site, the plugin can sign requests using HMAC SHA-256.

This helps the receiving system reject fake, modified, or untrusted requests.

= Test webhook rules before using them live =

You can send a test webhook from the admin area.

Testing helps confirm that:

* The endpoint URL is correct.
* Authentication is configured correctly.
* The payload contains the expected fields.
* The receiving app accepts the request.

Test deliveries are marked separately from normal live webhook deliveries.

= Background delivery that protects checkout performance =

Webhook requests are sent in the background.

The plugin does not make remote webhook requests directly inside sensitive MemberPress checkout, payment, or event requests. Instead, it stores a delivery record and processes the webhook through a queue.

This helps avoid slowing down the member checkout experience.

= Retry temporary failures automatically =

If a webhook fails because of a temporary problem, the plugin can retry it.

Temporary problems can include:

* Network errors
* Timeouts
* Rate limits
* Temporary server errors from the receiving app

The plugin does not retry forever. After the retry limit is reached, the delivery can be reviewed.

= Duplicate protection =

The plugin includes duplicate protection so the same event and webhook rule combination is not accidentally processed multiple times as a new delivery.

Webhook requests also include an idempotency key, which helps receiving systems avoid duplicate processing.

= Delivery logs for visibility =

Delivery logs help administrators understand what happened.

Logs can help answer:

* Was the webhook sent?
* Which rule sent it?
* Did the receiving app accept it?
* What status code came back?
* Did the request fail temporarily or permanently?

Sensitive information such as tokens, signatures, authorization headers, cookies, passwords, and secrets should be redacted from logs.

= Designed with security and privacy in mind =

Webhook automation can involve personal data and external requests, so the plugin is designed with practical safety controls.

Security-focused behavior includes:

* HTTPS-first webhook URLs
* Safer URL validation
* Protection against unsafe local and private network destinations
* Limited redirects
* Bounded request timeouts
* Secret references instead of plain text rule secrets
* Redaction of sensitive values in logs and errors
* Dedicated permissions for managing settings, logs, secrets, tests, and retries

Site owners should still review their privacy obligations and disclose any external data sharing where required.

= Who should use this plugin? =

Dynamic Webhook Automator for MemberPress is useful for:

* Membership site owners
* Agencies building MemberPress websites
* Operations teams
* Marketing teams
* CRM administrators
* Developers who want a structured webhook system for MemberPress

= Example use cases =

Send new members to a CRM:

When someone signs up, send their name, email address, membership name, and signup event ID to your CRM.

Notify your team about failed payments:

When a recurring payment fails, send the member email, subscription status, and membership name to an internal workflow.

Update an external reporting system:

When a transaction is completed, send the transaction ID, total, membership ID, and member email to a reporting tool.

Trigger an automation platform:

When a subscription is paused or resumed, send the event details to an automation platform so it can update tags, send emails, or start a workflow.

Add fixed business context:

Send static values such as campaign name, source label, department, tags, custom dates, or fixed status values along with MemberPress data.

== Installation ==

1. Upload the plugin directory to `/wp-content/plugins/dynamic-webhooks-memberpress/`.
2. Activate the plugin from the WordPress Plugins screen.
3. Make sure MemberPress is installed and active.
4. Open a MemberPress Membership in the WordPress admin area.
5. Find the Webhook Automations section.
6. Add a blank webhook rule or choose a preset.
7. Select the event, endpoint URL, authentication, payload fields, retry policy, and logging options.
8. Save the membership.
9. Use the test webhook option to confirm the receiving app accepts the request.

If you are deploying from source, install Composer dependencies before use.

== Frequently Asked Questions ==

= What does this plugin do? =

It sends MemberPress membership activity to other apps using webhooks. For example, it can send new signup data to a CRM, payment data to a reporting system, or subscription changes to an automation platform.

= Do I need the MemberPress Plugin? =

Yes. This plugin requires MemberPress to provide its operational webhook automation features. If MemberPress is not active, the plugin does not register its MemberPress integration screens or event listeners.

= Do I need the MemberPress Developer Tools add-on? =

No. This plugin is designed to work without requiring the MemberPress Developer Tools add-on.

= What is a webhook? =

A webhook is an automatic message sent from one system to another when something happens. In this plugin, MemberPress events can trigger webhook messages to external apps.

= Can I create more than one webhook rule? =

Yes. Each MemberPress Membership can have multiple webhook rules. Each rule can send different data to a different endpoint.

= Can different memberships have different webhook rules? =

Yes. Rules are configured at the membership level, so each membership can have its own webhook setup.

= What MemberPress events can trigger webhooks? =

Supported events include member signup, transaction completion, renewal transactions, recurring payment success or failure, refunds, subscription creation, subscription pause, subscription resume, subscription stop, and subscription expiration.

= Can I choose which fields are sent? =

Yes. Payload mapping lets you choose the fields that are sent and the source of each value.

= Can I send custom static values? =

Yes. You can send fixed values such as tags, labels, campaign names, departments, custom dates, custom date/time values, numbers, true/false values, and text.

= Can I send user meta? =

Yes, with safety controls. The plugin is designed to block protected or sensitive user meta keys such as passwords, session data, capabilities, authentication tokens, and payment secrets.

= Can I transform values before sending them? =

Yes. You can trim text, change case, format dates, convert values, add prefixes or suffixes, normalize phone numbers, hash values, and more.

= Does the plugin support authentication? =

Yes. It supports no authentication, HMAC SHA-256 signing, bearer tokens, basic authentication, custom secret headers, and custom request headers.

= Are secrets stored safely? =

Rules store references to secrets, not plain text secrets. Saved secrets are not rendered back into the admin screen.

= Can I test a webhook before using it live? =

Yes. The plugin includes test webhook functionality so you can check the endpoint, authentication, and payload before relying on the rule in production.

= Will webhook requests slow down checkout? =

Webhook requests are designed to run in the background. The plugin does not send remote webhook requests directly inside MemberPress checkout or payment handling requests.

= What happens if a webhook fails? =

Temporary failures can be retried automatically according to the retry policy. Final failures can be reviewed through delivery logs.

= Does the plugin prevent duplicate webhook deliveries? =

The plugin includes duplicate protection and sends an idempotency key so receiving systems can also avoid duplicate processing.

= Can I view webhook logs? =

Yes. Delivery logs help show whether a webhook was sent, which rule sent it, what response came back, and whether it succeeded or failed.

= Does the plugin send sensitive data into logs? =

The plugin is designed to redact sensitive information such as authorization headers, signatures, cookies, tokens, passwords, API keys, and secrets.

= Can I use HTTP URLs? =

HTTPS is expected by default. HTTP should only be used in explicitly enabled development environments.

= Why was my webhook URL rejected? =

The plugin blocks unsafe destinations such as localhost, loopback, private network addresses, reserved addresses, and metadata-service addresses unless a deliberate development exception is enabled.

= Does this plugin replace Zapier, Make, or other automation platforms? =

No. It can send data to those platforms or to custom endpoints, but it is focused on controlled MemberPress webhook delivery rather than replacing full automation platforms.

= Is this plugin for non-technical users? =

Yes. The admin interface is designed so site owners and administrators can configure webhook rules without editing code. Some receiving apps may still require endpoint or authentication details.

= Can developers extend it? =

The plugin is built with extension points in mind. Future versions are planned to include more public filters, actions, presets, templates, analytics, notifications, and response mapping controls.

= What happens if MemberPress is not active? =

Operational MemberPress features are not registered. The plugin should show an admin notice and avoid adding the membership metabox until MemberPress is available.

== Privacy ==

This plugin does not send data to a service controlled by the plugin author.
Administrators can configure webhook endpoints operated by third parties. Depending on the configured payload, webhook requests may include personal data such as names, email addresses, membership information, transaction information, subscription information, and user metadata.
No webhook data is transmitted until an administrator creates and enables a webhook rule. Site owners are responsible for reviewing the privacy policies and data-processing requirements of their configured webhook recipients.
The plugin may retain delivery records and response metadata in the WordPress database. Sensitive headers and configured secrets are redacted from logs.

== Screenshots ==

1. Webhook Automations metabox on a MemberPress Membership.
2. Multiple webhook rules configured for one membership.
3. Payload mapping fields for choosing what data is sent.
4. Static value, date, and date/time field controls.
5. Authentication and signing settings.
6. Delivery logs for reviewing webhook activity.

== Changelog ==

= 1.0.1 =

* Added import/export controls to the membership Webhook Automations metabox.
* Added JSON import preview and commit workflow.
* Added export for selected rules, all membership rules, and global templates.
* Added safe display of import validation errors.

= 1.0.0 =

Initial release.

* MemberPress dependency guard.
* Membership-level Webhook Automations metabox.
* Multiple webhook rules per membership.
* Core MemberPress event support.
* Dynamic payload mapping.
* Static values, dates, date/time values, tags, JSON arrays, and JSON objects.
* User, user meta, membership, transaction, subscription, dynamic, and static value sources.
* Missing-value policies.
* Transformation pipeline support.
* HMAC SHA-256 request signing.
* Bearer token, basic authentication, custom secret header, and no-auth modes.
* Custom request headers.
* Asynchronous delivery through queue processing.
* Retry handling for temporary failures.
* Duplicate delivery protection.
* Delivery logs.
* Test webhook workflow.
* Preset-based rule creation.
* Secret reference handling.
* URL safety controls.

== Upgrade Notice ==

= 1.0.1 =

Adds the user-facing import/export workflow for webhook rules and templates.

= 1.0.0 =

Initial release of Dynamic Webhook Automator for MemberPress.
