PHP Library Download

SMS Linker provides a ready to use PHP library. The Library is simply an Object called API with different methods. All methods like our API are documented in table next to this presentation. This lib is simply a cURL request builder, it returns exactly all data returned by our API. The sole difference is that you must provide your API Key in the configuration file. You also need to enable the PHP cURL Extension to use the library.

Authentication

All requests executed by this lib must be identified by your API Key. You must edit the "smslinker.config.php" file to add your API key .
To create this object you must use:

require('SMSLinker/lib.php');
$request = new SMSLinker();

Campaign list

Proceed with the following request:

$request->getCampaigns();

Response

The response will be a JSON object. See the following example:

{"campaigns": [
	  {"ID": "01","Sending_time": "08-06-2017_17:00", "Creating_time": "08-06-2017_17:00", "Status": "ENVOYE","Message":"Go #url# #Var_A# Stop au XXXXX"},
	  {"ID": "01","Sending_time": "08-06-2017_17:00", "Creating_time": "08-06-2017_17:00", "Status": "ENVOYE","Message":"Go #url# #Var_A# Stop au XXXXX"},
	  {"ID": "01","Sending_time": "08-06-2017_17:00", "Creating_time": "08-06-2017_17:00", "Status": "ENVOYE","Message":"Go #url# #Var_A# Stop au XXXXX"},
	  {"ID": "01","Sending_time": "08-06-2017_17:00", "Creating_time": "08-06-2017_17:00", "Status": "ENVOYE","Message":"Go #url# #Var_A# Stop au XXXXX"}
	]
}								
{"campaigns": []}

Args :

OPTIONAL $limitation : specify number of results per page
OPTIONAL $page : specify page number

Campaign information

Proceed with the following request:

$request->getCampaign(int ID);

Response

The response will be a JSON object. See the following example:

{"campaign":{"Sending_time": "08-06-2017_17:00", "Creating_time": "08-06-2017_17:00", "State": "ENVOYE","Reciptients_amount":"50","Message":"Go #url# #Var_A# Stop au XXXXX"}}
{"campaign": {}}

Campaign recipients

Proceed with the following request:

$request->getCampaignRecipients(int ID);

Response

The response will be a JSON object. See the following example:

{"recipients":[
	{"ID": "55", "campaign_ID": "01", "State": "Envoye","Phone":"+33606060606","Sending_time":"08-06-2017_17:00","Receiving_time":""},
	{"ID": "55", "campaign_ID": "01", "State": "Recu","Phone":"+33606060606","Sending_time":"08-06-2017_17:00","Receiving_time":""},
	{"ID": "55", "campaign_ID": "01", "State": "Expire","Phone":"+33606060606","Sending_time":"08-06-2017_17:00","Receiving_time":""},
	{"ID": "55", "campaign_ID": "01", "State": "Supprime","Phone":"+33606060606","Sending_time":"08-06-2017_17:00","Receiving_time":""},
	{"ID": "55", "campaign_ID": "01", "State": "Non_Livrable","Phone":"+33606060606","Sending_time":"08-06-2017_17:00","Receiving_time":""},
	{"ID": "55", "campaign_ID": "01", "State": "Inconnu","Phone":"+33606060606","Sending_time":"08-06-2017_17:00","Receiving_time":"08-06-2017_17:00"}
]}
{"recipients": []}

Campaign stops

Proceed with the following request:

$request->getCampaignStops(int ID);

Response

The response will be a JSON object. See the following example:

{"stops":[
	{"ID": "55", "campaign_ID": "01","Phone":"+33606060606","Time":"08-06-2017_17:00"},
	{"ID": "55", "campaign_ID": "01","Phone":"+33606060606","Time":"08-06-2017_17:00"}
]}
{"stops": []}

Campaign stats brief (if rich or survey option enabled)

Proceed with the following request:

$request->getCampaignStatsBrief(int ID);

Response

The response will be a JSON object. See the following example:

{"stats":[
	{"General_Consult": "55", "Unique_Consult": "1","Click_Rate":"98","Android":"5","Apple":"5","Windows":"5","Other":"5"}
]}
{"stats": []}

Campaign stats details (if rich or survey option enabled)

Proceed with the following request:

$request->getCampaignStatsDetails(int ID);

Response

The response will be a JSON object. See the following example:

{"stats":[
	{"ID": "55", "Platform": "Mac 10.11.1","Country":"FR","City":"La Rochelle","Browser":"Safari","Phone":"+33606060606","Time":"08-06-2017_17:00"},
	{"ID": "56", "Platform": "Mac 10.11.1","Country":"FR","City":"La Rochelle","Browser":"Safari","Phone":"+33606060606","Time":"08-06-2017_17:00"}
]}
{"stats": []}

