diff --git a/rasa_core/channels/channel.py b/rasa_core/channels/channel.py index 16acb94fd27..e0b0c434625 100644 --- a/rasa_core/channels/channel.py +++ b/rasa_core/channels/channel.py @@ -68,7 +68,9 @@ def register(input_channels, # type: List[InputChannel] def button_to_string(button, idx=0): """Create a string representation of a button.""" return "{idx}: {title} ({val})".format( - idx=idx + 1, title=button['title'], val=button['payload']) + idx=idx + 1, + title=button.get('title', ''), + val=button.get('payload', '')) class InputChannel(object): @@ -178,7 +180,8 @@ def send_custom_message(self, recipient_id, elements): for element in elements: element_msg = "{title} : {subtitle}".format( - title=element['title'], subtitle=element['subtitle']) + title=element.get('title', ''), + subtitle=element.get('subtitle', '')) self.send_text_with_buttons( recipient_id, element_msg, element['buttons'])