Sarv.com

SMS HTTP API V2.2 Documentation

http://m1.sarv.com/api/sms_campaign/create?data={"token":"20175357215dXXXXXX57","user_id":"6233XXX76","route":"TR","template_id":"2XX","sender_id":"TSTMG","language":"EN","template":"Hello user this is an transactional message to alert you.","contact_numbers":"98XXXXXX98" }

Parameters :

Key Format Description
data JSON It is a JSON variable which contains all variables required for sending request.
token String User's unique token
user_id String Unique user id
route String Message can be sent via four routes. [TR,PO,EN,OT]
template_id String Can use for in case of particular template
Sender_id
(required when route TR & PO)
String Valid sender id 
language String Language can be 'EN' or 'UC'
template String Text message you want to send (converted using base64 )
contact_numbers String Numbers should be in 10 digit (exceptional +91 allowed)
"Number1,Number2" : "9988774455,998877445566"

Response

Success Case :

{
  "msg": "success",
  "code": 200,
  "msg_text": "campaign created",
  "data": [{
    "campaign_id" : 1234,
    "number": 1234567890,
    "msg_id": "123_1_1234567890_1",
  }, {
      "campaign_id" : 1234,
      "number": 1234567890,
      "msg_id": "123_1_1234567890_2",
  }]
}


Error Case :

{
"msg": "error",
"code": "101",
"msg_text": "user id and token is not set or invalid"
}


msg code msg_text extra
ERROR 401 user id and token is not set or invalid If Owner and token not valid
ERROR 406 You are not authorize to do this action !! If user type is not valid
ERROR 203 Route doesn't exist
ERROR 204 Please choose valid route If route is not valid
ERROR 205 Sender id doesn't exist when route TR & OT
ERROR 206 Language doesn't exist
ERROR 207 Please choose valid language If Language is not valid
ERROR 208 Template text can't be null If Template is not exist
ERROR 209 You have insufficient credits for this route !!
ERROR 210 Your credit validity has been expired for this route !!
ERROR 211 Message contains unicode characters. Please choose language as unicode (UC) or remove unicode characters. If message contain unicode character but using language “EN”
ERROR 212 Message doesn't contain any unicode character. Please choose language as English." If message does not contain unicode character but using language “UC”
ERROR 223 Sorry! message is not proper
ERROR 213 contact number doesn't exist
ERROR 214 contact number can't be blank
ERROR 215 This number is Invalid!! : 7878787
ERROR 216 Maximum mobile number exceed!! If contact numbers more than 100
ERROR 217 Sender Id must be required for this route !! If sender Id require for the route based on user id
ERROR 218 Invalid Sender Id chose !! If invalid sender id chosen based on user id (in case of TR & OT routes)
ERROR 219 There is no gateway available for this route !!
ERROR 220 Invalid Template for selected route If template is necessary (in case of TR & OT routes)
ERROR 221 Invalid Template Id for selected route !! If template id passed with template & template id is blank or not associated with that template
ERROR 222 KYC is not completed for sending sms through this route !! If KYC is necessary for route (based on user)
ERROR 500 technical issue contact admin Other Error

SMS Campaign Sample Code

 
<php
//
// A very simple PHP example that sends an HTTP POST to M1 SMS PANEL
//
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://m1.sarv.com/api/sms_campaign/create");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,'data={"token":"TOKEN","user_id":"USER_ID","route":"ROUTE","languge":"LANGUAGE","template_id":"T_ID","template":"TEMPLATE_CONTENT","sender_id":"SENDER_ID","contact_numbers","98XXXXXX98,98XXXXXX96"}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close ($ch); 
print_r($server_output);
?>


SMS Campaign Message Status

http://m1.sarv.com/api/sms_campaign/viewMessageStatus?data={"token":"2017535XXXXXX8d95XXX6083357","user_id":"1234XX78","message_id":"4XXX_1_9988776655_2" }

Parameters :

Key Format Description
data JSON It is a JSON variable which contains all variables required for sending request.
user_id String Unique user id
token String User's unique token
user_id String Unique user id
message_id String Valid Message Id

Response

Success Case :

{
    "msg": "success",
    "code": 200,
    "msg_text": "Message Status Report",
    "data": {
        "campaign_id": 454554,
        "message_status": {
        "number": "98XXXXXX98",
        "status": "Delivered", (i.e. Pending, DND, Soft Failed, Hard Failed)
        "time_stamp" : 157XX18438
        }
    }
}



Error Case :

{
    "msg": "error",
    "code": "101",
    "msg_text": "user id and token is not set or invalid"
}



msg code msg_text extra
ERROR 401 user id and token is not set or invalid If Owner and token not valid
ERROR 406 You are not authorize to do this action !! If user type is not valid
ERROR 203 Message Id doesn't exist
ERROR 204 Message Id can't empty
ERROR 205 Message Id is invalid !!
ERROR 206 Doesn't match with any record If message id doesn’t match with any record
ERROR 500 technical issue contact admin Other Error