SMS API

It is very easy to start messaging with our smart API. There are no messy libraries or tonnes of code to manage. Proovl SMS API is the set of simple requests to build a communication between your solution and Proovl SMS services. Just a couple of code rows from examples below allows you to reach all the benefits of Proovl SMS.

Send SMS

Allows you to send messages through our high-throughput routes worldwide.

StringDescription
userthe user ID
tokenthe authentication token
routethe route
1 = Standard; 2 = Economy
fromthe phone number under your account
tothe receiver's phone number
textthe body of the message
idthe ID of the message in our network
statusthe current status of the message
PHP script example:
<?php

// Request sending

$url = "https://www.proovl.com/api/send.php";

$postfields = array(
'user' => "$user",
'token' => "$token",
'route' => "$route",
'from' => "$from",
'to' => "$to",
'text' => "$text"
);

if (!$curld = curl_init()) {
exit;
}

curl_setopt($curld, CURLOPT_POST, true);
curl_setopt($curld, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($curld, CURLOPT_URL,$url);
curl_setopt($curld, CURLOPT_RETURNTRANSFER, true);

$output = curl_exec($curld);

curl_close ($curld);



// Handle the response

$result = explode(';',$output);

if ($result[0] == "Error") {
echo "Error message: $result[1]";
die;
} else {
echo "Message ID: $result[1]; Status: $result[0]";
}

?>
Python script example:
import urllib
import urllib.parse
import urllib.request
import ssl
url = "https://www.proovl.com/api/send.php?"
hdr = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' }
params = {
'user': "user",
'token': "token",
'from': "from",
'to': "to",
'text': "text"}
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
query_string = urllib.parse.urlencode(params)
http_req = url + query_string
req = urllib.request.Request(http_req, headers=hdr)
f = urllib.request.urlopen(req)
freq = (f.read().decode('utf-8'))
x = freq.split(";")
g = x[1].replace("\"","")
y = x[0].replace("\"","")
if x[0] == "Error":
print("Error message: ",x[1])
else:
print("Message ID: ",x[1])
f.close()
Java script example:
import java.net.*;
import java.io.*;
import java.io.IOException;

class sendsms {
public static void main(String[] args) {
try {

String charset = "UTF-8";
String query = String.format("https://www.proovl.com/api/send.php?user=%s&token=%s&from=%s&text=%s&to=%s",
URLEncoder.encode("user", charset),
URLEncoder.encode("token", charset),
URLEncoder.encode("from", charset),
URLEncoder.encode("text", charset),
URLEncoder.encode("to", charset));
URL url = new URL(query);
HttpURLConnection dd = (HttpURLConnection)url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(dd.getInputStream()));
String output = reader.readLine();
String[] parts = output.split(";");
if (parts[0].equals("Error"))
{
System.out.println("Error message: " + parts[1]);
}
else {
System.out.println("Message ID: " + parts[1]);
}
dd.disconnect();
}
catch(Exception e){
System.out.println(e);
}
}
}

Receive SMS

You can associate your SMS Number with an URL, an E-mail address or a Phone number.

When someone sends a text message to your SMS Number, we make an HTTP request to your URL with following strings:

StringDescription
tokenthe authentication token
idthe ID of the message in our network
fromthe sender's phone number
tothe receiver's phone number
textthe body of the message

In case you have associated your SMS Number with an E-mail address, we will forward all incoming texts to your E-mail with the phone numbers of sender and receiver.

Once you've selected to forward messages to another cell number, our system will forward the SMS with a sender's phone number preceding the contents of the message.

PHP script example:
<?php

$id = $_REQUEST['id'];
$token = $_REQUEST['token'];
$from = $_REQUEST['from'];
$to = $_REQUEST['to'];
$text = $_REQUEST['text'];

if ($token == "[your_token]") {
echo "Thank you $from for sending $text";
} else {
echo "Incorrect token";
die;
}

?>

Check SMS status and price

Allows you to request current status and the price of SMS in system.

StringDescription
idthe ID of the message in our network
phonethe phone number under your account
statusthe current status of the message
pricethe price of message
PHP script example:
<?php

$id = $_REQUEST['id'];
$phone = $_REQUEST['phone'];

// Request sending

$url = "https://www.proovl.com/api/check.php";

$postfields = array(
'id' => "$id",
'phone' => "$phone"
);

if (!$curld = curl_init()) {
exit;
}

curl_setopt($curld, CURLOPT_POST, true);
curl_setopt($curld, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($curld, CURLOPT_URL,$url);
curl_setopt($curld, CURLOPT_RETURNTRANSFER, true);

$output = curl_exec($curld);

curl_close ($curld);



// Handle the response

$result = explode(';',$output);

if ($result[0] == "Error") {
echo "Error message: $result[1]";
die;
} else {
echo "Message ID: $result[0]; Status: $result[1]; Price: $result[2]";
}

?>

Delivery reports

We will send a request to your script URL with new status for each sent SMS, every time when it will be updated.

StringDescription
idthe ID of the message in our network
tokenthe authentication token
statusthe current status of the message
(Sent; Delivered; Failed; Undelivered)
PHP script example:
<?php

$id = $_REQUEST['id'];
$token = $_REQUEST['token'];
$status = $_REQUEST['status'];

echo "Message ID: $id is: $status";
?>

Current balance

Allows you to request current balance.

StringDescription
userthe user ID
tokenthe authentication token
PHP script example:
<?php

$user = $_REQUEST['user'];
$token = $_REQUEST['token'];

$balance = file_get_contents("https://www.proovl.com/api/balance.php?user=$user&token=$token");

echo "Your account balance: $balance";

?>