It is a method for easy sending the one SMS to one or several recipients.
Maximum number of numbers to send SMS: 150 per call.
Principle of use
Syntax and URL to call the method |
sendSms (string phone, string sender, string text) |
Example with a single phone number: https://api.selzy.com/en/api/sendSms?format=json&api_key=KEY&phone=TO&sender=FROM&text=TEXT |
Example with several phone numbers: https://api.selzy.com/en/api/sendSms?format=json&api_key=KEY&phone=PHONE1,PHONE2&sender=FROM&text=TEXT |
Arguments | |
api_key * | API access key. |
phone * | Recipient's phone number in the international format with the country code (the initial «+» may be omitted). Example:
phone=79092020303 You can specify several recipients' numbers separated by commas. The maximum number of phone numbers per call: 150. Example: phone=79092020303,79002239878 |
sender * | Sender – registered sender name (alpha name). A string can contain from 3 to 11 Latin letters or figures and letters. Special characters, such as dot, hyphen, dash and some others, can also be used.
To send an SMS message, the alpha name must be registered according to the procedure. Example: sender=MyCompany |
text * | Message text, up to 1000 characters. Type substitution characters are ignored. Example:
text=Hello,+it's+a+test+message text=SMS-%D1%81%D0%BE%D0%BE%D0%B1%D1%89% D0%B5%D0%BD%D0%B8%D0%B5%2C |
Return value | |
In the case of sending to one number, the return value is a JSON object. If multiple phone numbers are specified, the return value is an array of JSON objects. Fields making up a JSON object: | |
currency | Three-letter international currency code, in which the message price was calculated (USD). The currency matches your account currency (USD, EUR, UAH). |
price | Price in the currency, number with decimal point. |
sms_id | Unique numeric message code. It can be used to control the delivery using the checkSms method. |
When this method is called, its specific error codes can be returned:
Error codes | |
dest_invalid | Delivery is impossible, the recipient's phone number is incorrect. |
src_invalid | Delivery is impossible, the sender argument (the sender field) is incorrect. |
invalid_arg | Delivery is impossible, the sender argument is incorrect (alpha name is not registered). |
has_been_sent | SMS has already been sent to this recipient The allowed interval between two sendings is 1 minute. |
unsubscribed_globally | The recipient has been unsubscribed globally. |
Example of forming the URL request
https://api.selzy.com/en/api/sendSms?format=json&api_key=KEY &phone=79998887766&sender=MyCompany&text=Hello,+World!
— send the message "Hello, World" to the number +7999887766 with the sender's name MyCompany.