Skip to content

Bot API 10.4: widgets - #2654

Closed
Brian-1812 wants to merge 3 commits into
eternnoir:masterfrom
Brian-1812:feat/bot-api-10.4-widgets
Closed

Brian-1812 wants to merge 3 commits into
eternnoir:masterfrom
Brian-1812:feat/bot-api-10.4-widgets

Conversation

@Brian-1812

Copy link
Copy Markdown

Description

Adds the "Widgets" part of Bot API 10.4. The other 10.4 sections are in a second PR on top of this one, so each review stays small.

  • Types: Widget, WidgetQuery, SharedWidgetQuery, WidgetQueryType (data, sign_data, sent_transaction), WidgetQueryWallet, InputWidgetMessageContent, InputSharedWidgetMessageContent.
  • TonWalletCard, TonWalletCardSticker, TonNft, TonNftAttribute, because WidgetQueryTypeData.wallet_card uses them. StoryAreaPosition can now be parsed, because the sticker position uses it.
  • Fields: Message.widget, ExternalReplyInfo.widget, Update.widget_query, Update.shared_widget_query.
  • Methods, sync and async: send_widget, send_shared_widget, answer_widget_query, edit_message_widget_data, edit_shared_widget_data.
  • Handlers: widget_query_handler, shared_widget_query_handler.

Closes #2653

Describe your tests

New unit tests parse JSON shaped like the docs, check the request payloads and send both update types to their handlers. An empty public_data is sent, because the API uses it to remove the data. cd tests && py.test: 330 passed, 73 skipped. I also ran every new method against a local fake Bot API server. I did not test against the live API.

Python version: 3.12.2

OS: macOS 26.1

Checklist:

  • I added/edited example on new feature/change (if exists)
  • My changes won't break backward compatibility
  • I made changes both for sync and async

🤖 Generated with Claude Code

Brian-1812 and others added 2 commits November 11, 2026 22:34
Add the widget part of Bot API 10.4:
- types Widget, WidgetQuery, SharedWidgetQuery, WidgetQueryType
  (data, sign_data, sent_transaction), WidgetQueryWallet,
  InputWidgetMessageContent and InputSharedWidgetMessageContent;
- TonWalletCard, TonWalletCardSticker, TonNft and TonNftAttribute,
  because WidgetQueryTypeData.wallet_card uses them;
- Message.widget, ExternalReplyInfo.widget, Update.widget_query and
  Update.shared_widget_query;
- send_widget, send_shared_widget, answer_widget_query,
  edit_message_widget_data and edit_shared_widget_data, sync and async;
- widget_query_handler and shared_widget_query_handler, sync and async.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Brian-1812 Brian-1812 mentioned this pull request Nov 12, 2026
2 of 3 tasks
- types: each :param description is on one line, like the other classes;
- answer_widget_query: use the API method names, as in the API text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Brian-1812
Brian-1812 marked this pull request as ready for review November 12, 2026 14:22
@Badiboy
Badiboy requested a balanced review from Copilot November 13, 2026 20:34

This comment was marked as low quality.

@Badiboy

Badiboy commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

One PR should be enough.

@Badiboy Badiboy closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bot API 10.4: widgets support

3 participants