Skip to content
SMS API

SMS API

An API is available to send SMS messages from your information system.

Only sends to French mobile numbers are handled by the API. Messages are sent through a direct operator connection (Premium SMS), which makes it possible to manage replies and unsubscribes via a short code.

The URLs declared in the “URL Link” module can be used in your messages sent through the API. Click events are identified in the reports.

Unlike the SMS sending platform, sending hours are not restricted. However, please note that marketing SMS sends are forbidden between 8pm and 8am, as well as on Sundays and public holidays. Only solicited transactional SMS messages are allowed during these time slots.

The endpoint is: https://www.eml-srv.com/_api_rest/api_sms_submit

The Ediware SMS platform overview is available here.

Authentication

The API uses the REST format and is accessed through HTTP Basic authentication.

How authentication works

If your username is “monlogin” and your password is monmotdepasseABC, you must build the following string: monlogin:monmotdepasseABC
Then encode it in base 64: bW9ubG9naW46bW9ubW90ZGVwYXNzZUFCQw==

The following property must be added to your HTTP header:
“Authorization” : “Basic bW9ubG9naW46bW9ubW90ZGVwYXNzZUFCQw==”

PHP example with cURL

cURL makes HTTP Basic authentication easy to handle:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.eml-srv.com/_api_rest/api_sms_submit');
curl_setopt($ch, CURLOPT_USERPWD, "monlogin:monmotdepasseABC");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$output = curl_exec($ch);

Sending an SMS

Important: all character strings, especially the message itself which may contain special characters, must be encoded in UTF-8.

Parameters must be formatted in JSON.

Parameters

Text: the text of your message

TrackingId: a string of your choice. It is the reference of your task that will be returned later and will let you easily find your send.
This field is optional.

AdhocRecipients: the list of mobile numbers the message should be sent to.
It is an array with the key “Number” and as value the recipient’s mobile number.

Sender: a string of up to 11 characters that may only contain letters and digits (1-Za-z0-9), spaces or dots.
This field is optional. If empty or omitted, the SMS sender will be a French short code.
If this field is customized, the recipient will not be able to reply to the SMS, nor unsubscribe by replying “STOP”.
If this field is customized, the text “STOP XXXXX” will be automatically appended to your message. This string is 16 characters long.

Accepted number formats

Two formats are accepted:

  • French: 06XXXXXXXX or 07XXXXXXXX
  • International: +336XXXXXXXX or +337XXXXXXXXX

Request examples

Sending with a customized sender to a single recipient

{
     "Text": "This is a test", 
     "TrackingId": "my_tracking_id",
     "AdhocRecipients": [
          {
               "Number": "+337xxxxxx"
          }
     ]
}

Sending without a customized sender to two recipients

{
     "Text": "This is a test", 
     "TrackingId": "my_tracking_id",
     "AdhocRecipients": [
          {
               "Number": "+337xxxxxx"
          },
          {
               "Number": "+336xxxxxx"
          }
     ],
     "Sender": "Ediware"
}

PHP sending example

$url = 'https://www.eml-srv.com/_api_rest/api_sms_submit';

$username = 'your_login';
$password = 'your_password';

$msg = 'This is a UTF-8 encoded message';

// Build the parameters array

