1. Home
  2. Docs
  3. Getting Started
  4. SMS API
  5. Send Single SMS

Send Single SMS

Welcome to this section which will help you in setting up an integration for sending an SMS to a single recipient (contact)

 

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
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 receive 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';
$msg = 'Sending SMS has never been this fun!';
$sender_id = 'XXXXXXXXXXX' // 11 Characters maximum
$date_time = '2018-11-29 08:49:33';

// encode the message
$msg = urlencode($msg);

// prepare your url
$url = 'https://apps.eazismspro.com/smsapi?key=' . $key . '&to=' . $username . '&msg=' . $msg . '&sender_id=' . $sender_id . '&date_time=' . $date_time;
$response = file_get_contents($url);

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";
        String sender_id = "XXXXXXXXXXX" // 11 characters maximum
        String date_time = "2018-11-29 08:49:33";

        // 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 = '02xxxxxx' #SMS recepient's phone number
message = 'Sending SMS has never been this fun!'
sender_id = 'xxxxxxxxxxxx' #11 Characters maximum
date_time = "2017-05-02 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

How can we help?