Skip to main content

Read or save an episode’s Sponsor confirmation notes, and run code when they are saved

Premium Intermediate Podcast Workflow

The Workbench’s Sponsor confirmation tile (id sponsor-confirmation, Pre-production, priority 40, after Guest preparation; off by default) is a Sponsor notes field and a Sponsors confirmed box. This is the tile’s only form, whether or not Sponsor Manager is on for the show: the tile does not read Sponsor Manager’s sponsors.

  • Reading: GET …/workbench (see Read the Podcast Workflow Workbench over REST) carries workflow.sponsor_confirmation: { confirmed, notes }.
  • Saving: PUT /benecaster-podcast-workflow/v1/shows/{show_id}/episodes/{episode_id}/sponsor-confirmation with { confirmed: bool, notes: string }, both every time. Notes are plain text, 10,000 characters at most (400 benecaster_podcast_workflow_guest_notes_too_long), a missing or mistyped field is 400 benecaster_podcast_workflow_invalid_field, and the Workbench’s per-show checks apply. It answers the refreshed canvas and writes no episode note.
  • The tile’s state: Done once confirmed (Sponsors confirmed); In progress once notes are saved (Notes written); else Not started (No sponsor notes yet).
  • benecaster_podcast_workflow_before_save_sponsor_confirmation and benecaster_podcast_workflow_after_save_sponsor_confirmation are actions, ( int $episode_id, bool $confirmed, string $notes, int $show_id ), around every save, with the notes as stored.

Code

<?php
add_action( 'benecaster_podcast_workflow_after_save_sponsor_confirmation', function ( int $episode_id, bool $confirmed, string $notes, int $show_id ): void {
    if ( $confirmed ) {
        my_plugin_book_ad_slots( $episode_id, $notes );
    }
}, 10, 4 );

View on GitHub →

Hooks Used

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