Developers · API v1.0
A small API that keeps its promises.
Everything on this page is the supported surface. The minor version rises when something is added; the major version only on a breaking change. Anything not listed here is internal.
function my_plugin_send_sms( $number, $text ) {
$delegate = function_exists( 'vulomail_send_sms' )
&& version_compare( vulomail_api_version(), '1.0', '>=' )
&& vulomail_is_sms_ready()
&& get_option( 'my_plugin_use_vulomail' ); // your own opt-in
if ( $delegate ) {
$sent = vulomail_send_sms( $number, $text, array( 'source' => 'my-plugin' ) );
if ( true === $sent ) {
return true;
}
}
return my_plugin_own_gateway()->send( $number, $text );
}
Make it opt-in, send once, and only fall back to your own gateway after VuloMail returns a WP_Error. Check readiness at send time, not at load.
$result = vulomail_send_email( array(
'to' => $customer_email,
'subject' => 'Your booking is confirmed',
'message' => $html,
'headers' => array( 'Content-Type: text/html; charset=UTF-8' ),
'source' => 'my-plugin',
) );
if ( is_wp_error( $result ) ) {
error_log( $result->get_error_message() );
}
Plain wp_mail() is already routed through VuloMail. Use this only for your plugin's name in the log and the real error back.
use VuloMail\Delivery\Result;
use VuloMail\Sms\GatewayInterface;
class My_Gateway implements GatewayInterface {
private $config;
private $http;
public function __construct( array $config, $http ) {
$this->config = $config; // secrets already decrypted
$this->http = $http; // VuloMail\Security\HttpClient
}
public static function definition() {
return array(
'label' => 'My Gateway',
'fields' => array(
array( 'key' => 'api_key', 'label' => 'API key', 'type' => 'password', 'secret' => true, 'required' => true ),
),
);
}
public function send( $to, $body ) {
$response = $this->http->post( 'https://api.example.com/sms',
array( 'Authorization' => 'Bearer ' . $this->config['api_key'] ),
array( 'to' => $to, 'text' => $body ) );
if ( is_wp_error( $response ) || 200 !== $response['code'] ) {
return Result::fail( 'my_gateway_error', 'Could not send.' );
}
return Result::ok( $response['json']['id'] ?? '' );
}
}
add_filter( 'vulomail_sms_providers', function ( $providers ) {
$providers['my_gateway'] = My_Gateway::class;
return $providers;
} );
Adapters must never throw and never put a credential in an error. HttpClient::post() only allows HTTPS and never follows redirects. The connection form is generated from definition(): no JavaScript needed.
add_filter( 'vulomail_sms_triggers', function ( $triggers ) {
$triggers['my_form_submitted'] = array(
'label' => 'Form submitted',
'desc' => 'Text the site admin when the contact form is submitted.',
'recipient' => 'admin',
'template' => 'New enquiry from {name} on {site_name}.',
'placeholders' => array( 'site_name', 'name' ),
'available' => true,
'requires' => '',
);
return $triggers;
} );
// When it happens:
VuloMail()->sms_triggers->fire( 'my_form_submitted', '', array( 'name' => $name ) );
Set requires to 'woocommerce' (and available accordingly) to have the admin lock your alert when WooCommerce is missing.
add_filter( 'vulomail_diagnostics', function ( $checks ) {
$checks[] = array(
'id' => 'my_plugin',
'label' => 'My Plugin',
'status' => vulomail_is_sms_ready() ? 'good' : 'warning',
'message' => vulomail_is_sms_ready()
? 'My Plugin sends its text messages through VuloMail.'
: 'VuloMail has no SMS connection, so My Plugin uses its own gateway.',
);
return $checks;
} );
VuloMail ships no checks for other plugins. Add your own row so site owners can see whether your plugin delivers through VuloMail, and why not.
Functions
Five functions. Guard every call.
Wait for vulomail_loaded and wrap calls in function_exists() so your plugin keeps working without VuloMail.
Function
Returns
Notes
vulomail_api_version()
string
e.g. “1.0”
vulomail_is_email_ready()
bool
A usable email connection exists and routing is on.
vulomail_is_sms_ready()
bool
A usable SMS connection exists and SMS is on.
vulomail_send_email( array $args )
true|WP_Error
to, subject, message required; headers, attachments, source optional.
vulomail_send_sms( $to, $message, $args )
true|WP_Error
source optional. HTML stripped; 1,530 characters max.
Actions
Hear about every outcome.
Action
Arguments
vulomail_loaded
VuloMail has booted
vulomail_email_sent
Message $message, Result $result
vulomail_email_failed
Every connection failed
vulomail_sms_sent
$number, $body, Result $result
vulomail_sms_failed
$number, $body, Result $result
Core’s wp_mail_succeeded and wp_mail_failed also fire for email VuloMail delivers.
Filters
Change what you need.
Filter
Purpose
vulomail_should_handle_email
Return false to leave one message to WordPress
vulomail_email_message
Change a message before it’s sent and logged
vulomail_sms_message
Change an SMS; return ” to cancel it
vulomail_email_providers
Add or replace email adapters
vulomail_sms_providers
Add or replace SMS adapters
vulomail_sms_triggers
Add SMS alert definitions
vulomail_log_data
Change a log row, or return false to skip it
vulomail_diagnostics
Add rows to Tools → Diagnostics
vulomail_http_timeout · vulomail_smtp_timeout
Seconds; default 15
vulomail_rest_controllers
Add REST controllers
REST · vulomail/v1
Administrators only. Secrets never included.
Every route requires manage_options and, for cookie auth, an X-WP-Nonce header. Secret connection fields always come back masked.
GET
/overview
Dashboard data for 7, 30 or 90 days
GET · POST
/settings
Read or save settings
GET · POST
/connections
List, create or update connections (secrets masked)
DELETE
/connections/{id}
Remove; a deleted primary is replaced by the backup
GET · DELETE
/logs
Query or clear the log
GET
/logs/{id}
One entry with attempts and headers
POST
/logs/{id}/resend
Resend through current routing
POST
/tools/test-email · /tools/test-sms
Test through live routing or one connection
GET
/tools/diagnostics
Every check’s result
Make it opt-in
Installing VuloMail shouldn’t silently change how your plugin delivers. Offer a setting, off by default for existing sites.
Keep your content
Templates, recipients and the decision to send stay in your plugin. VuloMail is only the transport.
One-way dependency
Your plugin calls VuloMail. VuloMail never calls into another plugin. WooCommerce alerts are the one exception.
Ship delivery you don’t have to maintain.
Hand your email and SMS to VuloMail when it’s present, and keep your own behaviour when it isn’t.
