Developer API

Share this Page?


TIP: Always keep your API login information safe. Kindly test the API properly before integration to your project.

Dear Valued Customer,

Our API is php based, easy to integrate and use.

CHECK ACCOUNT BALANCE
Checking your account balance is as follows:
https://www.greenspek.net/balance.php?email= your_email& password= your_password

Where:
your_email is your account email address
your_password is your account password

SENDING A MESSAGE
Sending a message is as follow:
https://www.greenspek.net/sendsms.php? email= your_email& password= your_password& sender=sender_id&recipient= recipients_phone_numbers& message= Demo Message from API

Where:
your_email is your account email address
your_password is your account password
sender_id is the sender id of your message
recipients_phone_numbers are the phone numbers you are sending your message to. The numbers are seperated by commas (,).
Eg: 08169615492,0803333333,0816666666
message is your the body of your message

SCHEDULING A MESSAGE
Scheduling a message allows you set the date and time you want the message sent automatically in future even if you are OFFLINE or SLEEPING.
It has the same features as SENDING A MESSAGE above except with the schedule parameter. The schedule parameter allows you set the date and time.
https://www.greenspek.net/sendsms.php? email= your_email& password= your_password& sender=sender_id& recipient= recipients_phone_numbers& message= An API Demo Message& schedule=12/03/2018 @ 11:30 pm

Where:
your_email is your account email address
your_password is your account password
sender_id is the sender id of your message
recipients_phone_numbers are the phone numbers you are sending your message to. The numbers are seperated by commas (,).
Eg: 08169615492,0803333333,0816666666
message is your the body of your message
schedule is the date and time you are scheduling your message for.
Kindly note the date and time format Day/Month/Year @ Hour/Minute (am or pm)

CONFIGURATION
It is adviced NOT compulsory you use the POST method when submitting instead of GET, especially when sending messages to many numbers. The reason is GET method is limited to a certain lenght of characters which if exceeded will give a (HTTP Error 400 - Bad Request - Request Too Long). POST method does not give this error.

Sample Code


$c = curl_init("https://www.greenspek.net/balance.php? email=$email&password=$password");
curl_setopt($c, CURLOPT_CONNECTTIMEOUT,60);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt ($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);

$daresponse = curl_exec($c);
curl_close($c);
echo $daresponse;


RESULTS / RESPONSES
https://www.greenspek.net/sendsms.php? email= your_email& password= your_password& sender=Greenspek&recipient= 08169615492,0803333333,0816666666 &message= Demo Message from API

+ When you succeed in sending a message like that above, you should see a RESPONSE like OK 5
Where OK means the message was successfully sent and 5 is the number of SMS Units you were charged.

+ When you succeed in scheduling a message, you should see a RESPONSE like OK - (5) - 12/03/2018 @ 11:30 pm
Meaning the message has been scheduled for 12/03/2018 @ 11:30 pm and will cost an estimated (5) SMS Units to send.
Kindly ensure you have more than the estimate SMS Units before the scheduled date.

ERROR CODES
G101 = One or more required fields are empty
G102 = Sender ID not allowed
G103 = SMS Sending Failed
G104 = Invalid email/password combination
G105 = Account Balance exhausted
G106 = Insufficent Account Balance for this Message
G107 = Gateway unavailable
G108 = Invalid Schedule date or time format
G109 = Scheduled date has passed
G110 = Email Address is empty
G111 = Password is empty
G112 = Recipient is empty
G113 = Message is empty
G114 = Sender is empty

+ Remember to UrlEncode your Messages
+ Please note that once set, scheduled messages CANNOT be modified via the API.
+ You have to log into your account to modify it.
+ All API interactions like sent messages, unsent messages or drafts and scheduled messages are saved to your account by default.
+ Some of the API URLs and Samples above may have spaces in them. Kindly remove the spaces before using it.
+ If you have issues with this API integration, kindly Contact Us


TIP: Always keep your API login information safe. Kindly test the API properly before integration to your project.