Send text message
Sends a text message to a chat or channel
Function SendTextMessage(Val Token, Val ChatID, Val Text, Val Keyboard = "", Val Markup = "Markdown", Val RepliedID = 0) Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
Token | --token | String | ✔ | Bot token |
ChatID | --chat | String, Number | ✔ | Target chat ID or ChatID*TopicID |
Text | --text | String | ✔ | Message text |
Keyboard | --keyboard | String, Structure Of KeyAndValue | ✖ | Keyboard. See FormKeyboardFromButtonArray |
Markup | --parsemode | String | ✖ | Text processing type (HTML, Markdown, MarkdownV2) |
RepliedID | --reply | String, Number | ✖ | Reply to message ID |
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
tip
Method at API documentation: sendMessage
1C:Enterprise/OneScript code example
Token = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
ChannelID = "@testsichee";
Text = "Строковое значение";
KeyboardButtonsArray = New Array;
KeyboardButtonsArray.Add("Button1");
KeyboardButtonsArray.Add("Button2");
Keyboard = OPI_Telegram.FormKeyboardFromButtonArray(KeyboardButtonsArray, True);
Result = OPI_Telegram.SendTextMessage(Token, ChatID, Text, Keyboard);
Result = OPI_Telegram.SendTextMessage(Token, ChannelID, Text);
- Bash
- CMD/Bat
oint telegram SendTextMessage \
--token "***" \
--chat "-1001971186208*11655" \
--text "Строковое значение"
oint telegram SendTextMessage ^
--token "***" ^
--chat "-1001971186208*11655" ^
--text "Строковое значение"
Result
{
"ok": true,
"result": {
"message_id": 16463,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titovets",
"username": "bayselonarrend",
"type": "private"
},
"date": 1757971358,
"text": "Строковое значение",
"reply_markup": {
"inline_keyboard": [
[
{
"text": "Button1",
"callback_data": "Button1"
}
],
[
{
"text": "Button2",
"callback_data": "Button2"
}
]
]
}
}
}