sendSharedWidget
Sends again a shared widget created by the bot (Bot API 10.4).
Returns: On success, returns Message.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chat_id | Integer or String | Yes | Chat ID or @username |
message_thread_id | Integer | Optional | Forum topic ID |
widget_id | String | Yes | Shared widget ID (widget.id from the sent message) |
chat_data | String | Optional | State of the widget in this chat (chat_data), 0-1024 bytes |
caption | String | Optional | 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 the caption above the widget |
disable_notification | Boolean | Optional | Send silently |
protect_content | Boolean | Optional | Protect content |
allow_paid_broadcast | Boolean | Optional | Allow paid broadcast |
message_effect_id | String | Optional | Message effect ID |
reply_parameters | ReplyParameters | Optional | JSON ReplyParameters object |
reply_markup | InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | Optional | JSON: InlineKeyboardMarkup / ReplyKeyboardMarkup / ReplyKeyboardRemove / ForceReply |
Example request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendSharedWidget" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"widget_id":"WIDGET_ID"}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/sendSharedWidget",
json={
"chat_id": 123456789,
"widget_id": "WIDGET_ID"
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendSharedWidget`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"widget_id": "WIDGET_ID"
}),
});
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).answerWidgetQueryAnswers a query from a widget (Bot API 10.4).editMessageWidgetDataEdits the data of a widget in a message (Bot API 10.4).editSharedWidgetDataEdits the public data of a shared widget (Bot API 10.4).