Telegram#
The following types of Telegram messages are supported:
text only;
text + link to follow.
Request to Send Telegram Messages#
Request Examples#
To generate a test request with your parameters, please
open the request generator.
1{
2 "login": "Login",
3 "password": "Password",
4 "useTimeDiff": true,
5 "id": "superId",
6 "scheduleInfo":
7 {
8 "timeBegin": "10:00",
9 "timeEnd": "12:00",
10 "weekdaysSchedule": "123"
11 },
12 "destAddr": "79211234567",
13 "message":
14 {
15 "type": "TELEGRAM",
16 "data":
17 {
18 "text": "Hello, world!",
19 "serviceNumber": "0000",
20 "ttl": 3600,
21 "ttlUnit": "SECONDS"
22 }
23 }
24}
1 {
2 "login": "Login",
3 "password": "Password",
4 "useTimeDiff": true,
5 "id": "superId",
6 "scheduleInfo":
7 {
8 "timeBegin": "10:00",
9 "timeEnd": "12:00",
10 "weekdaysSchedule": "123"
11 },
12 "destAddr": "79211234567",
13 "message":
14 {
15 "type": "TELEGRAM",
16 "data":
17 {
18 "text": "Hello, world!",
19 "link": "https://docs.rapporto.ru/",
20 "serviceNumber": "0000",
21 "ttl": 3600,
22 "ttlUnit": "SECONDS"
23 }
24 }
25 }
Parameters#
Parameter |
Required |
Data type |
Description |
|---|---|---|---|
login |
yes |
string |
Partner’s name. |
password |
yes |
string |
Partner’s password for sending messages. |
useTimeDiff |
no |
boolean |
Taking into account the time zone when starting messaging. More details
If
If
Default value: |
id |
no |
string |
Unique identifier on the Partner’s side. More detailsThis parameter is necessary for controlling repeated submissions and duplication (the control service is activated separately). The Partner can call the Service Provider (request to send a message) multiple times with the same ID. In this case, the message will be sent to the subscriber only once (on the first request). In response to the requests, the Service Provider will return the same message identifier in the Service Provider's system to the Partner (the same as for the first request). The Service Provider optionally returns this identifier to the Partner in the message delivery report if it is available. |
scheduleInfo |
no |
object |
Messaging schedule. More detailsIf not specified, it is sent immediately upon receipt of the request. |
scheduleInfo/
timeBegin
|
no |
string |
Start time. More details
For example: |
scheduleInfo/
timeEnd
|
no |
string |
End time. More details
For example: |
scheduleInfo/
weekdaysSchedule
|
no |
string |
Messaging days. More details
Specified by numbers from
For example: If there are no restrictions on days of the week, this parameter can be empty or not delivered in the request. |
scheduleInfo/
deadline
|
no |
string |
End date of the messaging. More details
For example: |
destAddr |
yes |
string |
Subscriber’s phone number. More details
It contains the country code, operator code and phone number.
For the Russian Federation, the code can be
Examples: |
message |
yes |
object |
Parameters of a message being sent. |
message/type |
yes |
enum |
Message type. More details
The value of |
message/data |
yes |
object |
Parameters of the data being sent. More details
To send only text, specify the text and
link attributes.
|
message/data/
text
|
yes |
string |
Message text. More detailsCharacter limit: no more than 1000. The text of the message can be in Cyrillic or Latin, and contain emojis. |
message/data/
link
|
no |
string |
Random URL, passed in the text of a Telegram message. More detailsCharacter limit: no more than 256.
If the link length exceeds the specified value, the message
will be rejected with an error. Error text: "The value limit of
If an empty parameter is passed, the message will be rejected with
an error. Error text: "The message is missing a value for the
|
message/data/
serviceNumber
|
no |
string |
Sender’s name from which the message is being sent. |
message/data/
ttl
|
no |
integer |
Message lifetime. More detailsAcceptable range in seconds: from 31 to 86400. Note When |
message/data/
ttlUnit
|
no |
enum |
Unit of measurement of the message delivery period. More details
It is transmitted only with Possible values are:
|
extraParam |
no |
string |
Additional parameters passed in the message. More details
Parameters are passed as
The comma character cannot be included in the parameter name,
but it can be included in its value — in this case it must be doubled
Example: the string
|
registeredDelivery |
no |
integer |
Requirement of delivery reports. More detailsSpecify whether delivery reports are required to track statuses. Possible values are:
|
notifyUrl |
no |
string |
Hostname of the incoming API to obtain the delivery report. More detailsThis parameter is optional in the request, but when sending you need to consider the following:
If any of the specified conditions are not met, an error will be generated and the request will not be executed. |
cascadeChainLink |
no |
object |
Cascading message parameters. More details |
Response#
After sending a message the Service Provider returns a response synchronously. In case of successful sending the Service Provider returns the 200 OK HTTP-code.
Successful Telegram Sending#
1 {
2 "mtNum": "7390612217"
3 "id": "8770599"
4 }
Parameter |
Data type |
Description |
|---|---|---|
mtNum |
string |
Sending chain identifier assigned by the Service Provider platform. |
id |
string |
Partner-side unique ID. Available, if it was included when sending. |
Telegram Sending Errors#
For results with errors, a response HTTP code will differ from 200 (see Error Codes).
1 {
2 "error": {
3 "code": 4,
4 "description": "Invalid request"
5 },
6 "extendedDescription": "Telegram message is absent"
7 }
In this example, there is no text in the Telegram message, but only a link is transmitted, which is an error.
Parameter |
Data type |
Description |
|---|---|---|
error |
object |
Error information. |
error/code |
int |
Error code. |
error/description |
string |
A brief description of the error. |
extendedDescription |
string |
Detailed description of the error (optional parameter). |
Error Codes#
Code |
Description |
HTTP-code |
|---|---|---|
1 |
Service is unavailable |
503 |
2 |
Invalid IP-address |
403 |
3 |
Too many connections |
429 |
4 |
Invalid request |
400 |
5 |
Invalid login |
401 |
6 |
Invalid password |
401 |
7 |
serviceNumber is not defined |
400 |
8 |
destAddr is not correct |
406 |
9 |
Message type is not correct |
406 |
10 |
Prohibited sending duplicates |
409 |
11 |
Invalid TTL |
406 |
100 |
100 |
500 |
Telegram Delivery Statuses#
To receive Telegram message statuses, you need to set up the Delivery Status Service.
Request Example#
Description of parameters is given in the paragraph Delivery Report.
1 {
2 "mtNum": "107930572",
3 "status": 9,
4 "type": "TELEGRAM",
5 "doneDate": "2024-05-05T10:20:35+0300",
6 "submitDate": "2024-05-05T10:19:55+0300",
7 "sourceAddr": "TG_NAME",
8 "destAddr": "72101234567",
9 "text": "Hello!",
10 "partCount": "001",
11 "errorCode": "0",
12 "mccMnc": "25012",
13 "trafficType": 0
14 }
Delivery Error Codes#
Delivery error codes for each message type are provided in the corresponding tab of the Description of Error Codes (parameter status=5) section.
Event Notification#
Additional parameters are intended for transmitting accurate statistics in Telegram messages.
1 {
2 "mtNum": "107930572",
3 "status": 9,
4 "type": "TELEGRAM",
5 "doneDate": "2024-05-05T10:20:35+0300",
6 "submitDate": "2024-05-05T10:19:55+0300",
7 "sourceAddr": "TG_NAME",
8 "destAddr": "72101234567",
9 "text": "Hello!",
10 "partCount": "001",
11 "errorCode": "0",
12 "mccMnc": "25012",
13 "trafficType": 0,
14 "eventType": "view",
15 "eventDate": "2024-05-05T10:30:35+0300",
16 "viewsCount": 2,
17 "clicksCount": 0
18 }
Parameter |
Required |
Type |
Description |
|---|---|---|---|
eventType |
yes |
string |
Event type. More detailsPossible values are:
|
eventDate |
yes |
string |
Date and time of the event in |
viewsCount |
yes |
integer |
The total number of displays for the message, including the current display. |
clicksCount |
yes |
integer |
The total number of clicking for the message, including the current click. |