$data_to_post = array(
    'Text' => $msg,
    'TrackingId' => 'my_internal_tracking_id',
    'AdhocRecipients' => array(
        array(
            'Number' => '+336XXXXXXXX'
        ), // I can add up to 100 numbers
    ),
'Sender' => 'EDIWARE',
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data_to_post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$output = curl_exec($ch);
curl_close($ch);

// die($output); // for easy debugging

$output = json_decode($output);

// var_dump($output); // response handling

Handling the response

The response is in JSON format.

On error
{"Message":"error message detail"}

The possible errors are:

  • Auth protocol error: the login or password is not set, or the protocol is incorrect
  • Auth error: the protocol is correct but the credentials are wrong
  • Unknown error - no id: internal system error
  • SMS Module desactivated for this account: the SMS module is not enabled on your account
  • No more SMS credits: you have no remaining sending credits
  • Empty message: the message to send is empty
  • Message too long, nothing was sent: the message must be less than 700 characters
  • Wrong number nothing was sent: a number was in the wrong format. In that case the entire process is aborted.
On success

A process number is returned. You should store this number on your side, as it is the way to easily look up the status of the sends.
The number of credits consumed by the process is also indicated for information.

Example: {“JobNumber”:“unique process number”, “Cost”:“1”}

About message length

A single SMS can only contain 160 characters.

If the sender is customized, 12 characters are used to add an unsubscribe mechanism (STOP XXXXX). The maximum length is therefore 148 characters.

If you send a longer message, one or more additional credits will be consumed.
For SMS messages with a non-customized sender, the credit cost is:
1 credit up to 160 characters
2 credits up to 306 characters
3 credits up to 459 characters
4 credits up to 612 characters
5 credits up to 612 characters
6 credits beyond, however we cannot send SMS messages longer than 700 characters.

A specific case: the € sign counts as two characters because of how SMS encoding works.

Retrieving the status of your sends

Through the web interface

In the SMS Campaigns > API section, you can view the latest sends and their statuses.
You can also download the replies via the SMS Campaigns > Replies page.

Through an HTTP webhook

The URL where events should be posted must be specified in the SMS Campaigns > API > Webhooks section.

Data sent by the SMS API webhook

A test webhook can be sent through the interface to make your development easier.

The dictionary of returned values is below:

id: arbitrary numeric identifier generated by the platform for internal use.

date_envoi: SMS send date

TrackingId: the reference of your task, defined when sending the SMS to the API, returned to easily identify your send

JobNumber_api: unique process identifier generated by the platform. This is the same identifier returned when sending the SMS to the API.

tel: the recipient’s phone number

messagelength: the message length computed by the platform

credits: the number of credits consumed

status: overall status of the send

code_status: detailed status of the send (possible values at the end of the article)

date_status: date of the last status change

error_code: result of the transmission (possible values at the end of the article)

error_detail: result of the transmission “human readable” (possible values at the end of the article)

clicked: 1 if a link was clicked in the message, NULL otherwise

answer: the text of the recipient’s reply to the SMS, if any.

Data dictionary for the SMS API webhooks

The values returned by “statut”, “error_code”, “error_detail” and “code_statut” all return the result of the SMS send, with different levels of detail.

For most projects, processing the “statut” value is enough. Processing “error_code”, “error_detail” and “code_statut” is useful for cleaning a phone number database.

Possible values for “statut”**
1SMS sent to the operator
2SMS delivered to the recipient's mobile
3SMS not delivered
4STOP SMS
9Sending in progress
Possible values for “error_code” and “error_detail”
error_codeerror_detail
**S**Sent
**A**Expired message
**B**N/A
**C**Other operator errors
**D**Unreachable recipient
**E**System error
**F**Incorrect message
**G**Incorrect number
**H**Mobile error
**Z**Canceled, blocked or duplicated
Possible values for “code_status”

Processing these codes is optional. They give a very detailed view of why an SMS did not go through.

Code 10201 corresponds to a read receipt for the SMS.

S Forwarded to the aggregator
127 Z Duplicate
188 Z Recipient present in the user Black List
10000 E Partially sent SMS
10001 B IntermediatePhoneRelated
10002 B DelivererRelated
10005 D MessageFailed
10006 D FinalStatusUnknown
10007 B IntermediateCreditRelated
10008 A MessageExpiredWithinOperator
10020 F PermanentOperatorError
10021 C TemporaryCreditRelated
10022 C TemporaryCreditRelated
10023 G PermanentAbsent
10024 D TemporaryAbsent
10025 D OperatorNetworkFailure
10026 H TemporaryPhoneRelatedError
10027 F PermanentPhoneRelatedError
10028 G Spam
10029 F ContentRelatedError
10030 C SubscriberMessageLimitExceeded
10031 C SubsciberUnableToBeBilled
10037 C SubscriptionRelatedFailure
10038 C InvalidSubscriptionOperator
10039 D Portability Error
10073 D Portability Error
10075 C RefundDenied
10200 B Accepted By Operator
10201 S Delivered To Mobile Device
10300 A Message Expired (SMPP)
10301 F Empty message
10302 G Empty Phone Number
10303 Z Profile is unavailable
10398 E Didn't receive the asynchronous transmission notification
10399 E Generic system error
10401 E Invalid Header parameters
10402 E Invalid parameters in the Notification
10403 E Profile could not be used
10404 E Message could not be forwarded to mBlox
10405 E Client reference could not be found
10406 E Error in message data
10407 E Message contains illegal characters
10408 E General sending error
10409 E Private connection configuration error
10410 E Send timed out (Success unknown)
10413 E The prefix of the destination number is blacklisted
10416 E The mBlox server is currently too busy.
10417 E You are not allowed to use this value in the reply parameter.
10418 E Syntax error, the parameters are not specified correctly.
10420 E General problem.
10421 E General problem.
10422 E General problem.
10423 E You cannot send using this profile.
10424 E The username used when you logged in is faulty.
10425 E You are not allowed to send binary messages using this profile.
10426 E There is currently no available route for this message.
10427 E There is currently no available route for this message.
10428 E There is currently no available route for this message.
10429 E There is currently no available route for this message.
10430 E There is currently no available route for this message.
10431 E There is currently no available route for this message.
10432 E There is currently no available route for this message.
10433 E There is currently no available route for this message.
10434 E There is currently no available route for this message.
10435 E There is currently no available route for this message.
10436 E There is currently no available route for this message.
10437 E There is currently no available route for this message.
10438 E There is currently no available route for this message.
10439 E There is currently no available route for this message.
10440 E There is currently no available route for this message.
10441 E There is currently no available route for this message.
10442 E Error while trying to use a special functionality named "locally forced".
10443 E Error while trying to use a special functionality called "originator indexing". The originator for this index could not be found.
10444 E The available destination queues are full.
10445 E The client account is currently blocked on this server.
10446 E You supplied an illegal value in the billingRef parameter.
10447 E You are not allowed to send messages to this destination operator.
10448 E There is currently too much incoming traffic on this destination operator.
10449 E This sequence has been used earlier among the X last sent messages on this server. X is most likely 50, but it can vary.
10452 E Premium services only. The destination cannot be found for your supplied values. Verify the values used in the originator, tariff and operator fields.
10453 E Premium services only. The destination cannot be found for your supplied values. Verify the values used in the originator, tariff and operator fields.
10454 E There is no available route that supports the requested message features.
10455 E This product does not support the supplied features. Please verify your use of the profile parameter.
10456 E The text content of this message is prohibited on this product.
10457 E The number portability operator lookup failed.
10458 E The operator parameter is required when a MT is sent through the PsmsPlex application.
10459 E The MT could not be routed in the PsmsPlex application.
10460 E An unknown exception encountered when handling tags.
10461 E The tag is not configured in the Database.
10462 E The name of the tag is not valid.
10463 E The value of the tag is not valid.
10464 E The tag is not allowed for this destination operator.
10465 E Syntax error in tag/value pair.
10466 E Too many tags are submitted in the message.
10467 E A tag is duplicated.
10468 E Invalid ServiceDesc. Do not retry.
10469 E Default ServiceDesc not configured. Do not retry.
10470 E Invalid ContentType. Do not retry.
10471 E Default ContentType not configured. Do not retry.
10472 E ContentType not configured for Operator. Do not retry.
10473 E Invalid ContentType. Do not retry.
10474 E Default ServiceId not configured. Do not retry.
10475 E ServiceId not configured for Operator. Do not retry.
10476 E Timeout waiting for mBlox core platform to respond (Success unknown)
10477 E Invalid Subscriber
10478 E SubscriberNumber missing
10479 E Destination busy
10498 E Unknown Error
10499 E An error occured during the submission of the MtRequest
12001 S SMS Delivered
12002 G SMS Delivery failed
12401 E Login failed
12402 E Source IP is invalid
12403 E Text is not set
12404 E Text is invalid
12405 E Language is invalid
12406 E Telno is not set
12407 E Telno is invalid
12408 E Text is too long
12409 E Receive ID is not found
12410 E Receive ID and Telno is not matched
12411 E Telno is out of our range
12412 E Service is not available
12413 E Unknown Error
12497 E The MT Request result is badly formatted
12498 E The error code of the MT request result is unknown
12499 E Error occured during the submission of the NotificationRequest
13000 C Unknown Error (SMPP)
13001 C Internal routing error
13002 C Internal routing error
13003 C Internal routing error
13004 C Internal routing error
13005 C Internal routing error
13006 C Internal routing error
13007 C Internal routing error
13008 C Internal routing error
13009 G Unsupported number plan
13010 G Unsupported type of number
13011 C Message not deliver
13012 G Dialling zone not found
13013 C Not home zone and IMSI not allowed
13014 C Not home zone and IMSI fetch failed
13015 C Screening block
13016 C Terminating IMSI blocked
13017 G Destination network type unknown
13018 C ESME error
13019 C Originating location mismatch
13040 C Internal error
13050 C Internal error
13051 C Internal error
13052 C Internal error
13053 C Internal error
13054 C Internal error
13055 C Internal error
13060 C Error, originator blocked
13061 C Error, destination blocked
13062 C Error, keyword blocked
13063 C Error, SC address blocked
13064 C Error, blocked due to exceeded quota
13065 C Error, loop detected
13066 C Error, data coding scheme blocked Example: Unicode SMS sent to an operator that does not accept it (Bouygues Telecom).
13067 C Error, information element identifier blocked
13070 C Internal error
13071 C Internal error
13072 C Internal error
13073 C Internal error
13074 C Internal error
13075 C Internal error
13076 C Internal error
13077 C IMSI lookup blocked
13100 D Unidentified Subscriber
13101 C Facility not supported
13102 C System failure
13103 F Unexpected data value
13104 F Data missing
13105 C Equipment protocol error
13106 C Unknown service centre address
13107 C Service centre congestion
13108 C Invalid short message entity address
13109 D Subscriber not service centre subscriber
13110 D Reject
13111 D Local Cancel
13112 D Abort
13113 C Exception (internal)
13114 C Unknown error
13150 G Unknown subscriber
13151 G Call barred
13152 C Teleservice not provisioned
13153 A Absent subscriber (Expired SFR & Free)
13154 F Facility not supported
13155 A System failure (Expired SFR & Free)
13156 C Unexpected data value
13157 C Data missing
13158 H Memory capacity exceeded
13159 D Mobile subscriber not reachable
13160 D Reject
13161 D Local Cancel
13162 D Abort
13163 C Exception (internal)
13164 C Unknown error
13200 D Unidentified subscriber
13201 G Absent subscriber, IMSI detached
13202 G Absent subscriber, no page response
13203 A Subscriber busy for MT SMS (Expired Orange)
13204 F Facility not supported
13205 G Illegal subscriber
13206 H Illegal equipment
13207 C System failure
13208 C Unexpected data value
13209 C Data missing
13210 H Memory capacity exceeded
13211 H Equipment protocol error
13212 H Equipment not short message equipped
13213 D Reject
13214 A Local Cancel (Expired Bouygues)
13215 D Abort
13216 C Exception (internal)
13217 C Unknown error
13250 C Error, personal service barring, MO Personal Determined Barring White List
13251 C Error, personal service barring, MO Personal Determined Barring Black List
13252 C Error, personal service barring, MO Operator Determined Barring White List
13253 C Error, personal service barring, MO Operator Determined Barring Black List
13254 C Error, personal service barring, MT Personal Determined Barring White List
13255 C Error, personal service barring, MT Personal Determined Barring Black List
13256 C Error, personal service barring, MT Operator Determined Barring White List
13257 C Error, personal service barring, MT Operator Determined Barring Black List
13300 G Invalid destination address
13301 G Invalid destination numbering plan
13302 G Invalid destination type of number
13303 C Invalid destination flag
13304 C Invalid number of destinations
13310 C Invalid source address
13311 C Invalid source numbering plan
13312 C Invalid source type of number
13320 G ESME Receiver permanent error
13321 D ESME Receiver reject error
13322 D ESME Receiver temporary error
13330 C Invalid command length
13331 C Invalid service type
13332 C Invalid operation
13333 C Operation not allowed
13334 C Invalid parameter
13335 C Parameter not allowed
13336 C Invalid parameter length
13337 C Invalid optional parameter
13338 C Optional parameter missing
13339 C Invalid validity parameter
13340 C Invalid scheduled delivery parameter
13341 C Invalid distribution list
13342 C Invalid message class
13343 C Invalid message length
13344 C Invalid message reference
13345 C Invalid number of messages
13346 C Invalid predefined message
13347 C Invalid priority
13348 C Invalid replace flag
13349 C Request failed
13350 C Invalid delivery report request
13360 C Message queue full
13361 C Extenal error
13362 C Extenal error
13370 C Cannot find information
13399 C Unknown
13498 G Invalid desintation address (recipient/destination phone number is not valid)
13499 E An error occured during the submission of the MtRequest (SMPP)
13505 C Failed because of a network problem on the operator
13507 C Failed because of an insufficient credit (for prepaid customers)
13520 G Failed because of no matching operator for the destination number
13524 G Failed because of an invalid destination number
13588 D Failed because of mobile blocked by operator
13599 F Failed because of SMS is not allowed - For MT Premium, it is the case when Billed SMS is sent to a mobile unsubscribed.
Last updated on