| SMTP protocol (E-mail)Sending a message
To send an SMS, you need to send an e-mail to the
send addresssend.smscentre.com with text in the format:
<login>:<psw>:<id>:<time>,<tz>:<translit>,<format>,<sender>,<test>:<phones>:<mes>
or:
<login>:<psw>:<id>:<time>,<tz>:<translit>,<format>,<sender>,<test>::<list>
It is possible to use our SMTP server directly. Address: send.smscentre.com. Authorization is not required.
The message must be transmitted in plain text with the encoding specified, by default koi8-r. The encoding is set in the Content-Type header
(Content-Type: text/plain; charset="CHARSET"). The maximum email size is 100 KB.
If it is not possible to transmit the text of the message with "Content-Type: text/plain", it is necessary to enclose the text in special tags "[text]message text[/text]".
Description of the parameters passed to the Server :
Option | The value
|
---|
login | Customer Login.
|
---|
psw | The Client's password (you can add or change it on this page). When an empty login field value is passed in the request, this parameter is interpreted as an API authorization key (apikey).
|
---|
phones | The number or comma-separated or semicolon-separated list of mobile phone numbers in international format
to which the message is sent. Numbers can be passed without the "+ " sign.
If the number is passed without the " + " sign, it can be corrected by automatic formatting
and converted to the correct international format. Thus, some
errors when entering phone numbers can be corrected automatically.
To disable auto-correction, pass the number with the "+ " sign.".
You can also send a message to a group of numbersby specifying a special code " G<íîìåð ãðóïïû>".
The message will be sent to all numbers belonging to this group. For an e-mail message, a list of recipients' e-mail addresses is transmitted. For telegram, it is possible to specify the subscriber's nickname or ID as the recipient of the message in the form of #ID.
|
---|
mes | The text of the message being sent. The maximum size is 1000 characters. If
necessary, the message will be divided into several SMS messages sent to the subscriber and paid separately. Size of one
SMS – 160 characters in Latin or 70 characters in Cyrillic. When splitting a message into multiple SMS
messages, a header is added to each part to combine the parts into a single message on the recipient's phone, and the maximum length becomes
67 for Cyrillic and 153 for Latin letters. You can add comments to the message text
that are intended for the sender to view the history in the personal account.
|
---|
Additional options
|
---|
id | The message ID. Assigned by the Client. Serves for further identification of the message. If not specified, it will be assigned automatically. Not necessarily unique. The identifier is a 32-bit number in the range from 1 to 2147483647, or a string up to 40 characters long consisting of Latin letters, numbers, and symbols ."-_".
|
---|
sender | The sender's name displayed on the recipient's phone.
English letters, numbers, spaces, and some characters are allowed. Length – 11 characters or 15 digits.
All names are registered in your personal account on this page.
|
---|
translit | A sign that the message you want to translate in translit.
0 (default) – do not translate into transliteration. 1 – translate to translit as " translate".
2 – translate into transliteration as " mpaHc/Ium".
|
---|
time | The time of sending the SMS message to the subscriber.
Formats:
- DDMMYYhhmm or DD.MM.YY hh.mm.
- h1-h2. Sets the time range in hours. If the current time is less than h1, the SMS message
will be sent to the subscriber when the time h1 occurs, if the current time falls in the interval from h1 to h2,
that message will be sent immediately, otherwise the message will be sent the next day when
the h1 time is reached. This function, for example, is useful in order to prevent subscribers from receiving SMS messages
at night.
- 0ts, where ts is timestamp, the time in seconds since January 1, 1970.
- +m. Sets the relative time offset from the current time in minutes. The + character must be encoded as %2B in the http request.
If time = 0 or the time already elapsed is specified, the message will be sent immediately.
|
---|
tz | The time zone in which the time parameter is set. It is indicated relative to Moscow time.
The tz parameter can be either positive or negative. If tz is equal to 0, the Moscow time zone will be used
, if the tz parameter is not set, the time zone will be taken from the Client settings.
|
---|
format | Defines the type of SMS message.
0 (default) – plain text message.
1 – flash-sms. A message displayed immediately on the phone screen.
2 – wap-push. A message containing a link to the site, the first line specifies the link, the second – the name.
3 – hlr request. Allows you to get information about the number from the operator's database without sending SMS.
4 – binary message in binary form.
5 – binary message, represented as a hexadecimal string (hex).
6 – ping-sms. Checking the number for availability by sending a special invisible SMS.
7 – mms. A message that allows you to transmit text (txt), images of various formats (jpg, gif, png),
music (wav, amr, mp3, mid) and video (mp4, 3gp).
8 – e-mail. An email message. The subject of the letter is indicated at the end of the message text through a line feed in
the form "subj:Theme". Specifying the subject, text and e-mail of the sender is mandatory.
9 – voice message (call). The voice used for voice-over is indicated at the end of the message text through a line feed in
the form of "voice:The voice." Possible types of voices are described in detail on this page.
10 – viber-a message sent to users of the Viber messenger.
11 – whatsapp is a message sent to WhatsApp messenger users.
12 – soc-a message sent to users of the Odnoklassniki, VKontakte, or Mail.Ru Agent social networks.
|
---|
test | Indicates the need to send a response message with the result of sending an SMS message.
If 0 or not specified, the response is sent only if there is an error in the parameters, if 1, the response is sent in any case.
This parameter is used for debugging during the initial configuration of the service.
|
---|
list | A list of phone numbers and their corresponding messages, separated by a colon or semicolon, and
presented as:
phones1:mes1
phones2:mes2
...
As phones, you can specify multiple phone numbers separated by commas. If you want to pass a newline character in the mes message, specify it with \n. If it is not possible to correct the text of a multi-line message, it is possible to enable a special mode for transmitting this type of message. To do this, pass a value equal to 2 in the test parameter.
The list parameter allows you to send multiple messages with different messages to multiple phones with a single
request. The messages in the request are assigned a single identifier. Some parameters (for example, subj, voice) are passed
at the end of the list message list via a line feed.
|
---|
The parameters must go strictly in the specified order. Login, psw are required,
phones and mes. If some optional parameter is missing, then the colon must remain.
Example (<id><id>, field <time><time>,<tz><tz> and field <translate><translate>,<format><format>,<sender><sender>,<test><test> are not specified):
alex:123::::79999999999:message
In the composite field <translate><translate>,<format><format>,<sender><sender>,<test><test>, any parameter can be omitted,
keeping the initial comma.
Examples:
alex: psw:::1,1, Alex:79999999999: message
alex: psw:::1:79999999999: message
alex: psw:::, 1:79999999999: message
alex: psw:::, 1, Alex:79999999999: message
alex: psw:::,1,, 1:79999999999: message
To send various types of messages you can use the special prefix at the start or instead of text messages.
Supported prefixes:
Name | Description
|
---|
__CALL__: message | Sending a voice message (call). When sending a voice message, at the end of the text, you can specify
a special combination "\n~~~\n" (line feed, 3 of the tilde character, and again line feed), after which you can pass the param parameter
that determines some characteristics of the call (for more information, see the description).
| __VIBER__: message | Sending a message to Viber messenger users.
| __SOC__: message | Sending a message to users of the social networks "Odnoklassniki", "VKontakte" or users of " Mail.Ru Agent".
| __MAIL__: message | Sending an E-mail message.
| __BOT__: message | Sending a message to Telegram chatbot users.
| __PING__ | Sending a special SMS that is not displayed in the phone to check the numbers for availability in real time by the delivery status.
| __HLR__ | A sign of the HLR-request for information about the number from the operator's database without sending real SMS.
|
If an error was made in the parameters or any other error occurred, and the test parameter was requested
for a response, it will be as follows:
- ERROR = N (description) – for 1,2,4,5,9 errors;
- ERROR = N (îïèñàíèå), ID - <id ñîîáùåíèÿ> – for 3 errors,6,7,8.
N – error number, can take the following values:
The value | Description
|
---|
1 | Error in parameters.
|
---|
2 | Invalid username or password. Also occurs when trying to send a message from an IP address that is not included in the list of allowed by the Client (if such a list was previously configured by the Client).
|
---|
3 | Insufficient funds in Customer account.
|
---|
4 | IP address is temporarily blocked due to frequent errors in the queries. read More
|
---|
5 | Invalid date format.
|
---|
6 | Denied message (by text or by sender name).
|
---|
7 | Invalid phone number format.
|
---|
8 | The message to the specified number can not be delivered.
|
---|
9 | Sending more than one identical request for the transmission of SMS messages within minutes.
|
---|
If the message is successfully accepted and the response request is requested, the test parameter returns a string of the following format:
- OK - <n> SMS, ID - <id>
Where:
<n><n> is the number of SMS sent, calculated as the number of SMS messages in the message multiplied by the number
of recipients.
<id> – the message ID sent by the Client or assigned automatically by the Server.
The server does not accept more than two identical requests for sending SMS messages within a
minute to protect against errors and loops in the Client-side program in order to reduce the load and not waste
the Client's funds, as well as to prevent multiple messages from being sent to the same subscriber.
The server also blocks sending more than 50 messages to one subscriber, which were sent with a break
between messages of less than 2 minutes, to protect against flooding and unnecessary debiting of funds from the Client's account,
since many operators do not pass a large number of messages to one subscriber in a short period of time.
Sending an HLR request
To send an HLR request, use the normal SMS message sending command, specifying format as 3.
The <mes><mes> parameter with the message text is not used and can be empty.
The result of the request can be obtained via the HTTP protocol by automatically calling the handler, or you can independently request the status
of the sent SMS message with a special command. Since the HLR request is executed asynchronously, and the result may not return from the operator immediately,
it is important to make a loop of several iterations with falling asleep (the sleep command) when requesting the status independently.).E-mail2sms functionIn the Client's personal account in "In the user settings" it is possible to specify a list of phone numbers to which
the text of emails sent to the address will be forwarded in the form of SMS messages
your_loginsend.smscentre.com.
This function can be used, for example, to receive notifications to the phone about various events from
programs or Internet services, in which it is possible to specify only the E-mail address. |