Push promote-grace expiry events into a CRM or analytics pipeline
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.
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 );