All stops

Proceed with the following request:

$request->getStops();

Response

The response will be a JSON object. See the following example:

{"stops":[
	{"ID": "55", "campaign_ID": "01","Phone":"+33606060606","Time":"08-06-2017_17:00"},
	{"ID": "55", "campaign_ID": "","Phone":"+33606060606","Time":"08-06-2017_17:00"}
]}
{"stops": []}

Minisite list

Proceed with the following request:

$request->getMinisites();

Response

The response will be a JSON object. See the following example:

{"minisites":[
	{"ID": "0", "Label": "TEST MS","Createdtime":"08-06-2017_17:00"},
	{"ID": "1", "Label": "Test MS2","Createdtime":"08-06-2017_17:00"}
]}
{"minisites": []}

Survey list

Proceed with the following request:

$request->getSurveys();

Response

The response will be a JSON object. See the following example:

{"surveys":[
	{"ID": "0", "Label": "Survey MS","Createdtime":"08-06-2017_17:00"},
	{"ID": "1", "Label": "Survey MS2","Createdtime":"08-06-2017_17:00"}
]}
{"surveys": []}

Survey answers

Proceed with the following request:

$request->getSurveyAnswers(int ID);

Response

The response will be a JSON object. See the following example:

{"answers":[
	{"ID": "0", "Label": "Answer","Amount":"160"},
	{"ID": "1", "Label": "Answer","Amount":"55"}
]}
{"answers": []}

Campaign answers

Proceed with the following request:

$request->getCampaignAnswers(int ID);

Response

The response will be a JSON object. See the following example:

{"answers":[
	{"ID": "55", "campaign_ID": "01","Phone":"+33606060606","Time":"08-06-2017_17:00","Answer":"this is an answer"},
	{"ID": "55", "campaign_ID": "","Phone":"+33606060606","Time":"08-06-2017_17:00","Answer":"this is an answer"}
]}
{"answers": []}

Campaign delivery receipts

Proceed with the following request:

$request->getCampaignDreceipts(int ID);

Response

The response will be a JSON object. See the following example:

{"recipients":[
	{"ID": "55", "campaign_ID": "01", "State": "Recu","Phone":"+33606060606","Sending_time":"08-06-2017_17:00","Receiving_time":"08-06-2017_17:00"},
	{"ID": "56", "campaign_ID": "01", "State": "Recu","Phone":"+33606060606","Sending_time":"08-06-2017_17:00","Receiving_time":"08-06-2017_17:00"},
]}
{"recipients": []}

Credits

Proceed with the following request:

$request->getCredits();

Response

The response will be a JSON object. See the following example:

{"credits":[
	{"Product_ID": "55", "Product_country": "France", "Amount":"50"},
	{"Product_ID": "55", "Product_country": "France", "Amount":"50"}
]}

White label information

Proceed with the following request:

$request->getWhitelabel();

Response

The response will be a JSON object. See the following example:

{"Domain": "test.fr", "Enabled": "true", "Name": "my business", "Logo_URL":"50"}

Product list

Proceed with the following request :

$request->getProducts();

Response

The response will be a JSON object. See the following example:

{"products":[
	{"Product_ID": "1", "Product_category": "SMS", "Product_label": "Premium", "Product_country": "France"},
	{"Product_ID": "2", "Product_category": "SMS", "Product_label": "Low cost", "Product_country": "France"}
]}

Country list

Proceed with the following request :

$request->getCountries();

Response

The response will be a JSON object. See the following example:

{"Countries":[
	{"Country_ID": "1","Country_label": "France"},
	{"Country_ID": "2", "Country_label": "UK"}
]}

Send a message:

Proceed with the following request:

$request->sendSMS(int product_id, string senderlabel, string content, string manual_recipients, int phonebooks, int country_id, boolean dynamicvars, string senddate, int richtype, boolean ruchurlconf, string richurlorigin, int destination_url, int minisite_id, int survey_id)

POST Parameters :

