---
sidebar_position: 15
description: Replace message caption and other functions to work with Telegram in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Telegram]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Replace message caption
 Replaces text in a message with media attachments



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

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Token |
  | ChatID | --chat | String, Number | &#x2714; | Target chat ID |
  | MessageID | --message | String, Number | &#x2714; | ID of message to delete |
  | Description | --caption | String | &#x2714; | New message description |
  | Markup | --parsemode | String | &#x2716; | Text processing type (HTML, Markdown, MarkdownV2) |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Telegram

:::tip
Method at API documentation: [editMessageCaption](https://core.telegram.org/bots/api#editmessagecaption)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    Token     = "6129457865:AAFyzNYOAFbu...";
    ChatID    = "461699897";
    MessageID = "18385";

    Description = "New picture description";
    Result      = OPI_Telegram.ReplaceMessageCaption(Token, ChatID, MessageID, Description);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint telegram ReplaceMessageCaption \
             --token "***" \
             --chat "***" \
             --message "18403" \
             --caption "New picture description"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint telegram ReplaceMessageCaption ^
             --token "***" ^
             --chat "***" ^
             --message "18403" ^
             --caption "New picture description"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "ok": true,
 "result": {
  "message_id": 18403,
  "from": {
   "id": 6129457865,
   "is_bot": true,
   "first_name": "Бот Виталий",
   "username": "sicheebot"
  },
  "chat": {
   "id": 461699897,
   "first_name": "Anton",
   "last_name": "Titovets",
   "username": "bayselonarrend",
   "type": "private"
  },
  "date": 1765390316,
  "edit_date": 1765390359,
  "photo": [
   {
    "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA3MAAzYE",
    "file_unique_id": "AQAD6A9rGwABqoBJeA",
    "file_size": 1568,
    "width": "***",
    "height": 67
   },
   {
    "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA20AAzYE",
    "file_unique_id": "AQAD6A9rGwABqoBJcg",
    "file_size": 21633,
    "width": "***",
    "height": 240
   },
   {
    "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA3gAAzYE",
    "file_unique_id": "AQAD6A9rGwABqoBJfQ",
    "file_size": 99260,
    "width": "***",
    "height": 600
   },
   {
    "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA3kAAzYE",
    "file_unique_id": "AQAD6A9rGwABqoBJfg",
    "file_size": 218651,
    "width": "***",
    "height": 960
   },
   {
    "file_id": "AgACAgIAAxkDAAJGFWkwFfFE2BisPlbDM5TGPXaGd7OzAALoD2sbAAGqgEm_2MFZf9KMjgEAAwIAA3cAAzYE",
    "file_unique_id": "AQAD6A9rGwABqoBJfA",
    "file_size": 650214,
    "width": "***",
    "height": 1920
   }
  ],
  "caption": "New picture description"
 }
}
```
