BookingPress Custom SMS Gateway
A lightweight WordPress plugin that add a custom SMS providers to the BookingPress SMS plugin.
by Awaxis · github.com/awaxis/bookingpress-custom-sms-gateway · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/awaxis/bookingpress-custom-sms-gateway/archive/refs/heads/main.zipA lightweight WordPress plugin that adds support for a custom SMS providers not yet supported by the BookingPress SMS plugin.
Description
This plugin intercepts HTTP requests from BookingPress SMS plugin when configured to use Exotel as the SMS gateway, and redirects those requests to your custom SMS provider's API endpoint. This approach ensures:
- No modifications to the BookingPress SMS plugin (safe for updates)
- Full compatibility with Exotel API format
- Easy configuration through WordPress admin panel
- Debug logging for troubleshooting
Requirements
- WordPress 5.0 or higher
- PHP 7.2 or higher
- BookingPress Appointment Booking plugin
- BookingPress SMS plugin
- A custom SMS provider with Exotel-compatible API
Installation
- Upload the
bookingpress-custom-sms-gatewayfolder to/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Go to Settings → Custom SMS Gateway
- Enter your custom SMS provider subdomain (e.g.,
api.yourprovider.com) - Save settings
Configuration
Step 1: Configure This Plugin
- Navigate to Settings → Custom SMS Gateway in WordPress admin
- Enter your custom SMS provider subdomain in the format:
api.yourprovider.com(without https://) - Optionally enable debug logging for troubleshooting
- Click "Save Settings"
Step 2: Configure BookingPress SMS
- Navigate to BookingPress → Settings → Notifications → SMS Settings
- Select "Exotel" as your SMS Gateway
- Fill in the Exotel configuration fields with your custom provider's credentials:
- API Key: Your custom provider's API key
- API Token: Your custom provider's API token
- Sub Domain: This can be anything (it will be overridden by this plugin)
- Account SID: Your custom provider's Account SID
- Sender ID: Your custom provider's Sender ID
- Save the BookingPress settings
Step 3: Test
Send a test SMS from BookingPress to verify the integration works correctly.
How It Works
The plugin uses WordPress's pre_http_request filter to intercept outgoing HTTP requests. When it detects a request to an Exotel endpoint (matching the pattern /v1/Accounts/*/Sms/send), it:
- Extracts the API credentials and parameters from the original Exotel request
- Builds a new URL pointing to your custom SMS provider without credentials in the URL
- Moves API credentials to HTTP headers for enhanced security
- Forwards the request with all original parameters
- Returns the response back to BookingPress
Security Enhancement
For better security, API credentials are sent via HTTP headers instead of being embedded in the URL:
Request URL (No credentials exposed):
https://YOUR_SUBDOMAIN/v1/Accounts/ACCOUNT_SID/Sms/send
HTTP Headers (Credentials sent securely):
X-API-Key: YOUR_API_KEY
X-API-Token: YOUR_API_TOKEN
Authorization: Basic BASE64(API_KEY:API_TOKEN)
POST body:
{
"from": "SENDER_ID",
"To": "RECIPIENT_NUMBER",
"Body": "MESSAGE_TEXT",
"EncodingType": "unicode"
}
The plugin sends credentials in three header formats to maximize compatibility:
X-API-KeyandX-API-Token- Custom headersAuthorization: Basic- Standard HTTP Basic Authentication
Features
- Transparent redirection: BookingPress SMS plugin works normally without any modifications
- Update-safe: Since BookingPress SMS plugin is not modified, it can be updated safely
- Secure: Uses WordPress settings API with proper sanitization and validation
- Debug logging: Optional logging to WordPress error log for troubleshooting
- Status dashboard: Shows configuration status and plugin health
Debug Logging
Enable debug logging from Settings → Custom SMS Gateway to log:
- Original Exotel request URL
- Redirected custom provider URL
- Request body/parameters
- Response from custom SMS provider
- HTTP status codes
Logs are written to WordPress debug.log file (if WP_DEBUG_LOG is enabled in wp-config.php).
Troubleshooting
SMS not being sent
-
Check plugin status: Go to Settings → Custom SMS Gateway and verify:
- Custom endpoint is configured
- BookingPress SMS plugin is detected as active
-
Enable debug logging:
- Enable "Enable Debug Logging" in plugin settings
- Send a test SMS
- Check
wp-content/debug.logfor errors
-
Verify BookingPress configuration:
- Ensure "Exotel" is selected as the SMS gateway
- Verify all credentials are correctly entered
-
Check WordPress debug log:
tail -f wp-content/debug.log
Custom provider returns errors
- Verify your custom provider's API endpoint format matches Exotel's format
- Check that your API credentials are correct
- Review the debug logs for specific error messages from your provider
API Compatibility
Your custom SMS provider must be compatible with Exotel's API format:
- Authentication: API Key and Token sent via HTTP headers (either custom headers
X-API-Key/X-API-Tokenor standardAuthorization: Basic) - Endpoint:
/v1/Accounts/{AccountSID}/Sms/send - Method: POST
- Parameters:
from,To,Body,EncodingType
Expected Headers from This Plugin
Your SMS provider API should accept credentials via one of these methods:
-
Custom Headers:
X-API-Key: {your_api_key}X-API-Token: {your_api_token}
-
Standard Basic Authentication:
Authorization: Basic {base64_encoded_key_token}
The plugin sends both formats for maximum compatibility.
Security
The plugin follows WordPress security best practices:
- Enhanced API Security: Credentials are sent via HTTP headers instead of URLs, preventing credential exposure in server logs, browser history, or referrer headers
- Multiple Authentication Methods: Supports both custom headers (
X-API-Key/X-API-Token) and standard Basic Authentication for flexibility - Credential Masking in Logs: Debug logs mask API credentials to prevent exposure
- Capability checks (
manage_optionsfor all admin functions) - Input sanitization using WordPress sanitization functions
- Output escaping using
esc_html(),esc_attr(), etc. - Nonce verification through WordPress Settings API
- No sensitive data stored except configuration settings
Support
For issues or questions, please contact your system administrator.
Changelog
2.0.1 (2025-11-03)
- Fixed: Added message sanitization to Hetzner gateway to remove unsupported Unicode characters
- Improved: Consistent message handling across all gateway implementations
2.0.0 (2025-01-30)
- Added: Multi-provider gateway support (Hetzner and AWS)
- Added: Comprehensive SMS logging and analytics
- Added: Dashboard with statistics and charts
- Added: SMS test functionality with history
- Added: Country detection and calling code handling
- Added: Encrypted password storage
- Added: Message sanitization utility
- Improved: Admin interface with tabbed navigation
- Improved: Error handling and debug logging
1.0.0 (2025-01-20)
- Initial release
- HTTP request interception for Exotel endpoints
- Admin settings page
- Debug logging functionality
- Status dashboard
License
GPL v2 or later
Credits
Developed by Awaxis