1. Home
  2. Docs
  3. API Documentation
  4. Active APIs
  5. sendSMS

sendSMS

Sends out a pre-approved SMS to a mobile number. 

This API deprecates the older sendTransactionalSMS() API.

SMS messages can be sent out to Indian mobile numbers only. At least one of the following parameters should be provided: subID / mobile. If you provide both, then subID takes precedence.

Sending out SMS messages has some pre-requisites:

  1. You must be registered on a DLT platform, and must have a registered Entity ID.
  2. Your Juvlon account must be updated with your Entity ID.
  3. The SMS body / template needs to be approved with the DLT: 
    • Any personalization(s) that you would like to be inserted in the SMS body (e.g. first name) should be provided as variables in the template at the time of approval.
    • Any link(s) that you would like to be tracked should be provided as variables in the template at the time of approval.
    • Note the template ID provided for you message body / template by the DLT. It has to be sent in the sendSMS API call.
  4. The Header ID / sender used for approving the SMS body / template should be added in your Juvlon account.

This API enables you to provide all the personalization details of the recipient that you would like to send in your SMS, like the first name, last name, etc..  The API will first update any existing subscriber that it finds (with the matching subID / mobile number) with these personalization details, and then send the specified SMS. If there is no such existing subscriber, then the API will first create a new subscriber with all the personalization data provided, and then send out the SMS to the new subscriber.

This API needs to be called using an HTTP Post method with data in JSON format as shown below.

URL:  https://api2.juvlon.com/v5/sendSMS

JSON Parameters
'{"apiKey":"$apiKey",
"subID":"$subID",
"mobile":"$mobile",
"body":"$body",
"entityID":"$entityID",
"templateID":"$templateID",
"headerID":"$headerID",
"campaignName":"$campaignName",
"email":"$email",
"prefix":"$prefix",
"firstName":"$firstName",
"middleName":"$middleName",
"lastName":"$lastName",
"phone":"$phone",
"address":"$address",
"city":"$city",
"state":"$state",
"pinCode":"$pinCode",
"country":"$country",
"residencePhone":"$residencePhone",
"designation":"$designation",
"company":"$company",
"companyAddress":"$companyAddress",
"companyCity":"$companyCity",
"companyState":"$companyState",
"companyCountry":"$companyCountry",
"companyPin":"$companyPin",
"companyPhone":"$companyPhone",
"companyFax":"$companyFax",
"birthday":"$birthday",
"anniversary":"$anniversary",
"referenceNo":"$referenceNo",
"other1":"$other1",
"other2":"$other2",
"other3":"$other3",
"other4":"$other4",
"other5":"$other5",
"other6":"$other6",
"customField":"$customField",
"var":[
	    {
		"value":"$value1",
		"track":"$track1"
           },
           {
		"value":"$value2",
		"track":"$track2"
           }
      ]
}';

Arguments

NameTypeDescriptionDefault
apiKeyStringMandatory. The apiKey that gives you access to our HTTP APIs. 
The apiKey authenticates you and helps us to identify your Juvlon account.
subIDIntThe subscriber ID of an already existing subscriber in your Juvlon account that you would like to send the SMS to.
mobileStringThe mobile number to send the SMS to. 
This field is ignored if there is a “subID” present in the API call.
emailStringThe email address of your recipient. To be used as a personalization in your SMS.
bodyStringMandatory in each request.The urlencoded pre-approved content of the SMS to be sent out.
entityIDIntMandatory in each request.Your registered Entity ID with the DLT. Note: The same Entity ID must be set up in your Juvlon account.
templateIDIntMandatory in each request. The template ID provided by the DLT for your approved SMS text.
headerIDStringMandatory in each request.The header ID / sender of your approved SMS template / message.

Note: 
The header ID should be the same as provided to the DLT for the approval of your SMS template.
 
The same Header ID should also be present in your Juvlon account.
campaignNameStringThe campaign for this SMS. All analytics (Delivered / non-delivered / DND / Clicks etc.) will be saved against this campaign.

