Sending SMS Using JSON

Overview

This method provides a way to send the message (SMS) via JSON using account details.

Send SMS through your application by making an HTTP POST request to the following endpoints:

LIVE URL: https://www.egosms.co/api/v1/json/

SANDBOX URL: http://sandbox.egosms.co/api/v1/json/

JSON Request Parameters

These are the standard request parameters that are needed when using the EgoSms JSON API

username String Required

The API callers username used to login to Egosms.

password String Required

The URL encoded password to your Ego Sms Account

number String Required

The phone number the message is being sent to.

message String Required

This represents the URL encoded SMS you are sending out. The message source must have a maximum of 160 characters.

sender String Required

This represents who the message is coming from. Sender can have a maximum of 11 characters and needs to be URL encoded too.

PriorityString Optional

This represents level of priority. Priority can have values from (0-4) with  0: highest, 1: high, 2: Medium, 3: Low, 4: Lowest

Request format

Request for sending one message.

				
					{
   "method":"SendSms",
   "userdata":{
      "username":"xxxxxx",
      "password":"xxxxxx"
   },
   "msgdata":[
      {
         "number":"2567xxxxxxxx",
         "message":"xxxxxx",
         "senderid":"xxxxxx",
         "priority":"0"
      }
   ]
}
				
			

Request for sending multiple messages.

				
					{
   "method":"SendSms",
   "userdata":{
      "username":"xxxxxxxx",
      "password":"xxxxxxxx"
   },
   "msgdata":[
      {
         "number":"2567xxxxxxxxx",
         "message":"First Message",
         "senderid":"Egosms",
         "priority":"0"
      },
      {
         "number":"2567xxxxxxxxx",
         "message":"Second Message",
         "senderid":"Egosms",
         "priority":"0"
      },
      {
         "number":"2567xxxxxxxxx",
         "message":"Third Message",
         "senderid":"Egosms",
         "priority":"0"
      },
      {
         "number":"2567xxxxxxxxx",
         "message":"Fourth message",
         "senderid":"Egosms",
         "priority":"0"
      }
   ]
}
				
			

System Feedback

A Successful Request

Once your message has been successfully submitted to the Egosms system, it will return Json in the format shown below.

				
					{
   "Status":"OK",
   "Cost":"xxxx",
   "MsgFollowUpUniqueCode":"xxxxx"
}
				
			

A Failed Request

Once the request fails, JSON in the  format below will be returned.

				
					{
   "Status":"Failed",
   "Message":"xxxxxx"
}
				
			

Example

Submitted JSON

				
					{
   "method":"SendSms",
   "userdata":{
      "username":"Egotest",
      "password":"xxxxxxxx"
   },
   "msgdata":[
      {
         "number":"256707811113",
         "message":"Welcome to Egosms",
         "senderid":"Egosms",
         "priority":"0"
      }
   ]
}
				
			

Returned JSON for a Successful Request

				
					{
   "Status":"OK",
   "Cost":"35",
   "MsgFollowUpUniqueCode":"ApiJsonSubmit53b5155c1a3f90.65989312"
}
				
			

Returned JSON for a Failed Request

				
					{
   "Status":"Failed",
   "Message":" Error Response message"
}
				
			

Possible Errors

Error

Meaning

Wrong JSON Passed

Occurs if there is a syntax error in your json code.

Money Not Enough To Send This Batch of Msgs

Occurs if there are insufficient funds on the sender’s account.

Wrong Username or Password

Occurs if either the password or username is wrong.

That user does not exist or user not active

Occurs if the user account does not exist or is inactive.

Either Username or Password Not Set

Occurs if either the username or password is empty.

Programming Example