question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Telegram buttons problem

See original GitHub issue

Rasa version: Rasa 1.1.4

Python version: Python 3.6.8

Operating system (windows, osx, …): Windows (host)

Issue: Just to further clarify, I’m using Docker instance of the Rasa’s image rasa/rasa:1.1.4-full. And I’m also using Rasa’s implemented connector for Telegram. The Rasa raises the error when it tries to send request to the Telegram to display the buttons. I’m using custom implementation of the action_default_ask_affirmation function and not the default one. This implementation was taken from the rasa-demo (link to the implementation is https://github.com/RasaHQ/rasa-demo/blob/master/demo/actions.py#L445). The only change that I’ve made is that instead of calling:

dispatcher.utter_button_message(message_title, buttons=buttons)

I’m calling:

dispatcher.utter_button_message(message_title, buttons=buttons, button_type="vertical")

In most cases Rasa works perfectly well and the buttons are correctly displayed. But in some cases the following error occurs on the Rasa server (check the error’s traceback below). Those cases are the similar as the one that works. They are similar in the sense that they try to trigger intent with some entity. By printing buttons variable I didn’t saw that anything is wrong with the JSON format.

Error (including full traceback):

2019-07-18 13:15:53 ERROR    rasa.core.channels.telegram  - Exception when trying to handle message.Button_data_invalid
[2019-07-18 13:15:53 +0000] [1] [ERROR] Exception occurred while handling uri: 'http://a063c738.ngrok.io/webhooks/telegram/webhook'
Traceback (most recent call last):
cal/lib/python3.6/site-packages/sanic/app.py", line 917, in handle_request
    response = await response
  File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/telegram.py", line 228, in message
    text, out_channel, sender_id, input_channel=self.name()
  File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/channel.py", line 75, in handler
    await app.agent.handle_message(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/rasa/core/agent.py", line 440, in handle_message
    return await processor.handle_message(message)
  File "/usr/local/lib/python3.6/site-packages/rasa/core/processor.py", line 84, in handle_message
    await self._predict_and_execute_next_action(message, tracker)
  File "/usr/local/lib/python3.6/site-packages/rasa/core/processor.py", line 350, in _predict_and_execute_next_action
    action, tracker, message.output_channel, self.nlg, policy, confidence
  File "/usr/local/lib/python3.6/site-packages/rasa/core/processor.py", line 461, in _run_action
    await self._send_bot_messages(events, tracker, output_channel)
  File "/usr/local/lib/python3.6/site-packages/rasa/core/processor.py", line 382, in _send_bot_messages
    await output_channel.send_response(tracker.sender_id, e.message())
  File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/channel.py", line 179, in send_response
    recipient_id, message.pop("text"), message.pop("buttons"), **message
  File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/telegram.py", line 92, in send_text_with_buttons
    self.send_message(recipient_id, text, reply_markup=reply_markup)
  File "/usr/local/lib/python3.6/site-packages/telegram/bot.py", line 65, in decorator
    result = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/telegram/bot.py", line 90, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/usr/local/lib/python3.6/site-packages/telegram/utils/request.py", line 309, in post
    headers={'Content-Type': 'application/json'})
  File "/usr/local/lib/python3.6/site-packages/telegram/utils/request.py", line 223, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Button_data_invalid

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bambootran89commented, Aug 23, 2019

@erohmensing we can check at this link “https://core.telegram.org/bots/api”. InlineKeyboardButton image

1reaction
bambootran89commented, Aug 13, 2019

I met a similar problem. I recognized that telegram limit payload size so we can not attach data with long text.

Read more comments on GitHub >

github_iconTop Results From Across the Web

is Telegram Filter Button Maker not working / having issues for ...
Telegram Filter Button Maker app may not be working for you due to some issues that your device may have or your internet...
Read more >
Inline keyboard buttons become unresponsive when the menu ...
Badge counters inside the app and on the app's icon may sometimes show unread messages while there are no unread chats in the...
Read more >
7 Most Common Telegram Not Working Problems and Solutions
Problem 1: Telegram Notifications Not Working · 1. Enable Telegram Notifications Settings · 2. Check Device Notifications Settings for The ...
Read more >
Problem with inline keyboard buttons : r/TelegramBots - Reddit
Problem with inline keyboard buttons. Helloooo folks. I'm trying to build a telegram bot with the API and Telegraf on the typescript, ...
Read more >
How to add buttons in telegram bot? [closed] - Stack Overflow
Edit the question to include desired behavior, a specific problem or ... to add a buttons to our telegram bot, but we are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found