Rasa: Custom welcome message

Created on 4 Apr 2018  路  5Comments  路  Source: RasaHQ/rasa

Rasa Core version: 0.8.5

Python version: 3.6

Operating system (windows, osx, ...): Ubuntu 16

Issue: Users often request the bot to utter something on startup, instead of being presented with an empty input. rasa-core actually provides a welcome message but it is hard-coded in console.py: "Bot loaded. Type a message and press enter: "
Would it be possible to make this message configurable?
The solution I've found is overwriting the method, but that is a lot of code to change just one element in the method:

...
from rasa_core.channels.console import * 
class MyConsoleInputChannel(ConsoleInputChannel): 
    def _record_messages(self, on_message, max_message_limit=None):
        utils.print_color("Hallo, ich bin ein ChatBot.",utils.bcolors.OKBLUE)
        num_messages = 0
        while max_message_limit is None or num_messages < max_message_limit:
            text = input().strip()
            if six.PY2:
                # in python 2 input doesn't return unicode values
                text = text.decode("utf-8")
            if text == INTENT_MESSAGE_PREFIX + 'stop':
                return
            on_message(UserMessage(text, ConsoleOutputChannel(),
                                self.sender_id))
        num_messages += 1
...

All 5 comments

This is just for the command line though, this doesn't happen when it's deployed on a channel somewhere.
You can easily have the bot say something the first time a user talks to it on a deployed channel though. e.g. if it's on Telegram, you have to start the first conversation by pressing "/start" or something similar. So you can add a story like this:

* start
    - utter_greet

Many thanks for your answer. I was wondering if my workoaround would work for other channels.
This seems to be a challenge for most chatbot frameworks (the MS bot framework has trouble with producing a welcome message, too). Yet our users say they are disoriented by an empty input in the messenger-like GUI frontend. Would you have an advice for making a story like this work?:

## a story example
    - bot_utter_greet
* start
    - utter_what_can_i_do_for_you

i.e. the bot would utter something defined in the domain as soon as the channel is opened

Usually this should be configured in the input / output channel. Nevertheless, I see the point for being able to configure an initial message of the bot when it picks up a conversation. I don't see this being integrated soon though.

The way to do it atm.: when you open a chat, send a message to the bot eg /init which is treated as the first message from the user and the bot can normally respond to it. To the user it will seem as the bot started the conversation. FB let's you easily do that.

How to do it with rocket.chat

Many thanks for your answer. I was wondering if my workoaround would work for other channels.
This seems to be a challenge for most chatbot frameworks (the MS bot framework has trouble with producing a welcome message, too). Yet our users say they are disoriented by an empty input in the messenger-like GUI frontend. Would you have an advice for making a story like this work?:

## a story example
    - bot_utter_greet
* start
    - utter_what_can_i_do_for_you

i.e. the bot would utter something defined in the domain as soon as the channel is opened

does this work on rasa-x ui?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Poojan66 picture Poojan66  路  3Comments

Jasperty picture Jasperty  路  3Comments

alonsopg picture alonsopg  路  3Comments

nikhilcss97 picture nikhilcss97  路  3Comments

nicolasfarina picture nicolasfarina  路  3Comments