Telegram Bot API

sendSharedWidget

Category: Widgets · Bot API 10.5 · Official documentation

Version history: Added in Bot API 10.4

Sends again a shared widget created by the bot (Bot API 10.4).

Returns: On success, returns Message.

Parameters

ParameterTypeRequiredDescription
chat_idInteger or StringYesChat ID or @username
message_thread_idIntegerOptionalForum topic ID
widget_idStringYesShared widget ID (widget.id from the sent message)
chat_dataStringOptionalState of the widget in this chat (chat_data), 0-1024 bytes
captionStringOptionalCaption (0-1024)
parse_modeStringOptionalHTML, Markdown, MarkdownV2
caption_entitiesArray of MessageEntityOptionalJSON MessageEntity array for caption
show_caption_above_mediaBooleanOptionalShow the caption above the widget
disable_notificationBooleanOptionalSend silently
protect_contentBooleanOptionalProtect content
allow_paid_broadcastBooleanOptionalAllow paid broadcast
message_effect_idStringOptionalMessage effect ID
reply_parametersReplyParametersOptionalJSON ReplyParameters object
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReplyOptionalJSON: InlineKeyboardMarkup / ReplyKeyboardMarkup / ReplyKeyboardRemove / ForceReply

Parameter descriptions are concise summaries; see the official documentation for the full text.

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