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

Definition

https://apps.mnotify.net/api/voice

Parameters

Sending with Audio file

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
userfile audio Yes Your recorded voice in any format
msg string No A string of message you would like to send your recipient in case their calls are not picked. This is not compulsory
sender_id string No A sender name you would want your recipient to recognize when they recieve the missed call message. It should be 11 characters without any special character. NB: This can only be used when there is missed call message

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
$url = "https://apps.mnotify.net/api/voice";
$key = "44d7a5066d1910a17515";
$to = "02XXXXXXXX";
$msg = "hello, please call me if you missed the call";
$sender_id = "XXXXXXXXXX" //11 Characters maximum;
$voice_id = ''; // without voice id

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

// get path of your current file
    $dir = dirname(__FILE__);

    // get audio file eg. assuming the audio file is located in the same directory as your php file
    $curlFile = curl_file_create($dir . '/test.mp3');

    //prepare your data
    $postData = array(
        'key' => $key,
        'to' => $to,
        'userfile' => $curlFile,
        'msg' => $msg,
        'sender_id' => $sender_id,
        'voice_id' => $voice_id
    );

    // define the header
    $header = array('Content-Type: multipart/form-data');

    // initiate CURL
    $curl = curl_init();
    curl_setopt_array($curl, array(
       CURLOPT_POST => 1,
       CURLOPT_POSTFIELDS => $postData,
       CURLOPT_HEADER => 0,
       CURLOPT_RETURNTRANSFER => 1,
       CURLOPT_BINARYTRANSFER => 1,
       CURLOPT_URL => $url,
       CURLOPT_SSL_VERIFYPEER => 0,
       CURLOPT_FOLLOWLOCATION => 1,
       CURLOPT_CONNECTTIMEOUT => 0,
       CURLOPT_TIMEOUT => 60,
       CURLOPT_HTTPHEADER => $header,
       CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311
            Firefox/2.0.0.13',
    ));
    $response = curl_exec($curl);
    $result = json_decode($response);
    curl_close ($curl);

Java

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import javax.net.ssl.HttpsURLConnection;

public class SendVoiceSMS {

	private final String USER_AGENT = "Mozilla/5.0";

	public static void main(String[] args) throws Exception {
            String url = "https://apps.mnotify.net/api/voice";
            URL obj = new URL(url);
            SendVoiceSMS connection = (SendVoiceSMS) obj.openConnection();
            
            //add request header
            connection.setRequestMethod("POST");
            connection.setRequestProperty("User-Agent", USER_AGENT);
            connection.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
            
            //define parameters
            String API_Key = "44d7a5066d1910a17515";
            String phone_number = "02XXXXXXXX";
            String message = "hello, please call me if you missed the call";
            String sender_id = "XXXXXXXXXXX"; //11 Characters maximum
            File file = new File("path to your audio file");
            
            //Combine paramaters to form a string
            String urlParameters = "key="+API_Key+"&to="+phone_number+"&userfile="+file+"&msg="+message+"&sender_id="+sender_id;
            
            //Send Post request
            connection.setDoOutput(true);
            DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
            wr.writeBytes(urlParameters);
            wr.flush();
            wr.close();
                    
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); 
            String inputLine;
            String output;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
                JSONObject myObject = new JSONObject(output);
                in.close();	    
	}
}

Python

python code here

Result Format

Result that would be obtained upon successful delivery of message.

JSON

 	[
 	  {
 	    "status": "1000",
 	    "message": "Message sent successfully",
 	    "voice_id": "20160930144020"
 	  },
 	]
 	
Parameter Type Description
status int A four digit code which specifies a particular response message
message string The interpretation of the status code
voice_id string A string of numbers that is generated on the mnotify system for that particular audio file sent earlier. This number can be stored somewhere and used later if you want to use the same voice

Sending with Voice ID

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
voice_id string Yes An alphanumeric string of a voice id in case you have a voice already in the mNotify system
msg string No A string of message you would like to send your recipient in case their calls are not picked. This is not compulsory
sender_id string No A sender name you would want your recipient to recognize when they recieve the missed call message. It should be 11 characters without any special character. NB: This can only be used when there is missed call message

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
$url = "https://apps.mnotify.net/api/voice";
$key = "44d7a5066d1910a17515";
$to = "02XXXXXXXX";
$msg = "hello, please call me if you missed the call";
$sender_id = "XXXXXXXXXX" //11 Characters maximum;
$voice_id = '20171116123815'; // with voice id

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


    //prepare your data
    $postData = array(
        'key' => $key,
        'to' => $to,
        'userfile' => '' // without audio file,
        'msg' => $msg,
        'sender_id' => $sender_id,
        'voice_id' => $voice_id
    );

    // define the header
    $header = array('Content-Type: multipart/form-data');

    // initiate CURL
    $curl = curl_init();
    curl_setopt_array($curl, array(
       CURLOPT_POST => 1,
       CURLOPT_POSTFIELDS => $postData,
       CURLOPT_HEADER => 0,
       CURLOPT_RETURNTRANSFER => 1,
       CURLOPT_BINARYTRANSFER => 1,
       CURLOPT_URL => $url,
       CURLOPT_SSL_VERIFYPEER => 0,
       CURLOPT_FOLLOWLOCATION => 1,
       CURLOPT_CONNECTTIMEOUT => 0,
       CURLOPT_TIMEOUT => 60,
       CURLOPT_HTTPHEADER => $header,
       CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311
            Firefox/2.0.0.13',
    ));
    $response = curl_exec($curl);
    $result = json_decode($response);
    curl_close ($curl);

Java

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
    
import javax.net.ssl.HttpsURLConnection;
    
    public class SendVoiceSMS {
    
    	private final String USER_AGENT = "Mozilla/5.0";
    
    	public static void main(String[] args) throws Exception {
                String url = "https://apps.mnotify.net/api/voice";
                URL obj = new URL(url);
                SendVoiceSMS connection = (SendVoiceSMS) obj.openConnection();
                
                //add request header
                connection.setRequestMethod("POST");
                connection.setRequestProperty("User-Agent", USER_AGENT);
                connection.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
                
                //define parameters
                String API_Key = "44d7a5066d1910a17515";
                String phone_number = "02XXXXXXXX";
                String message = "hello, please call me if you missed the call";
                String sender_id = "XXXXXXXXXXX"; //11 Characters maximum
                String voice_id = "20160930144020";
                
                //Combine paramaters to form a string
                String urlParameters = "key="+API_Key+"&to="+phone_number+"&voice_id="+voice_id+"&msg="+message+"&sender_id="+sender_id;
                
                //Send Post request
                connection.setDoOutput(true);
                DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
                wr.writeBytes(urlParameters);
                wr.flush();
                wr.close();
                        
                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); 
                String inputLine;
                String output;
                StringBuffer response = new StringBuffer();
                while ((inputLine = in.readLine()) != null) {
                    response.append(inputLine);
                }
                    JSONObject myObject = new JSONObject(output);
                    in.close();	    
    	}
    }

Python

python code here

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 Voice Message submitted successfully with or without voice id depending on what you chose
1002 Voice SMS sending failed. Might be due to server error or other reason
1003 Insufficient voice 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.
1008 Invalid Voice Id in case you are using voice id
1009 Use either voice file or voice id. This happens when you have both userfile and voice_id parameters not empty
1010 Voice file or Voice key cannot be empty. This comes when both userfile and voice_id are empty