Send a Slack notification when an SSP or PowerPress import finishes and new drafts were created
Both hooks have identical signature ( int $show_id, int $imported, int $skipped ) so a single callback can handle both importers. Wire it to both action hooks using the same priority and argument count.
Code
<?php
function my_import_done_notify( int $show_id, int $imported, int $skipped ): void {
if ( 0 === $imported ) {
return;
}
my_slack()->send( sprintf(
'Import complete for show #%d: %d new drafts, %d skipped.',
$show_id, $imported, $skipped
) );
}
add_action( 'benecaster_ssp_import_after', 'my_import_done_notify', 10, 3 );
add_action( 'benecaster_powerpress_import_after', 'my_import_done_notify', 10, 3 );