Skip to main content

Replace message keyboard

Replaces the message keyboard with a new one

Function ReplaceMessageKeyboard(Val Token, Val ChatID, Val MessageID, Val Keyboard) Export

ParameterCLI optionTypeRequiredDescription
Token--tokenStringToken
ChatID--chatString, NumberTarget chat ID
MessageID--messageString, NumberID of message to delete
Keyboard--keyboardString, Structure Of KeyAndValueKeyboard. See FormKeyboardFromButtonArray

Returns: Map Of KeyAndValue - serialized JSON response from Telegram


tip

Method at API documentation: editMessageReplyMarkup


1C:Enterprise/OneScript code example
    Token     = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
MessageID = "16303";

ButtonArray = New Array;
ButtonArray.Add("New button 3");
ButtonArray.Add("New button 2");
ButtonArray.Add("New button 1");

Keyboard = OPI_Telegram.FormKeyboardFromButtonArray(ButtonArray, True, False);

Result = OPI_Telegram.ReplaceMessageKeyboard(Token, ChatID, MessageID, Keyboard);
    oint telegram ReplaceMessageKeyboard \
--token "***" \
--chat "461699897" \
--message "16463" \
--keyboard "{'inline_keyboard':[[{'text':'New button 3','callback_data':'New button 3'},{'text':'New button 2','callback_data':'New button 2'},{'text':'New button 1','callback_data':'New button 1'}]],'rows':'1'}"
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,
"edit_date": 1757971379,
"text": "Строковое значение",
"reply_markup": {
"inline_keyboard": [
[
{
"text": "New button 3",
"callback_data": "New button 3"
},
{
"text": "New button 2",
"callback_data": "New button 2"
},
{
"text": "New button 1",
"callback_data": "New button 1"
}
]
]
}
}
}