Skip to main content

Push promote-grace expiry events into a CRM or analytics pipeline

Premium Beginner

Fires when a transferred subscriber’s grace period elapses without re-authorization. By the time the action fires the subscriber’s token has already been revoked and a promote_grace_expired email has been queued — your listener runs after those side effects. Use for: marking a CRM contact as churned, recording the conversion-failure event in your analytics warehouse, triggering a customer-success outreach workflow. Does NOT fire when an admin manually clears a grace period via Promotion History — that is a successful re-authorization.

It also does not fire for a row whose expiry was vetoed through benecaster_promote_grace_expiry_should_revoke. That is what lets this recipe compose with Close the re-authorization gap yourself: the action never fires for a vetoed row, so a CRM listener does not record a churn that did not happen.

Code

<?php
add_action( 'benecaster_promote_grace_expired', function ( int $user_id, int $show_id, string $tier_slug ): void {
    $user = get_userdata( $user_id );
    if ( ! $user ) {
        return;
    }
    my_crm_client()->record_event( 'podcast_subscription_lapsed_post_migration', [
        'email'     => $user->user_email,
        'show_id'   => $show_id,
        'tier_slug' => $tier_slug,
        'channel'   => 'benecaster',
    ] );
}, 10, 3 );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →