WP Residence Help WP Residence Help

  • WpEstate
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / 13. WPResidence / WPEstate CRM / WPResidence CRM Webhooks — Developer Reference

WPResidence CRM Webhooks — Developer Reference

12 views 0

Developer documentation for the webhook subsystem of the WPResidence real estate CRM. Lives in libs/webhook-functions.php.

Two Configuration Paths

The plugin supports two configuration styles:

  1. Structured config – option wpestate_crm_webhooks, an array of {url, events, active, secret} objects. Read via wpestate_crm_get_webhook_config(), written via wpestate_crm_save_webhook_config().
  2. Simple settings – crm_webhook_url + crm_webhook_events (comma-separated). Used by the single-webhook admin UI. Read by wpestate_crm_dispatch_webhook().

Dispatcher

wpestate_crm_dispatch_webhook( $event, $data )
  1. Read the webhook URL and event list from settings.
  2. Check the event is in the subscribed list (comma-split, trimmed).
  3. Build payload: {event, timestamp (ISO 8601), data, site_url}.
  4. Compute X-CRM-Signature header if a secret exists: hash_hmac(‘sha256’, $body, $secret).
  5. POST via wp_remote_post() with 15-second timeout.
  6. On error (WP_Error or HTTP >= 400): schedule single-event cron wpestate_crm_webhook_retry_event in 5 minutes.

12 Subscribable Events

contact.created, contact.updated, contact.deleted, lead.created, lead.updated, lead.deleted, enquiry.created, deal.created, deal.stage_changed, deal.won, deal.lost, task.completed.

Hook Wiring

Hook Emits
wpestate_crm_after_insert_contact contact.created
wpestate_crm_after_update_contact contact.updated
wpestate_crm_after_insert_deal deal.created
wpestate_crm_after_update_deal deal.stage_changed, plus deal.won (stage=closed_won) or deal.lost (stage=closed_lost)
wpestate_crm_after_complete_task task.completed
wpestate_crm_after_record_activity form_submitted (only for type=form_submission)

Retry Mechanism

Retry handler: wpestate_crm_webhook_retry( $url, $payload, $attempt ), hooked at priority 10 to wpestate_crm_webhook_retry_event with 3 args. Max 3 total attempts. On each retry failure, another 5-minute-delayed cron is scheduled until the attempt count is exhausted.

Test Endpoint

Property Value
AJAX action wpestate_crm_test_webhook
Nonce wpestate_crm_test_webhook (security param)
Capability manage_options
Input webhook_url (POST, esc_url_raw)
Payload event=test, sample contact + listing data
Response HTTP code + first 200 chars of response body

Security

  • HTTPS is not enforced by the plugin. Plain HTTP URLs work. Use HTTPS in production.
  • HMAC signing is optional. Enable it by setting a secret in the structured config. The simple settings UI does not expose a secret field.
  • There is no IP allowlist. Receiving endpoints should verify the signature.

Error Handling

  • is_wp_error() checked on every wp_remote_post() call.
  • Response code checked with wp_remote_retrieve_response_code().
  • Failures are logged to the plugin’s logs/ directory (not surfaced in the admin UI).

Extending

  • Add a new event by calling wpestate_crm_dispatch_webhook(‘my.custom.event’, $data) from a hook in your child plugin.
  • Switch to multiple webhooks by using the structured wpestate_crm_webhooks option directly.
  • Build a retry queue UI by querying WP-Cron (_get_cron_array()) for pending wpestate_crm_webhook_retry_event entries.
13. WPResidence / WPEstate CRM

Related Articles

  • WPResidence CRM Security Model — Developer Reference
  • CRM Security and Data Privacy
  • WPResidence CRM Installation and Updates — Developer Reference
  • Installing and Updating the WPResidence CRM

WP Residence Documentation

  • 01. Getting Started
    • How to Get Support
    • Get your buyer license code.
    • Use SSL / https
    • Server / Theme Requirements
  • 02. Installation & Setup
  • 03. Installation FAQ
  • 06. Search & Filtering
    • Advanced Search Display Settings
    • Advanced Search Form
    • Geolocation Search for Half Map
    • Save Search Theme Options
    • Advanced Search Colors
  • 09. Agent, Agency & Developers
  • 08. Property Pages & Layouts
  • 07. Property Lists, Categories & Archive
  • 14. WPResidence Elementor Studio
  • 10. Blog Posts & Blog List
  • 11. Shortcodes
    • Contact Form
    • Featured Agency/Developer
    • Membership Packages
    • Testimonials
    • Google Map with Property Marker
    • Listings per Agent, Agency or Developer
    • Display Categories
    • Agent List
    • Recent Items Slider
    • Recent items
    • List Properties or Articles by ID
    • Featured Agent
    • Featured Article
    • Featured Property
    • Login & Register Form
    • Icon Content Box Shortcode
  • 12. Widgets
  • 04. Theme Options & Global Settings
    • General Settings
    • User Types Settings
    • Appearance
    • Logos & Favicon
    • Header
    • Footer Style and Colors
    • Price & Currency
    • Property Custom Fields
    • Features & Amenities
    • Listing Labels
    • Theme Slider
    • Permalinks
    • Splash Page
    • Social & Contact
    • Map Settings
    • Pin Management
    • How read from file works
    • General Design Settings
    • Custom Colors Settings
    • Header Design & Colors
    • Mobile Menu Colors
    • User Dashboard Colors
    • Print PDF Design
    • Property, Agent, Blog Lists Design Settings
    • Sidebar Widget Design
    • Font management
    • How to add custom CSS
    • Custom Property Card Unit – Beta version
    • Email Management
    • Import & Export theme options
    • reCaptcha settings
    • YELP API Integration
    • iHomefinder Optima Express IDX
    • MEMBERSHIP & PAYMENT Settings
    • Property Submission Page
    • PayPal Setup
    • Stripe Setup
    • Wire Transfer Payment Method
  • 20. Translations & Languages
  • 26. FAQ
  • 10. Pages
  • 11. Header
  • 12. Footer
  • 05. Maps & Location Settings
  • 18. Payments & Monetization
  • Plugins
    • 19. Included Plugins
    • 22. Third Party Plugins – IDX Compatibility
    • 21. Third-Party Plugins – Multi-Language
    • 23. Third party Plugins – Other
  • Technical
    • 24. Technical how to | Custom Code Required
    • 25. Technical: Child Theme

Join Us On

Powered by WP Estate - All Rights Reserved
  • WpEstate
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API