WebService SMS sending API
The API SMS WebService is designed for technicians and customers who want to connect their applications to LabsMobile's SMS messaging platform.
The functionalities of the SMS WebService API are:
- The sending of SMS messages individually or massively in real time.
- Scheduled sending of SMS messages.
- Sending SMS Unicode, SMS Concatenated messages and SMS Certified messages.
- Consulting the balance of credits in an account
This documentation explains in detail the process of integration and automation of these functionalities.
To start an integration with the WebService API, the following requirements are essential:
- A LabsMobile account associated with a username (registration email). Create an account here.
- API token used as password and generated from the API Settings section of your account.
- URL of the SMS WebService API and the values of the parameters to make the request.
To be taken into account
RecommendationWe recommend using our API SMS http/POST because it includes more features, improves security and performance.
LabsMobile's API SMS WebService is a SOAP WDSL RPC/encoded API with this base URL: https://api.labsmobile.com/ws/
.
Authentication
The authentication method used in the WebService API is done by sending the credentials (username
and tokenapi
) in the parameters of the SOAP functions.
Configuration and filters
The following are important configuration variables and security aspects in an integration with the WebService SMS API:
- IP address from which messages will be sent. If this option is enabled, only requests from the list of IP addresses entered will be accepted. This functionality is optional, by default messages will be accepted from any IP.
- Default sender (default
LABSMOBILE
). Only some operators allow dynamic, alphanumeric-valued mapping of the sender field. - Daily message limit, by default 100,000 sms/day.
- Message limit per batch, default 10,000 sms/request.
- Country filter, so that only messages from a list of countries are processed.
- Anti-duplication filter, to avoid sending identical messages to the same recipient.
All these parameters can be activated and modified in the API Settings and Account Preferences.
Important A maximum of 10 requests per second is established. Misuse, abuse or a higher volume of requests will result in a temporary or permanent blocking of the account and/or IP address.
Recommendation We recommend activating the Automatic Top-Ups so that there are always credits available in the account and the SMS sending service is not interrupted.
Sending SMS messages
Petition for sending SMS messages individually or in bulk.
With this functionality, messages can be sent in real time or scheduled for a specific day and time. In addition, other parameters such as sender, label, identifier, simulated mode, etc. can be added.
ENDPOINT
https://api.labsmobile.com
PARAMETERS
The parameters or data are sent in variables of the WebService functions. The values and functionality of all parameters are described below:
client string obsolete
Customer identifier. Obsolete parameter and must have a null value.
username email mandatory
Email user name that identifies the sending account.
Example:
email@mydomain.com
password string mandatory
API token generated in the API Configuration section of the account.
Example:
lUHia713N5aByua79fU5s1Nlb6ItZ9ioVu
.xmldata xml mandatory
Basic parameters and options for sending SMS messages. It must contain a string in XML format with the elements described in XML elements.
Example XMLdata<?xml version="1.0" encoding="utf-8"?> <sms> <recipient> <msisdn>34609542312</msisdn> </recipient> <message>Test message number 1</message> <tpoa>Sender name</tpoa> </sms>
- Expand all
XML ELEMENTS
sms xml mandatory
Root element that delimits the start and end of the XML format.
recipient xml mandatory
Include the numbers of the recipients.
msisdn string mandatory
Telephone numbers of the recipients to whom the message is sent. The numbers must comply with the international format E.164 and separated by commas (",") if more than one destination number is included.
Example:
<msisdn>34609542313</msisdn>
message string mandatory
Text of the message to be sent. When sending standard SMS only GSM 3.38 7bit alphabet characters are valid. You can also send Concatenated SMS, Unicode SMS and Certified SMS with the corresponding parameters.
Example:
<message>Hello world!</message>
.scheduled YYYY-MM-DD HH:MM:SS
Scheduling of sending for the day and time indicated. If this field is not specified, the message will be sent immediately. Format:
YYYYYY-MM-DD HH:MM:SS
.Important: The value of this field must be expressed in GMT time zone.
Example:
<scheduled>2012-11-07
.17:34:00</scheduled> tpoa string
SMS message sender field. It can have a numeric value (maximum length 16 digits) or an alphanumeric value (maximum length 11 characters).
Sender assignment and customization is only available in some countries and operators. Otherwise, the sender will be a static numeric value (shortcode or longcode).
Example:
<tpoa>MyBrand</tpoa>
.subid string
Request identifier. Maximum length of 20 characters.
If no value is included in the
subid
parameter, the platform will assign a unique 13-character identifier that will be displayed in the request result.Example:
<subid>5aa3ea8028ce5</subid>
.label string
Free information field to identify and assign attributes. Maximum length of 255 characters.
Possible uses: user, application, grouping or campaign, etc.
Example:
<label>A05-Jan-2024</label>
.test 0 | 1
Activation of simulated send mode for testing and monitoring.
If a value
1
is assigned to this parameter, the messages will not be sent to the recipients and no credit will be deducted. Messages sent in simulated mode will be available in the History and other tools.Example:
<test>1</test>
.ackurl url
Url to which delivery confirmation and error notifications of sent messages will be sent.
A default URL can be set in the Account API Settings and in that case it is not necessary to include this parameter.
Example:
<ackurl>https://clientserver.com
./receive_ack</ackurl> clickurl url
Url to which the event notifications will be sent when clicking on the links in the sent messages.
A default URL can be set in the Account API Settings and in that case it is not necessary to include this parameter.
Example:
<clickurl>https://clientserver.com
./receive_click</clickurl> shortlink 0 | 1
Activation of automatic link replacement.
If its value is
1
all Urls in the message will be replaced with a short link (format:labsmo.bi/XXXXXXXXX
or custom domain).You can enable this feature permanently for all messages in the Account Preferences and in that case you do not need to include this parameter.
Example:
<shortlink>1</shortlink>
.long 0 | 1
Activation of the SMS Concatenated in this request.
If this field has value
1
the message can contain more than 160 characters. Learn more about How to calculate the price of an SMS.Example:
<long>1</long>
.ucs2 0 | 1
Activation of the SMS Unicode in this request.
If this field has value
1
the message can contain any character, symbol or emoji. The capacity is reduced to 70 characters and concatenated and unicode SMS can be sent. Learn more about How to calculate the price of an SMS.Example:
<ucs2>1</ucs2>
.crt email
Sending a SMS Certificate in this request.
An e-mail with the certification PDF document will be sent to the address containing this parameter.
Example:
<crt>info@client.es</crt>
.crt_name string
Name of the entity or company sending the certified SMS. Only effective if sent together with the
crt
parameter.Example:
<crt_name>My Company SL</crt_name>
.crt_id string
Fiscal identifier of the entity or company sending the certified SMS. Only effective if sent together with the
crt
parameter.Example:
<crt_id>ESB65213332</crt_id>
.crt_lang string
Certificate language. Only effective if sent together with the
crt
parameter.Values:
ES
EN
CA
FR
DE
IT
IT
NL
PT
NL
DA
SV
PL
RO
RO
EL
EL
.Example:
<crt_lang>EN</crt_lang>
.nofilter 0 | 1
If this field has value
1
the duplicate message filter will not be applied.You can permanently enable or disable this feature for all messages in the Account Preferences and in that case you do not need to include this parameter.
Example:
<nofilter>1</nofilter>
.RESULT
The result of any SMS http/POST API request is obtained in
XML
format with the root element<response>
and the following child elements:code integer
Identifier code indicating whether the request could be processed successfully or if an error occurred. Possible values in the Errors section.
Example:
<code>0</code>
.message string
Description indicating whether the request could be processed successfully or if an error occurred. Possible values in the Errors section.
Example:
<message>The message element cannot be empty</message>
.subid string
API request identifier.
Example:
<subid>6615686480e47</subid>
Example in VisualStudio.net
In the VisualStudio.net environment Solution Explorer section click on Add Service Reference and enter the following url: https://api.labsmobile.com/ws/services/
.
You need to give a name to the Namespace, for example "LabsMobileAPI".
string resultado = new Client.LabsMobileAPI.SendSMS( "priv00x", "myUsername", "myToken", "<?xml version="1.0" encoding="utf-8"?> <sms> <recipient> <msisdn>34609542312</msisdn> <msisdn>34609542313</msisdn> <msisdn>34609542315</msisdn> </recipient> <message><![CDATA[This is an example message]]></message> </sms>")
<?xml version="1.0" encoding="utf-8"?> <response> <code>0</code> <message>Message has been successfully sent</message> <subid>56fb9baa6bc22</subid> </response>
<?xml version="1.0" encoding="utf-8"?> <response> <subid>6615686480e47</subid> <code>21</code> <message>The message element cannot be empty</message> </response>
Balance inquiry
Consult on the number of available credits of an account.
ENDPOINT
https://api.labsmobile.com
PARAMETERS
username email mandatory
Email user name that identifies the sending account.
Example:
email@mydomain.com
password string mandatory
API token generated in the API Configuration section of the account.
Example:
lUHia713N5aByua79fU5s1Nlb6ItZ9ioVu
.RESULT
The result is obtained in
XML
format with the root element<response>
and the following child element:messages float
Number of credits available in the account balance.
Example:
<messages>32.45</messages>
.
Example in VisualStudio.net
In the VisualStudio.net environment Solution Explorer section click on Add Service Reference and enter the following url: https://api.labsmobile.com/ws/services/
. You need to give a name to the Namespace, for example "LabsMobileAPI".
string resultado = new Client.LabsMobileAPI.GetCredit( "myUsername", "myToken")
<?xml version="1.0" encoding="utf-8"?> <response> <messages>9.956954285714286</messages> </response>
<html> <head> <title>403 Forbidden</title> </head> <body> <h1>403 Forbidden</h1> </body> </html>
Errors
The complete list of codes obtained in the response XML format is described below:
XML Code | Description |
---|---|
0 | Message has been successfully sent |
10 | Missing XML data in request |
11 | Badly formed XML in request |
20 | The message element must be present in the request |
21 | The message element cannot be empty |
23 | There are no recipients |
24 | Too many recipients |
27 | This message contained one or more invalid character(s) |
28 | Subid is exceeding maximum length |
30 | There was an error while sending the message |
35 | The account has no enough credit for this sending |
39 | The value of the scheduled field is not a valid datetime format |
41 | Scheduled messages cannot be send in test mode |
Support resources
We recommend that you consult and take into account the following support resources in your integration:
- Description, manual and code examples of the SMS sending API.
- Technical guide to an OTP validation or authentication process by SMS.
- All LabsMobile API versions and functionalities.
- First Steps to API Integration Tutorial
- Create a demo account
- Recommendations and best practices in any integration.
- Plugins, modules and extensions.
- Need help? Contact our technicians