Contents
Send Test Message - Plugixa PDF Vouchers for WooCommerce
POST /plugixa-pdf-vouchers/v1/sms/test
Send Test message from (your store): gift voucher messages are working. to a number, like Send test in the settings.
Needs a user with the plugixa_pdfv_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators and shop managers get it when the plugin is activated; see Staff access.
Note. Pro only: on the free plugin this route answers
404rest_no_route.
Request
POST https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/sms/test
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
to |
string |
Yes | The mobile, in international format. |
channel |
string |
No | sms (default) or whatsapp. |
{
"to": "+33612345678",
"channel": "sms"
}
Responses
200 OK. Twilio accepted the message.
{
"success": true,
"data": {
"sid": "SM9d1c0b2a3f4e5d6c7b8a9f0e1d2c3b4a"
}
}
| Field | Type | Meaning |
|---|---|---|
data.sid |
string |
Twilio’s message id |
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
plugixa_pdfv_forbidden |
The caller lacks the capability. |
422 |
plugixa_pdfv_twilio_off |
Text messages are not set up. |
422 |
plugixa_pdfv_twilio_to |
The mobile number is not valid. |
422 |
plugixa_pdfv_twilio_401 |
Twilio refused it. The code ends with Twilio’s HTTP status (plugixa_pdfv_twilio_400, plugixa_pdfv_twilio_401 and so on) and the message is Twilio refused the message with that status and Twilio’s answer. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/sms/test" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"to":"+33612345678","channel":"sms"}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/sms/test');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+33612345678',
'channel' => 'sms',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/sms/test', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ to: '+33612345678', channel: 'sms' }),
});
const { data } = await response.json();
Quick Links
Share