[go: nahoru, domu]

ES

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:

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/services/LabsMobileWsdl.php.


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/ws/services/LabsMobileWsdl.php

  • PARAMETERS

    The parameters or data are sent in variables of the WebService functions. The values and functionality of all parameters are described below:

  • Expand all

    XML ELEMENTS

  • 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:

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/LabsMobileWsdl.php?wsdl.
You need to give a name to the Namespace, for example "LabsMobileAPI".

Multiple sending
  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>")
                
Positive result
  <?xml version="1.0" encoding="utf-8"?>
  <response>
        <code>0</code>
        <message>Message has been successfully sent</message>
        <subid>56fb9baa6bc22</subid>
  </response>
                  
Wrong result
  <?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/ws/services/LabsMobileWsdl.php

  • PARAMETERS

  • RESULT

    The result is obtained in XML format with the root element <response> and the following child element:

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/LabsMobileWsdl.php?wsdl. You need to give a name to the Namespace, for example "LabsMobileAPI".

Balance inquiry
  string resultado = new Client.LabsMobileAPI.GetCredit(
      "myUsername",
      "myToken")
                
Positive result
  <?xml version="1.0" encoding="utf-8"?>
  <response>
      <messages>9.956954285714286</messages>
  </response>
                  
Wrong result
  <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:

Result codes in the response XML
XML CodeDescription
0Message has been successfully sent
10Missing XML data in request
11Badly formed XML in request
20The message element must be present in the request
21The message element cannot be empty
23There are no recipients
24Too many recipients
27This message contained one or more invalid character(s)
28Subid is exceeding maximum length
30There was an error while sending the message
35The account has no enough credit for this sending
39The value of the scheduled field is not a valid datetime format
41Scheduled messages cannot be send in test mode