Alert PagerDuty When Feeds Go Dark at Day 30
benecaster_license_payment_grace_hard_cutoff fires once, on the cron tick that crosses day 30 of an unpaid grace window. Every subscriber token has just been revoked and private feeds are returning 403.
For anyone operating podcasts on behalf of clients, this is the event worth paging on: it is subscriber-visible, it was preventable, and nobody on the technical side necessarily knows the invoice went unpaid. The payload carries the token count, which is the number that makes the alert actionable — “47 subscribers lost access” lands differently from “billing issue.”
Pair this with Route license hard-cutoff recovery to Slack, which resolves the same incident when payment lands. Use a stable dedup_key across both so PagerDuty ties them together rather than leaving an orphaned incident open.
Code
<?php
add_action(
'benecaster_license_payment_grace_hard_cutoff',
function ( int $cutoff_at, int $token_count ): void {
wp_remote_post( 'https://events.pagerduty.com/v2/enqueue', [
'headers' => [ 'Content-Type' => 'application/json' ],
'timeout' => 5,
'body' => wp_json_encode( [
'routing_key' => MY_PAGERDUTY_ROUTING_KEY,
'event_action' => 'trigger',
// Stable key so the recovery handler can resolve this exact incident.
'dedup_key' => 'benecaster-grace-cutoff-' . home_url(),
'payload' => [
'summary' => sprintf(
'Benecaster feeds dark — %d subscriber%s lost access (%s)',
$token_count,
1 === $token_count ? '' : 's',
home_url()
),
'severity' => 'critical',
'source' => home_url(),
'timestamp' => gmdate( 'c', $cutoff_at ),
'custom_details' => [
'tokens_revoked' => $token_count,
'cause' => 'Benecaster license payment unresolved for 30 days',
'remedy' => 'Update payment at benecaster.com — access restores automatically',
],
],
] ),
] );
},
10,
2
);