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=12025550123 You can specify several recipients' numbers separated by commas. The maximum number of phone numbers per call: 150. Example: phone=12025550123,12025550145 |
| 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 1,000 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: | |
| phone | The recipient's phone number, exactly as passed in the request. |
| sms_id | Unique numeric message code. Each phone number gets one ID, even if the message is split into multiple parts. Pass this ID to the checkSms method to get the message status, price, and other details. |
| price | Deprecated. Always returns 0. The actual price is calculated when the message is sent, not when you call sendSms. We keep this field so existing integrations don’t break. To get the actual price, use the checkSms method after the message is sent. |
| currency | Deprecated. Always returns USD. We keep this field so existing integrations don’t break. To get the actual currency, use the checkSms method. |
Examples of the return value:
{"result":{"sms_id":142460906,"phone":"12025550123","price":0,"currency":"USD"}}
|
|
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=12025550123&sender=MyCompany&text=Hello,+World!
— send the message "Hello, World" to the number +12025550123 with the sender's name MyCompany.