The difference between this section and the previous section is the addition of multiple recipients instead of the traditional single recipient.
Definition
http://apps.eazismspro.com/smsapi
Parameters
| Argument | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | Your generated api key of alphanumeric format |
| to | string | Yes | The recipient’s telephone number. Example 0244XXXXXX or 233244XXXXXX. You need to separate the contacts with commas to make this successful |
| msg | string | Yes | A string of message you would like to send your recipient. eg. Hello Kofi |
| sender_id | string | Yes | A sender name you would want your recipient to recognize when they recieve the message. It should be 11 characters without any special character. |
| date_time | datetime | No | A date and time in Y-m-d H:i:s format. This datetime should only be added when you want to schedule the message at a later time |
Examples
The following is going to show you some examples that you can follow to set up your integration. The languages used here are PHP, Java and Python
PHP
//defining the parameters $key = '44d7a5066d1910a17515'; // Remember to put your own API Key here $to = '02XXXXXXXX, 05XXXXXXXX'; //You only need to separate the contacts with commas $msg = 'Sending SMS has never been this fun!'; $sender_id = 'XXXXXXXXXX'; //11 Characters maximum $date_time = '2018-11-29 00:00:45'; //encode the message $msg = urlencode($msg); //prepare your url $url = "http://apps.eazismspro.com/smsapi?key=$key&to=$username&msg=$message&sender_id=$sender_id&date_time=$date_time"; $response = file_get_contents($url) ; //response contains the response from Eazi SMS Pro
NB: Remember that this is a GET request
Java
import java.net.*;
import java.io.*;
public class SendMessage {
public static void main(String[] args) throws Exception {
String API_key = "44d7a5066d1910a17515"; // Remember to put your own API Key here
String message = "Sending SMS has never been this fun!";
String phone_number = "02XXXXXXXX, 05XXXXXXXX"; //You only need to separate the contacts with commas
String sender_id = "xxxxxxxxxx"; //11 characters maximum
String date_time = "2017-05-02 00:59:00";
//prepare your url
URL url = new URL("' . base_url() . 'smsapi?key=" + API_key + "&to=" + phone_number + "&msg=" + message + "&sender_id=" + sender_id + "&date_time=" + date_time);
URLConnection connection = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
inputLine = in.readLine().trim();
//input line contains the response from Eazi SMS Pro
in.close();
}
}
NB: Remember that this is a GET request
Python
#!/usr/bin/env python
import urllib2
import urllib
def send_sms(api_key,phone,message,sender_id):
#parameters to send SMS
params = {\"key\":api_key,\"to\":phone,\"msg\":message,\"sender_id\":sender_id,\"date_time\":date_time}
#prepare your url
url = '" . base_url() . "smsapi?'+ urllib.urlencode(params)
content = urllib2.urlopen(url).read()
#content contains the response from Eazi SMS Pro
#Defining variables to be used inside function
api_key = '44d7a5066d1910a17515' #Remember to put your own API Key here
phone = "02XXXXXXXX, 05XXXXXXXX"; #You only need to separate the contacts with commas
message = 'Sending SMS has never been this fun!'
sender_id = 'xxxxxxxxxxxx' #11 Characters maximum
date_time = "2018-11-29 00:59:00"
#Calling function that was created to send sms
send_sms(api_key,phone,message,sender_id)";
NB: Remember that this is a GET request
Result Format
Result that would be obtained upon successful delivery of message.
JSON
[
{
"status": "1000",
"message": "Message sent successfully",
},
]
| Parameter | Type | Description |
|---|---|---|
| status | int | A four digit code which specifies a particular response message |
| message | string | The interpretation of the status code |
Status Codes and Interpretation
| Status Code | Meaning |
|---|---|
| 1000 | Message submitted successfully |
| 1002 | SMS sending failed. Might be due to server error or other reason |
| 1003 | Insufficient SMS balance |
| 1004 | Invalid API key |
| 1005 | Invalid Recipient’s Phone Number |
| 1006 | Invalid Sender ID. Sender ID must not be more than 11 Characters. Characters include white space. |
| 1007 | Message scheduled for later delivery |
| 1008 | Empty Message |

