| name | create-vip-workflow-notification-channel |
| description | Scaffold a VIP Workflow notification channel plugin. Use when the user wants to add a custom notification destination like Slack, Teams, Discord, SMS, or any webhook-based service to VIP Workflow. |
Create a VIP Workflow Notification Channel
Notification channels deliver workflow event notifications (status changes, SLA breaches, publishing alerts) to external services. Each channel is a standalone WordPress plugin that extends the NotificationChannel base class.
Requirements
Before starting, gather from the user:
- Destination service -- e.g., Slack, Discord, Teams, Twilio SMS, PagerDuty
- Plugin slug -- e.g.,
workflow-channel-slack
- What credentials are needed? -- webhook URL, API token, phone number, etc.
- Does it support a test/ping? -- most webhook services do
Plugin Structure
workflow-channel-{name}/
workflow-channel-{name}.php # Main plugin file (hooks + asset loading)
includes/
class-{name}-channel.php # Channel class extending NotificationChannel
The plugin directory lives alongside vip-workflow/ in the same parent directory.
Boilerplate
Main plugin file: workflow-channel-{name}/workflow-channel-{name}.php
<?php
declare( strict_types=1 );
namespace WorkflowChannel{PascalName};
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'WORKFLOW_CHANNEL_{UPPER_NAME}_DIR', plugin_dir_path( __FILE__ ) );
add_action( 'vip_workflow_register_notification_channels', function( $dispatcher ) {
require_once WORKFLOW_CHANNEL_{UPPER_NAME}_DIR . 'includes/class-{name}-channel.php';
$dispatcher->register_channel( new {PascalName}Channel() );
} );
Channel class: workflow-channel-{name}/includes/class-{name}-channel.php
<?php
declare( strict_types=1 );
namespace WorkflowChannel{PascalName};
use VIPWorkflow\Notifications\NotificationChannel;
use VIPWorkflow\Notifications\Notification;
use WP_Error;
class {PascalName}Channel extends NotificationChannel {
public function get_id(): string {
return '{name}';
}
public function get_name(): string {
return __( '{Display Name}', 'workflow-channel-{name}' );
}
public function get_description(): string {
return __( 'Send notifications to {service}.', 'workflow-channel-{name}' );
}
public function get_icon(): string {
return 'search';
}
{
= ->();
! ( [] );
}
{
(
=> (
=> ,
=> ( , ),
=> ( , ),
=> ,
),
);
}
{
= ->();
= [] ?? ;
( ( ) ) {
;
}
= (
=> (
,
->(),
->()
),
);
= ( , (
=> ( => ),
=> ( ),
=> ,
) );
( ( ) ) {
;
}
= ( );
>= && < ;
}
{
= ->();
= [] ?? ;
( ( ) ) {
( , ( , ) );
}
= (
=> ,
);
= ( , (
=> ( => ),
=> ( ),
=> ,
) );
( ( ) ) {
;
}
= ( );
( < || >= ) {
(
,
( ( , ), )
);
}
;
}
{
(
=> ( [] ?? ),
);
}
}
Abstract Methods Reference
The NotificationChannel base class requires these abstract methods:
| Method | Returns | Purpose |
|---|
get_id() | string | Unique channel ID (used for storage and API) |
get_name() | string | Human-readable display name |
get_description() | string | Short description |
get_icon() | string | Icon slug from the set in src/admin/components/ideation/assistant-icon.js |
is_configured() | bool | Whether the channel is ready to send |
send( Notification $notification ) | bool | Deliver a notification |
test_connection() | true|WP_Error | Verify the connection works |
sanitize_settings( array $input ) | array | Sanitize form input |
Settings are declared, not drawn. Override get_settings_schema() to return an array of field definitions; the base class puts it on the channel's REST payload via to_array(), and the React admin renders the form from it. There is no PHP-rendered settings form — a channel never emits settings markup of its own.
Built-in Base Class Helpers
These are provided by NotificationChannel and should not be overridden:
$this->get_settings() -- reads stored settings from wp_options
$this->update_settings( $settings ) -- writes settings
Registration
Channels register via the vip_workflow_register_notification_channels action, which receives a $dispatcher object. Call $dispatcher->register_channel( new YourChannel() ).
Testing
- Place the plugin directory alongside
vip-workflow/
- Activate it in WordPress admin
- Go to Integrations > Notification Channels to see the channel
- Configure the webhook URL and use "Test Connection" to verify
- Route an event to the channel on the
Routing tab, then trigger a workflow transition to test delivery