How to let bot speak first

How to let the bot speak first, instead of waiting for the user to say it before replying as follow start conversation: bot: Can i help you? user:

One possible approach is as following. I assume you speak to your bot from a command line (not through a web interface).

from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig
from rasa_core.run import serve_application
import rasa_core

def talk():
    agent = Agent.load('./models/dialogue',
        interpreter=RasaNLUInterpreter('./models/nlu/default/so_health/'),
        action_endpoint=EndpointConfig(url="http://172.17.0.3:8080/"))


    print("Hi dude! I'm a bot. How can I help you? ")
    while True:
        a = input()
        if a == 'stop':
            break
        responses = agent.handle_message(a)
  
        for response in responses:
            print(response["text"])


talk()

You have to have the backend send a first message to the bot (e.g. /greet) when the user clicks to start the conversation with the bot. Facebook does this automatically for example, by having the “get startd” button

Hi akelad,

Do you have an idea how slalck can do this (send me message when user clic on the bot bouton on slack)

Thank you

Sorry not sure, you would have to check their documentation