product_id :
senderlabel : sender name ( if SMS premium or SMS International)  Max 11 char
content : message content
manual_recipients : recipients list separate by a comma (Optional)
phonebooks : Phonebook ID(Optional)
country_id (optional) : if SMS International, you must define an country
dynamicvars (optional) : 1 = Enable the dynamic variables of your phonebook, disabled by default. /!\ IF YOU ENABLE THIS, MANUAL RECIPIENTS ARE DISABLED /!\
senddate (optional) : sending date (YYYY-mm-dd_H:i)						
richtype (optional) : Type 1 = Rich SMS, Type 2 = Minisite, Type 3 = Survey
richurlconf (optional) : 0 = One URL for entire campaign, 1 = One URL per SMS
richurlorigin (optional) : If richurlconf = 1, you can customise your short URL
destination_url (optional) : If your rich sms type is 1, the full URL to which customers are redirected						
minisite_id (optional) : If your rich sms type is 2, your minisite ID						
survey_id (optional) : If your rich sms type is 3, your survey ID

Errors

Error Reason How to fix
MISSING_CONTENTYour message content is emptyProvide a message content.
PHONEBOOK_ID_NOT_NUMERICThe Phonebook ID is not numericProvide a numeric phonebook ID
PHONEBOOK_NOT_FOUNDThe Phonebook ID does not exitProvide a valid phonebook ID
MISSING_PRODUCTThe value of product ID is missingProvide a valid product ID
NO_PRODUCT_FOUNDProduct does not existProvide a valid product ID
MISSING_SENDERLABELYour forgot to provide a sender labelProvide a sender label
TOOLONG_SENDERLABELSender label is too long.Your sender label must be shorter than 11 characters
DATE_FORMATProvided date is invalidFormat your date as specified in the documentation
PAST_DATEProvided date is before current dateThe provided date is in the past
INVALID_RICH_TYPEThe rich type provided is invalidProvide a rich type as specified in the documentation
MISSING_DESTINATION_URLDestination URL of rich sms is missingProvide a rich destination URL
MISSING_MINISITEYou have enabled rich sms and want to use minisite but, you have not provided a minisite IDProvide minisite ID
NOT_FOUND_MINISITEYou have enabled rich sms and want to use minisite but the provided minisite ID does not existProvide a valid minisite ID
MISSING_MINISITEYou have enabled rich sms and want to use survey but you have not provided a survey iDProvide a valid survey ID
INVALID_RICHURLCONFInvalid rich URL configuration, this must be 1 OR 0 as specified in the documentation
MESSAGE_TOOLONGMessage is too long, max is 349 characters (3 SMS - Premium or International) OR 160 characters (1 Lowcost SMS)
NO_ENOUGHT_CREDITYou do not have enough credits on your account, please order new ones.
EMPTY_RECIPIENT_LISTYour recipient list is empty or contain malformed phonenumber, we can't send your campain.

Response

The response will be a JSON object. See the following example:

{"RESULT":"SUCCESS"}
{"ERROR":"ERROR_LABEL"}

Phonebook list

Proceed with the following request:

$request->getPhonebooks();

Response

The response will be a JSON object. See the following example:

{"phonebooks": [
	  {"ID": "1", "Label": "Test", "Temporary": "true","Amount":"50000"},
	]
}								
{"phonebooks": []}

Contact list

Proceed with the following request:

$request->getPhonebookContacts(int ID);

Response

The response will be a JSON object. See the following example:

{"contacts": [
	  {"ID": "1", "Phonebook_ID": "1", "Country": "France","Phone":"+33606060606"},
	  {"ID": "1", "Phonebook_ID": "1", "Country": "France","Phone":"+33606060606"},
	  {"ID": "1", "Phonebook_ID": "1", "Country": "France","Phone":"+33606060606"},
	  {"ID": "1", "Phonebook_ID": "1", "Country": "France","Phone":"+33606060606"}
	]
}								
{"contacts": []}

How to delete a phonebook

Proceed with the following request:

$request->delPhonebook(int ID);

Response

The response will be a JSON object. See the following example:

{"result":true"}
{"result":false"}

How to delete a contact in a phonebook

Proceed with the following request:

$request->delPhonebookContact(int ContactID, int ID);

Response

The response will be a JSON object. See the following example:

{"result":true"}
{"result":false"}

Create a STOP

Proceed with the following request:

$request->createStop(string Phonenumber);POST : Phonenumber

POST Parameters :

Phonenumber : Phone number must be set in international format.

Response

The response will be a JSON object. See the following example:

{"result":true"}
{"result":false"}

Errors

Error Reason How to fix
NOT_FOUNDYour API Key is not validGet an API Key from your dashboard.
API_DISABLEDThe API is disabled on your accountActivate the API for your account from the dashboard.
ACCOUNT_NOT_ACTIVATEDYour account is not activated.Please activate your account.
ACCOUNT_BANNEDYour account is bannedPlease contact an administrator.
IP_BANNEDThe IP address sending the request has been banned.Please contact an administrator.