editEphemeralMessageCaption
Edits the caption of an ephemeral message (Bot API 10.2).
Returns: On success, returns True.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chat_id | Integer or String | Yes | Chat ID or @username |
receiver_user_id | Integer | Yes | Identifier of the user who received the message |
ephemeral_message_id | Integer | Yes | Ephemeral message ID |
caption | String | Optional | New caption (0-1024) |
parse_mode | String | Optional | HTML, Markdown, MarkdownV2 |
caption_entities | Array of MessageEntity | Optional | JSON MessageEntity array for caption |
show_caption_above_media | Boolean | Optional | Show caption above media (Bot API 10.3) |
reply_markup | InlineKeyboardMarkup | Optional | JSON: InlineKeyboardMarkup |
Example request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/editEphemeralMessageCaption" \
-H "Content-Type: application/json" \
-d '{
"chat_id": 123456789,
"receiver_user_id": 123456789,
"ephemeral_message_id": 1
}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/editEphemeralMessageCaption",
json={
"chat_id": 123456789,
"receiver_user_id": 123456789,
"ephemeral_message_id": 1
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/editEphemeralMessageCaption`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"receiver_user_id": 123456789,
"ephemeral_message_id": 1
}),
});
console.log(await res.json());
Step-by-step guide: Telegram Bot API 10.0–10.3: Rich Messages, Ephemeral Messages, Guest Mode and More
Related methods
editEphemeralMessageTextEdits the text of an ephemeral message (Bot API 10.2).editEphemeralMessageMediaEdits the media of an ephemeral message (Bot API 10.2).editEphemeralMessageReplyMarkupEdits the reply markup of an ephemeral message (Bot API 10.2).deleteEphemeralMessageDeletes an ephemeral message (Bot API 10.2).