Repository navigation
Answer button clicks and hide inline buttons from the bot trigger - #94
Merged
remdex merged 1 commit intoOct 14, 2026
Merged
Conversation
Telegram keeps a loading spinner on a clicked inline button until the bot calls answerCallbackQuery, so visitors click the same button again and the bot flow runs several times. - `Answer callback query` REST method (answerCallbackQuery). - `Hide inline buttons of the clicked message` REST method (editMessageReplyMarkup with an empty keyboard). Both read the click from args.chat.incoming_chat.payload_array, which now always holds the latest incoming update (livehelperchat e96276258), so they are added as Rest API actions to the trigger the button executes. No extra webhooks. check_not_empty skips them if the last update wasn't a button click. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #92, done the way you suggested: the bot trigger executed by the button answers the click itself, no extra webhooks. Possible now that
payload_arrayalways holds the latest update (LiveHelperChat/livehelperchat@e96276258).Changes
Two new methods in the
TelegramIntegrationRest API:answerCallbackQuery, stops the loading spinner on the clicked button:editMessageReplyMarkupwith an empty keyboard, so the visitor can't click the same buttons again (like in the website widget).Usage: add a
Rest APIaction with one or both methods to the trigger the button executes.check_not_emptyskips the request if the last update wasn't a button click, so the same trigger works for website chats too. Documented in README.Testing
Rendered both methods through
erLhcoreClassGenericBotActionRestapi::makeRequestagainst a local echo server:{"callback_query_id": "4122368201564890123"}and{"chat_id": 512345678, "message_id": 1842, "reply_markup": {"inline_keyboard": []}}Empty variable)Note:
main_condfrom ae1f525main_cond = message.chat.type=privateis checked against the whole update, so every update withoutmessageis now rejected. Checked withisValidCondition:callback_query)edited_messagemessage_reactionSo with the current template button clicks, edits and reactions don't reach LHC at all. Conditions in
main_condare AND-ed, so I couldn't addcallback_query.message.chat.type=privateas an alternative — I left it untouched for you to decide how you'd like to handle it.🤖 Generated with Claude Code