-
Notifications
You must be signed in to change notification settings - Fork 0
SDK Bridge
The optional SDK module lets WordPress offload work to bext's managed-execution SDK. Both features are off by default and fail open — if bext can't take the work, WordPress's normal path runs and nothing is lost.
Enable under Bext → Settings → SDK bridge, or with constants:
define( 'BEXT_WP_SDK_EMAIL', true );
define( 'BEXT_WP_SDK_JOBS', true );When enabled, the plugin hooks pre_wp_mail and sends through
POST /__bext/sdk/email/send (with X-Bext-App-Id). It maps the standard wp_mail arguments —
to / cc / bcc, subject, HTML-vs-text (from the Content-Type header), reply_to, from,
and file attachments (base64-encoded).
- On a confirmed bext success (
HTTP 200+{"ok":true}) it short-circuitswp_mail. - Otherwise it returns control to WordPress (native
wp_mailruns) and firesbext/sdk_email_fallbackso you can log why:
add_action( 'bext/sdk_email_fallback', function ( $res, $atts ) {
error_log( 'bext email fallback: ' . wp_json_encode( $res ) );
}, 10, 2 );bext's
email/sendneeds a per-app SMTP config (POST /__bext/sdk/email/config/set). Until that's set it returns{"ok":false}and the plugin falls back to WordPress — by design.
Push work onto a bext queue (POST /__bext/sdk/queue/push):
// Fire-and-forget (action form):
do_action( 'bext/enqueue', 'thumbnails', array( 'attachment' => 42 ) );
// …or get the job id back (filter form):
$id = apply_filters( 'bext/enqueue_job', null, 'emails', array( 'to' => 'a@b.co' ), 30 /* delay s */ );A bext-side worker consumes the queue. If jobs are disabled or bext is unreachable, enqueue
returns null and the action is a no-op.
SDK calls carry X-Bext-App-Id, which scopes the bext-side queue/email config. It defaults to the
site host; override via the App ID setting or BEXT_WP_APP_ID.
In Cloud mode, SDK calls also send the bearer token, but the remote endpoint must authorize the SDK surface (purge is the natively token-gated endpoint). If it doesn't, the bridge fails open to WordPress's normal path.
bext-wp · GPL-2.0-or-later · Sponsored by webdesign29 & Inklura · bext.dev
Getting started
Features
Reference
Operations