Skip to content

sharanvijaydev/wp-webhook-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP Webhook Connector

Connect WordPress events to external services via outgoing webhooks. Supports Slack, Discord, n8n, Make.com, and any custom API — with 12 trigger events, merge tags, connector templates, delivery logging, test & retry, and WooCommerce support.

WordPress PHP License

What It Does

When something happens in WordPress (post published, user registered, order placed), this plugin automatically sends that data to any external service via HTTP webhook — no code required.

WordPress Event → Webhook Rule → HTTP POST → External Service
                                              (Slack, n8n, Discord, Make.com, any API)

Features

Feature Description
📋 Rules Manager Create, edit, enable/disable, and delete webhook rules
⚡ 12 Trigger Events Posts, users, comments, WooCommerce orders, and custom hooks
🏷️ Merge Tags 30+ dynamic placeholders replaced with real data at runtime
🔗 Connector Templates One-click pre-fill for Slack, Discord, n8n, Make.com
📝 Custom Headers Add API keys, auth tokens, or any custom HTTP headers
🚀 Test Webhook One-click test with sample data — instant feedback
📊 Delivery Log Full history with status, response codes, duration, and details
🔄 Retry Failed One-click retry for failed deliveries
🛒 WooCommerce Order placed, status changed, low stock (auto-detected)
🎯 Custom Hooks Enter ANY WordPress action hook name as a trigger

Trigger Events

Category Events
Posts Published, Updated, Trashed
Users Registered, Login, Failed Login
Comments New Comment Posted
WooCommerce Order Placed, Order Status Changed, Product Low Stock
Custom Any WordPress action hook

Connector Templates

Platform What Gets Pre-filled
💬 Slack Slack Block Kit payload with sections and context
🎮 Discord Discord embed with title, description, color, footer
n8n Clean structured JSON for n8n webhook triggers
🔧 Make.com Make.com compatible webhook payload
📝 Custom Blank template for any API

File Structure

wp-webhook-connector/
├── wp-webhook-connector.php          # Main plugin bootstrap
├── includes/
│   ├── class-database.php            # Custom tables (rules + logs)
│   ├── class-merge-tags.php          # 30+ dynamic placeholders
│   ├── class-admin-page.php          # Rules list + stat cards
│   ├── class-rule-editor.php         # Add/edit form + connector templates
│   ├── class-dispatcher.php          # Event hooks + HTTP dispatch
│   ├── class-delivery-log.php        # WP_List_Table log viewer
│   └── class-ajax-handler.php        # Test, toggle, retry via AJAX
├── assets/
│   ├── css/admin.css                 # Admin styles
│   └── js/admin.js                   # UI interactions
├── .gitignore
└── README.md

Installation

cd wp-content/plugins/
git clone https://github.com/sharanvijaydev/wp-webhook-connector.git
  1. Activate in Plugins → Installed Plugins
  2. Navigate to Webhooks in the admin sidebar
  3. Click Add New Rule to create your first webhook

Usage Example: Notify Slack on New Post

  1. Add New Rule → Name: "Notify Slack on new post"
  2. Quick Setup → Select "Slack" (pre-fills payload)
  3. Trigger → Post Published
  4. URL → Paste your Slack incoming webhook URL
  5. Save → Click "Send Test Webhook" to verify
  6. Done! Every new post now notifies your Slack channel.

Roadmap

Version Feature
v1.1 Conditional logic (only if category = "News")
v1.2 Response parsing and follow-up actions
v1.3 Incoming webhooks (receive data INTO WordPress)
v2.0 Visual workflow builder

Technical Highlights

  • Two custom database tables — rules and delivery logs, created via dbDelta()
  • Dynamic hook registration — reads active rules and registers WordPress hooks at runtime
  • Context-aware dispatch — collects relevant data based on which event triggered
  • WooCommerce conditional loading — WC hooks only register if WooCommerce is active
  • Merge tag engine — string replacement with automatic cleanup of unreplaced tags
  • AJAX-powered UI — test, toggle, retry without page reloads
  • Detail modal — inspect request/response payloads with JSON pretty-printing
  • Security — nonce verification, capability checks, prepared SQL statements
  • Zero dependencies — pure PHP + vanilla JS, no build tools

Security

  • All admin pages require manage_options capability
  • AJAX requests verified with check_ajax_referer()
  • All database queries use $wpdb->prepare()
  • Form submissions protected with wp_nonce_field() / wp_verify_nonce()
  • Input sanitized with sanitize_text_field(), sanitize_key(), esc_url_raw()
  • Output escaped with esc_html(), esc_attr(), esc_url()

Author

R Saravanan

License

GPL-2.0+ — See LICENSE

About

Connect WordPress events to external services via outgoing webhooks. Supports Slack, Discord, n8n, Make.com, and any custom API. Features 12 trigger events, merge tags, connector templates, delivery logging, test & retry, and WooCommerce support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors