SMS send
This API is used for sending SMS using ProfiSMS (billing is included in sending).
Basic description and parameters of API calls can be found on this page.
You can use testing user for testing purposes.
Service
SMS API belongs to SMS service (sms).
API request
API request must contain all general parameters.
- CTRL
-
Fixed value: sms
- msisdn
-
Comma separated list of destination numbers. Czech numbers can be without international prefix (+420), other numbers must be with international (country) prefix.
Parameter is mandatory. There must be at least one valid phone number.
- text
-
SMS text. Maximal length is 1000 characters. This parameter should contain URL in case of wappush.
System will create SMS parts automatically.
- name
-
Wappush name. This parameter has no meaning in case of text SMS.
- type
-
SMS type (text, wappush, pdu).
Default value is text.
- split
-
Default value is concat.
Parameter is only for text SMS (type text). For other types this parameter is ignored.
- delivery
-
Parameter defining that delivery report should be passed to registered address.
Use value 1, if you want to receive delivery report. You should omit this parameter or pass 0, if you do not want to receive delivery report.
- address
-
Address (URL or email) where delivery report should be passed to.
You should use this parameter if you want to receive delivery reports on other address than registered one (or you have no address registered).
If you pass both address and delivery parameters. address has precedence.
- senddate
-
Date and time when SMS will be sent. If you want to define, when SMS should be sent, pass this parameter.
Default value is empty parameter - SMS will be sent immediately.
Billing is done at the time SMS is about to be sent. It is possible that API request will be successful, but in case there are not enough credit on account, SMS will not be sent.
Valid value of this parameter is GNU date value (or PHP
strtotime()
function value).//possible values "2011-03-05 15:00:00" = 3/5/2011, 15:00 (date and time in yyyy-mm-dd hh:ii:ss format = year, month, day, hour, minute, second) "+1 hour" = in one hour "next Monday" = next Monday (v 00:00) "next Monday 15:15" = next Monday at v 15:15
- source
-
Sender's number or identifier.
Default value is empty parameter - SMS will be sent from ProfiSMS number.
Valid value can be either phone number in international format (with prefix) or text containing English letters, numbers and . and - (dot and dash). Text source can be 11 characters long. In case source is longer or contains invalid characters, such a source will be fixed by system.
If session exists, source is not used. If session is used, SMS is sent from regular MSISDN, session takes precedence.
Generally user can use only registered sources - numbers registered in user interface. If you want to use other identifiers (e.g. text one), you should contact our business department.
- currency
-
Account currency used to bill SMS. Values are listed in constants.
Default value is CZK.
- validity
-
Number of minutes this SMS is valid for.
Value represents number of minutes since SMS is passed to mobile operator (actually sent). If SMS is not delivered in this time, SMS will expire (see delivery states).
Default value is 2880 (2 days). Maximal value is 2880, minimal value is 5.
- pid
-
Random string, unique identifier of batch. Parameter has no meaning in case of sending one SMS (this API description), since this API represents one batch.
- hide_sms
-
Whether SMS should be hidden in listing.
Value 1 represents that SMS will not be listed, value 0 represents that SMS will be listed.
Default value is 0.
- userdata
- Any textual data that will be saved with SMS.
- usersource
- Any textual data. Data should represent "source" of SMS. If user for example has more communications channels, departments, etc, this parameter represents the name of such source. This source can be used for listing / filtering of SMS messages.
- session
-
System provides ability to receive response to sent SMS. If SMS is sent to particular number, this parameter is set and system receives SMS from that particular number (within one day), this SMS will be assigned to the user who sent the SMS from the system. This setting (session) is valid for the last user, who sends SMS to particular number (for each number there can only be sessions from one user).
Session can only be used without text ident,source. If session is used, SMS is sent from regular MSISDN.
- rm_diacritics
-
Parameter for Axima clients, parameter removes diacritics.
A value of 1 means that the characters will be removed, a value of 0 means that they will remain unchanged.
Value (if the parameter is not specified) is 0.
- maxFragmentsLimit
-
Parameter for Axima clients, the parameter sets a limit for fragmentation of messages stored in the database.
Value (if the parameter is not specified) is null.
API request examples
If you want to send SMS to large number of phone numbers or if you want to send long SMS,
you should use POST
protocol, since URL is limited to 2048 characters.
Response to valid API request
Basic response can be found in general API description.
Data object description
Object data contains following parameters:
- invalid
-
Array of invalid numbers. SMS is sent to all valid numbers and this array contains with invalid numbers.
If all numbers are invalid (or no destination number is passed) such a call will end up with
SMSOUTSMS_MISSING_MSISDN
error. - sms
- Array with SMS objects, see below.
- credit
- Balance on account used to bill sent SMS (after sending).
- price
- SMS sending price (without VAT). Currency is the requested one.
- pricevat
- SMS sending price (with VAT). Currency is the requested one.
- address
- Delivery report address (based on delivery or address parameters).
- partsCount
- Number of SMS parts for each SMS. Parameter does not represents all SMS parts created by this request. This value is based on valid destination numbers.
- pid
- Passed parameter pid.
Description of sms array
Object data contains sms property. This property is an array containing objects representing SMS (already sent or queued). There is an object for each valid destination number. Each SMS object has following properties:
- msisdn
- Destination phone number (formated as international).
- id
-
SMS unique identifier (it is not sequence number).
Value is a number at this point, but this parameter will change type to string in the future.
This identifier is used for passing delivery reports and for SMS informations requests.
- state
- SMS state.
- delivery
- SMS delivery state.
- queued
- Date and time SMS was queued (yyyy-mm-dd hh:ii:ss).
- delivered
- Date and time when SMS delivery state changed (yyyy-mm-dd hh:ii:ss). Regardless of delivery state (whether SMS was delivered or not).
- part
-
Array of SMS parts unique identifiers (it is not sequence number).
Values in array are numbers at this point, but will change type to string in the future.
Examples or requests and responses
Basic example of sending short SMS to one phone number.
Notice that:
- state contains queued. SMS was queued.
- delivery contains nostate. SMS was not sent at this point, there is no delivery report.
- delivered is empty. SMS was not sent at this point, there is no delivery report.
- Array part contains 1 identifier, SMS was sent as one.
Sending SMS to multiple destination numbers.
Notice that:
- Array invalid contains invalid numbers.
- Array sms contains 3 objects, each object represents one phone number.
- Array part in every SMS object contains 2 identifiers, SMS was divided to 2 parts.
Delayed SMS example.
Notice that:
- state contains inserted. SMS was inserted but not queued to be sent.
- All parameters representing billing are 0, SMS will be charged while sending .
- queued is empty, SMS is not queued yet.
- part is empty, SMS is not queued yet (there are no parts).
Response to invalid request
Description can be found in general API description.
There are several special cases:
- If at least one destination number is valid, SMS is sent to this number. No error occurred.
-
If SMS is not delayed (is to be charged with request), there must be enough credit
on account to sent SMS to all valid requested numbers, otherwise
BA_LOW_CREDIT
error is returned. - If SMS is delayed, each destination number sending is charged separately while sending. Insufficient credit while requesting does not end up with error.
Delivery reports
Delivery reports are passed in case delivery or address parameters are in request. Delivery reports are sent to email or passed to URL with additional parameters attached to identify delivery state. Delivery reports are passed/sent for whole SMS and all SMS parts (with exception described below).
Delivery reports send to email address
In case delivery report should be sent to email than:
- If SMS is sent as one (there is only one SMS part), only report for whole SMS is sent (since SMS part report would be the same).
- If there are more than 1 SMS part, email for every part is sent as parts change delivery state. And once there are delivery states for all parts, email for whole SMS is sent.
Delivery reports passed to URL
In case of delivery reports passed to URL, reports are passed for all parts and whole SMS even if SMS was sent as one (there is only one SMS part). Delivery report is passed using defined URL with additional parameters with SMS or SMS part informations (thus using GET protocol).
You can find SMS delivery states and SMS part delivery states in constant list.
In case SMS part delivery state changes, defined URL is called with parameters. In case of whole SMS, defined URL is called with parameters once all parts change their state.
Parameters passed in case of SMS part
Some passed parameters, their names and values types are inconsistent with requests parameters due to compatibility issues.
- msisdn
- Destination number.
- msg
- First 500 characters of SMS part text.
- queuetime
- Date and time when SMS part was sent (yyyy-mm-dd hh:ii:ss) sent, not just queued.
- deliveredtime
- Date and time when SMS part changed its delivery state (yyyy-mm-dd hh:ii:ss). Value can be rounded down to minutes.
- statdeliver
-
SMS part delivery state as number.
See SMS part delivery states, number represents the position in this list starting from -1.
- statdeliverstr
- SMS part delivery state as defined in constants list (as string).
- ok
- Parameter will have value 1, if SMS part is delivered (Smsout::DELIVERY_DELIVERED), 0 in other cases.
- smsid
- SMS part identifier (see part property in response when sending SMS).
- fullsmsid
- SMS identifier (see id property in response when sending SMS).
Parameters passed in case of SMS
Some passed parameters, their names and values types are inconsistent with requests parameters due to compatibility issues.
- msisdn
- Destination number.
- msg
- First 500 characters of SMS text.
- queuetime
- Date and time when last SMS part was sent (yyyy-mm-dd hh:ii:ss) sent, not just queued.
- deliveredtime
- Date and time when last SMS part changed its delivery state (yyyy-mm-dd hh:ii:ss). Value can be rounded down to minutes.
- statdeliver
-
SMS delivery state as number.
See SMS delivery states, number represents the position in this list starting from -1.
- statdeliverstr
- SMS delivery state as defined in constants list (as string).
- ok
- Parameter will have value 1, if all SMS parts are delivered (Smsout::DELIVERY_DELIVERED), 0 in other cases.
- smsid
- Fixed value 0.
- fullsmsid
- SMS identifier (see id property in response when sending SMS).
SMS sent using PDU and UDH
SMS is sent using PDU (message data) and in case of some specific messages using UDH (message type, message header).
If sending text SMS, even with diacritic, even long SMS (concatenated SMS) and wappushes, PDU and UDH will be created by system if you use API described above. But if you want to send other types of messages or you have PDU and UDH already calculated, you can send such a messages directly.
API request parameters
API for sending messages using PDU and UDH is almost the same as API descried above. If some of the standard parameters is missing in the list below, its meaning remains unchanged.
- text
- Need not to be passed, parameter is ignored.
- name
- Need not to be passed, parameter is ignored.
- type
-
Fixed value: pdu.
- encoding
-
Standard values are 7 (for text SMS without diacritic - characters from ASCII7), 16 (for text SMS with diacritic - containing characters that are not from ASCII7) and 8 (for binary SMS).
- udh
-
Message UDH.
UDH must contain bits describing its length. Parameter should be passed in hexadecimal format.
- pdu
-
Message PDU.
In case of 7 bits encoding, parameter must contain message text (plain text). In other cases, value should be passed in hexadecimal format.
Response format remain unchanged.