Contents
On this page
Save Text Message Settings - Plugixa PDF Vouchers for WooCommerce
POST /plugixa-pdf-vouchers/v1/sms/settings
Save the Twilio account. Messages are sent and billed through your own Twilio account.
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/settings
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
sid |
string |
Yes | The Account SID: AC and 32 more characters. |
token |
string |
No | The auth token. Empty keeps the stored one. |
from |
string |
No | The number to send text messages from, in international format such as +33612345678. |
whatsapp_from |
string |
No | The WhatsApp sender number, same format. |
{
"sid": "AC3f6b9c2e1d4a5b6c7d8e9f0a1b2c3d4e",
"token": "",
"from": "+33644630001",
"whatsapp_from": ""
}
Responses
200 OK. data is the saved view, as in Get Text Message Settings.
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
plugixa_pdfv_forbidden |
The caller lacks the capability. |
422 |
plugixa_pdfv_twilio_sid |
The Account SID starts with AC and has 34 characters. |
422 |
plugixa_pdfv_twilio_from |
Write phone numbers in international format, for example +33612345678. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/sms/settings" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"sid":"AC3f6b9c2e1d4a5b6c7d8e9f0a1b2c3d4e","token":"","from":"+33644630001","whatsapp_from":""}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/sms/settings');
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([
'sid' => 'AC3f6b9c2e1d4a5b6c7d8e9f0a1b2c3d4e',
'token' => '',
'from' => '+33644630001',
'whatsapp_from' => '',
]),
]);
$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/settings', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ sid: 'AC3f6b9c2e1d4a5b6c7d8e9f0a1b2c3d4e', token: '', from: '+33644630001', whatsapp_from: '' }),
});
const { data } = await response.json();
Quick Links
Share