I am starting with rasa and I want to make a chatbot that starts talking before the user, I attach an example:
Bot: Hello, how can I help you?
User: Hello, what time is it?
Bot: It's 5:23 p.m.
I know how to make the user write first but I don’t know how to do it the other way around. I have been looking for information and saw this link: https://forum.rasa.com/t/how-to-let-bot-start-the-conversation/20866/5 but it is still up to the user to write first
I’ve this:
stories.yml:
- story: greet
steps:
- action: action_utter_supply_greet_user
- intention: greet
.... (continues)
actions.py:
class ActionGreetUser(Action):
def name(self) -> Text:
return "action_utter_supply_greet_user"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
dispatcher.utter_message("Hello! How can I help you?")
return[UserUtternanceReverted()]
domain.yml:
actions:
- action_utter_supply_greet_user
What’s wrong? How can I do it?
Thanks!
Use the /execute rasa endpoint. Or, if you will connect your bot to messaging channel, then try to use those APIs. Example to set up greeting message for Facebook Messenger channel:
from fbmessenger import BaseMessenger
from fbmessenger.thread_settings import GreetingText, GetStartedButton
APP_SECRET = os.environ['APP_SECRET']
PAGE_ACCESS_TOKEN = os.environ['PAGE_ACCESS_TOKEN']
messenger = BaseMessenger(page_access_token=PAGE_ACCESS_TOKEN, app_secret=APP_SECRET)
greeting_text = GreetingText('Hi! how can I help you?')
get_started = GetStartedButton(payload='/get_started')