editMessageWidgetData
Edits the data of a widget in a message (Bot API 10.4).
Returns: On success, returns True.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chat_id | Integer or String | Optional | Chat ID (if inline_message_id is not specified) |
message_id | Integer | Optional | ID of the message with the widget (if inline_message_id is not specified) |
inline_message_id | String | Optional | Inline message ID |
public_data | String | Optional | New public state, 0-1024 bytes (empty string = remove, omitted = unchanged) |
chat_data | String | Optional | New state in this chat, 0-1024 bytes (empty string = remove, omitted = unchanged) |
Example request
curl
curl -s "https://api.telegram.org/bot$TOKEN/editMessageWidgetData"
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.get(f"https://api.telegram.org/bot{TOKEN}/editMessageWidgetData", timeout=30)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/editMessageWidgetData`);
console.log(await res.json());
Step-by-step guide: Telegram Widget Examples: Complete HTML and Python Bot Code
Related methods
sendWidgetSends a message with an HTML widget (Bot API 10.4).sendSharedWidgetSends again a shared widget created by the bot (Bot API 10.4).answerWidgetQueryAnswers a query from a widget (Bot API 10.4).editSharedWidgetDataEdits the public data of a shared widget (Bot API 10.4).