SMS API
- NEW! - Interactive API docs, now live!
Visit api-docs.plumvoice.com to read Plum API documentation, build and test requests in our interactive API sandbox, review the responses, and share it all with your team.
Plum offers four services for its SMS REST API:
Method | Service | Description |
Please note that each of these SMS REST APIs use HTTP AUTH for authentication. The username/password to be used for authentication are the same as your standard Plum DEV login credentials.
All of the SMS REST APIs have the same return format that includes a status (success or failure), error message and the result data.
XML (success)
XML (failure)
JSON (success)
JSON (failure)
JSON (invalid phone number)
<sample>
<status>success</status>
<error/>
<result>
<!-- SAMPLE RESULT DATA -->
</result>
</sample>
<sample>
<status>failure</status>
<error>Unauthorized access to sample service</error>
</sample>
{
"status":"success",
"error":"",
"result": {
// SAMPLE RESULT DATA
}
}
{
"status":"failure",
"error":"Unauthorized access to sample service",
}
{
"status":"failure",
"error":"Invalid 'to' phone number",
}
Messages to unsubscribed numbers or landlines will fail, returning the message delivery status
undelivered
. This also triggers an immediate notification describing why the messages failed. The notification is for user information and will not appear as part of the response.
Examples:
Message sent to a phone number that previously sent a STOP request (i.e., unsubscribed):
{"status":"failure","error":""Attempt to send to unsubscribed recipient""}
Message sent to landline:
{"status":"failure","error":""To number: +1xxxxxxxxx, is not a mobile number""}
post
https://hosting.plumvoice.com
/ws/sms/{resource_type}
Queue SMS
Sample Code
queuesms.php
storesmsresults.php
CURL (command line)
<?php
header("Content-type: text/xml");
$params['to'] = "19998881234";
$params['from'] = "2435678910";
$params['body'] = "This is a notification.";
$params['result_url'] = "http://myserver.com/storesmsresults.php";
// initialize curl
$ch = curl_init();
// set necessary curl options
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, "https://hosting.plumvoice.com/ws/sms/queue.xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "username:password");
echo(curl_exec($ch));
curl_close($ch);
?>
<?php
// make sure the log file has read/write permissions from the web server
$logfile = "logs/smsresults.log"
if (!is_readable($logfile) || !is_writable($logfile)) {
die("Unable to write to log file.");
}