RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.92k stars 4.64k forks source link

Custom welcome message #2023

Closed aourednik closed 5 years ago

aourednik commented 6 years ago
**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: ```python ... 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 ... ```
akelad commented 6 years ago

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
aourednik commented 6 years ago

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

tmbo commented 6 years ago

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.

njain51 commented 5 years ago

How to do it with rocket.chat

cyrilthank commented 5 years ago

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?

cryoff commented 2 years ago

I know this is closed but I am still interested: is it possible to make a bot to send a greeting message on a startup when using rasa shell? (same question raised here: https://forum.rasa.com/t/custom-welcome-message/12729/4)