Skip to main content

Replace message caption

Replaces text in a message with media attachments

Function ReplaceMessageCaption(Val Token, Val ChatID, Val MessageID, Val Description, Val Markup = "") Export

ParameterCLI optionTypeRequiredDescription
Token--tokenStringToken
ChatID--chatString, NumberTarget chat ID
MessageID--messageString, NumberID of message to delete
Description--captionStringNew message description
Markup--parsemodeStringText processing type (HTML, Markdown, MarkdownV2)

Returns: Map Of KeyAndValue - serialized JSON response from Telegram


tip

Method at API documentation: editMessageCaption


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

Description = "New picture description";
Result = OPI_Telegram.ReplaceMessageCaption(Token, ChatID, MessageID, Description);
    oint telegram ReplaceMessageCaption \
--token "***" \
--chat "461699897" \
--message "16466" \
--caption "New picture description"
Result
{
"ok": true,
"result": {
"message_id": 16466,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titovets",
"username": "bayselonarrend",
"type": "private"
},
"date": 1757971389,
"edit_date": 1757971417,
"photo": [
{
"file_id": "AgACAgIAAxkDAAI_gmjEcD8Ow0YFkL3v_6qcv7wvQzMOAAJT9zEbbecgSr2tC0vnNP37AQADAgADcwADNgQ",
"file_unique_id": "AQADU_cxG23nIEp4",
"file_size": 1568,
"width": 90,
"height": 67
},
{
"file_id": "AgACAgIAAxkDAAI_gmjEcD8Ow0YFkL3v_6qcv7wvQzMOAAJT9zEbbecgSr2tC0vnNP37AQADAgADbQADNgQ",
"file_unique_id": "AQADU_cxG23nIEpy",
"file_size": 21633,
"width": 320,
"height": 240
},
{
"file_id": "AgACAgIAAxkDAAI_gmjEcD8Ow0YFkL3v_6qcv7wvQzMOAAJT9zEbbecgSr2tC0vnNP37AQADAgADeAADNgQ",
"file_unique_id": "AQADU_cxG23nIEp9",
"file_size": 99260,
"width": 800,
"height": 600
},
{
"file_id": "AgACAgIAAxkDAAI_gmjEcD8Ow0YFkL3v_6qcv7wvQzMOAAJT9zEbbecgSr2tC0vnNP37AQADAgADeQADNgQ",
"file_unique_id": "AQADU_cxG23nIEp-",
"file_size": 218651,
"width": 1280,
"height": 960
},
{
"file_id": "AgACAgIAAxkDAAI_gmjEcD8Ow0YFkL3v_6qcv7wvQzMOAAJT9zEbbecgSr2tC0vnNP37AQADAgADdwADNgQ",
"file_unique_id": "AQADU_cxG23nIEp8",
"file_size": 650214,
"width": 2560,
"height": 1920
}
],
"caption": "New picture description"
}
}