Creates a new campaign with this name if it does not already exist. When you login to Juvlon, you will find a campaign and an SMS with this name (as  provided in the API call). You can click on the analytics icon of the SMS to view all analytics.
prefixStringThe prefix / title of your SMS recipient. E.g. Mr., Mrs., Dr. etc.. To be used as a personalization in your SMS.
firstNameStringThe first name of your SMS recipient.  To be used as a personalization in your SMS.
middleNameStringThe middle name of your SMS recipient.  To be used as a personalization in your SMS
lastNameStringThe last name of your SMS recipient.  To be used as a personalization in your SMS
phoneStringThe primary telephone of your SMS recipient.  To be used as a personalization in your SMS
addressStringThe residential address of your SMS recipient.  To be used as a personalization in your SMS
cityStringThe city in which your SMS recipient resides.  To be used as a personalization in your SMS
stateStringThe state in which your SMS recipient resides.  To be used as a personalization in your SMS
pinCodeStringThe pin code of your SMS recipient’s residential address.  To be used as a personalization in your SMS
countryStringThe Country where your SMS recipient resides.  To be used as a personalization in your SMS
residencePhoneStringThe residence phone number of your SMS recipient.  To be used as a personalization in your SMS
designationStringThe official designation of your SMS recipient.  To be used as a personalization in your SMS
companyStringThe company in which your SMS recipient works.  To be used as a personalization in your SMS
companyAddressStringThe company address where your SMS recipient works.  To be used as a personalization in your SMS
companyCityStringThe city where your SMS recipient works.  To be used as a personalization in your SMS
companyStateStringThe state where your SMS recipient works.  To be used as a personalization in your SMS
companyCountryStringThe Country where your SMS recipient works.  To be used as a personalization in your SMS
companyPinStringThe pin code of the area where your SMS recipient works.  To be used as a personalization in your SMS
companyPhoneStringThe office phone number of your SMS recipient.  To be used as a personalization in your SMS
companyFaxStringThe office fax number of your SMS recipient.  To be used as a personalization in your SMS
birthdayStringYour SMS recipient’s birthday in ‘yyyy-mm-dd’ format.  Can be used to trigger emails on the recipient’s birthday or as a personalization in emails / SMS.
anniversaryStringYour SMS recipient’s anniversary date in ‘yyyy-mm-dd’ format.  Can be used to trigger emails on the recipient’s anniversary day or as a personalization in emails / SMS.
referenceNoStringAny reference number that you want to use for the SMS recipient.  To be used as a personalization in your SMS
other1StringAny other information that you may like to store about your SMS recipient.  To be used as a personalization in your SMS
other2StringAny other information that you may like to store about your SMS recipient.  To be used as a personalization in your SMS
other3StringAny other information that you may like to store about your SMS recipient.  To be used as a personalization in your SMS
other4StringAny other information that you may like to store about your SMS recipient.  To be used as a personalization in your SMS
other5StringAny other information that you may like to store about your SMS recipient.  To be used as a personalization in your SMS
other6StringAny other information that you may like to store about your SMS recipient.  To be used as a personalization in your SMS
customFieldStringCustomized text for your internal tracking.
varStructureA list / array of variables to be updated in the SMS body: 
Links, or Personalization
The list should be provided within square braces [ ], and each variable should be provided within curly braces { }
valueProvided for each variable within the “var” structure. The personalization / link that needs to be inserted into the SMS body.
All variable and links need to be lesser than or equal to 30 characters long. 
You can include a link that exceeds 30 characters by setting its link tracking to true.  This will result in the API inserting a shorter Juvlon link which when clicked will navigate your subscriber to your original link.
trackProvided for each variable within the “var” structure. This is applicable only for a link:
Set “yes” for link tracking (default),
Set “no” for not tracking links. 
Ignored if provided for a personalization.

Return values

NameTypeDescription
codeStringThe Success or Error response code as returned by the API. Please refer to the section “Possible-Response-Codes” for more details.
statusStringDescription of the error code returned.
transactionIdStringA number generated by the API to uniquely identify the current call. Also known as the API_Call_ID.

Usage / Example(s)

PHP Example Code for Integration

$url = 'https://api2.juvlon.com/v5/sendSMS';
$data = '{"apiKey":"KEY",
          "subID":"98",
          "mobile":"9890999999",
          "email":"example@abc.com",
          "body":"This is today’s ({var}) test. Click {var}",
          "entityID":"1701101101101101101",
          "templateID":"1701101101101101102",
          "headerID":"JUVLON",
          "campaignName":"Test Campaign",
          "prefix":"Mr.",
          "firstName":"John",
          "middleName":"K",
          "lastName":"Smith",
          "phone":"+91227492682648",
          "address":"House 5, Suncity",
          "city":"Mumbai",
          "state":"Maharashtra",
          "pinCode":"9604",
          "country":"India",
          "residencePhone":"912274926829",
          "designation":"Project Manager",
          "company":"XYZ ltd.",
          "companyAddress":"Office no 5, ABC IT Park",
          "companyCity":"Mumbai",
          "companyState":"Maharashtra",
          "companyCountry":"India",
          "companyPin":"9607",
          "companyPhone":"+912274926826",
          "companyFax":"+912274926827",
          "birthday":"1988-06-10",
          "anniversary":"2015-06-11",
          "referenceNo":"123",
          "other1":"98732",
          "other2":"989",
          "other3":"7687",
          "other4":"989",
          "other5":"7687",
          "other6":"K987JF",
          "customField":"custom_text",
          "var":[
              {
                   "value":"1st Dec 2023"
              },
              {
                   "value":"https://juvlon.com/",
                   "track":"yes"
              }
            ]
          }'; 
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$res1 = curl_exec($ch);
curl_close($ch);

Success-Response

HTTP/1.1
  {
     "code":200,
     "status":"Success",
     "transactionId":327
  }

Error-Response

 HTTP/1.1
  {
     "code":442,
     "status":"Error"
  } 

Possible-Response-Codes

200	Success: API Request Accepted
401	Error: Invalid Method
402	Error: Unauthorized/Empty Key
403	Error: Unauthorized/Invalid Key
448	Error: Your Juvlon account is Deactivated
455	Error: Invalid recipient mobile number
602	Error: No subscriber provided
615	Error: Mobile Number not present for subID
443	Error: INACTIVE Subscriber
457	Error: Subscriber does not exist
447	Low SMS credit
452	Clicked
460	Delivered
461	Not Delivered
462	DND
497	Error: Entity ID not set in the Juvlon Account
498	Error: Entity ID not provided
499	Entity ID provided does not match the Entity ID in your Juvlon account
408	Error: Body content not provided
613	Error: Invalid Template ID
409	Error: Sender not provided
420	Error: Sender email does not exist in your Juvlon account
421	Error: Sender not activated
612	Error: Invalid Campaign Name
616	Error: Variable exceeded the max length