CusRev plugin provides action hooks for integrating review events with third-party services, such as SMS platforms, CRM systems, loyalty programs, and automation tools.


ActionEvent
cr_review_createdA new pending or approved review is created
cr_review_approvedAn existing pending review is approved
cr_review_reminder_sentA reminder email is successfully sent


Registering Your Integration

Register callbacks in your own integration plugin or must-use plugin. Do not modify CusRev plugin directly, because updates will overwrite your changes. All three actions pass two arguments: an identifier and a context array. Set the accepted argument count to 2 when registering your callback:

add_action( 'cr_review_created', 'my_integration_review_created', 10, 2 );

function my_integration_review_created( $review_id, $context ) {
    // Enqueue your integration's background job here.
}

These are notification actions. Returning a value from a callback does not change review approval or reminder sending.


1. New Review Created: cr_review_created

do_action( 'cr_review_created', $review_id, $context );

This action fires for new top-level product and shop reviews submitted through supported review flows. It includes pending and already-approved reviews. Associated plugin review metadata is saved before the action fires.

Arguments

$review_id — integer: the WordPress comment ID of the new review.

$context — array:

KeyTypeDescription
order_idIntegerAssociated WooCommerce order ID, or 0 when unavailable.
sourceStringonsite, local_form, or cusrev_form.
approvedInteger0 for pending; 1 for approved.


Example context:

array(
    'order_id' => 123,
    'source' => 'local_form',
    'approved' => 0,
)

The approved value reflects the saved review's status when the callback runs. A value of 1 normally means the review was approved at creation; it does not identify which moderation rule approved it.


2. Pending Review Approved: cr_review_approved

do_action( 'cr_review_approved', $review_id, $context );

This action fires when an existing top-level review transitions from pending to approved. It covers approval through the plugin's admin screen, WordPress moderation, and integrations using WordPress's comment-status APIs.

Arguments

$review_id — integer: the WordPress comment ID of the approved review.

$context — array: the same structure as cr_review_created, with approved set to 1:

array(
    'order_id' => 123,
    'source' => 'local_form',
    'approved' => 1,
)

The source describes the original submission source, inferred from saved review metadata—not where approval occurred. Without recognized aggregated-form order metadata, the context uses source => 'onsite' and order_id => 0.


3. Review Reminder Sent: cr_review_reminder_sent

do_action( 'cr_review_reminder_sent', $order_id, $context );

This action fires after a successful immediate email reminder request and after the plugin updates the order's reminder metadata. It covers manual and automatic email reminders using either the WordPress or CusRev mailer.

Arguments

$order_id — integer: the WooCommerce order ID associated with the reminder.

$context — array:

KeyTypeDescription
mailerStringwp for WordPress or cr for CusRev.
template_idStringEmail template identifier.
email_idStringEmail identifier, or an empty string when unavailable.
review_urlStringReview form URL, or an empty string when unavailable.


Example context for the WordPress mailer:

array(
    'mailer' => 'wp',
    'template_id' => 'review_reminder',
    'email_id' => 'email-identifier',
    'review_url' => 'form-url',
)

Integration Best Practices

  • Queue external requests: these actions run synchronously. Slow SMS or CRM API calls can delay review submission, moderation, or reminder processing
  • Prevent duplicate notifications: use review ID plus notification type for review events, or order ID plus email ID where available for reminder events. Order ID alone is not always sufficient
  • Handle failures safely: record external-service failures and retry background jobs without disrupting the plugin's normal operation


More Questions?

We hope that this tutorial was help. If you have any questions about the plugin, please don't hesitate to post them on our support forum or submit a ticket for our support team (available for customers with Pro licenses).