I am using a custom action to generate a dynamic array of buttons and while this works as expected using other output channels, I receive the following exception when this exchange is made using a rocketchat endpoint:
[2019-07-10 10:18:58 +0000] [1] [ERROR] Exception occurred while handling uri: 'http://rasa:5005/webhooks/rocketchat/webhook'
Traceback (most recent call last):
File "/usr/local/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/rocketchat.py", line 151, in webhook
await self.send_message(text, sender_name, recipient_id, on_new_message)
File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/rocketchat.py", line 128, in send_message
await on_new_message(user_msg)
File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/channel.py", line 65, in handler
await app.agent.handle_message(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/rasa/core/agent.py", line 448, 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 460, 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 169, in send_response
recipient_id, message.pop("text"), message.pop("buttons"), **message
File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/rocketchat.py", line 67, in send_text_with_buttons
button_attachment = [{"actions": self._convert_to_rocket_buttons(buttons)}]
File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/rocketchat.py", line 30, in _convert_to_rocket_buttons
for b in buttons
File "/usr/local/lib/python3.6/site-packages/rasa/core/channels/rocketchat.py", line 30, in <listcomp>
for b in buttons
KeyError: 'payload'
and the relevant code snippet:
srv = client.service_check()
buttons = []
for host in srv:
buttons.append({"title": host["name"], "payload": host["name"]})
dispatcher.utter_button_message(
"On which hosts should I {} the {} service?".format(state, service), buttons
)
return []
I can’t find any outstanding issues related to this. Any help would be appreciated.
Thanks in advance