Is there a way to get the bot to start the conversation rather than waiting for the user to enter input?

Hi. With all the Rasa stories in the examples (incl in the videos) the intents require the user to start the conversation eg.“Hi” with a greet intent.

Is there a way to get the bot to utter something first when Rasa shell first loads up?


@Jmg007 On start the SessionStart Event (see Events) is executed. It calls the ActionSessionStart. You can customize this action (see Rasa SDK) to utter something when the bot starts.

Hi @Tanja ,

I was also trying to get this to work. Do you have a working example for this?

I tried this on telegram , but dosn’t work.

Do you have a working example for this? Below is my file. I have added the class ActionSessionStart. I have also included - action_session_start in my domain.yml

from typing import Any, Text, Dict, List
    from rasa_sdk import Action, Tracker
    from rasa_sdk.executor import CollectingDispatcher
    from rasa_sdk.forms import FormAction
    from import SlotSet, SessionStarted, ActionExecuted, EventType

class ActionSessionStart(Action):
def name(self) -> Text:
    return "action_session_start"  # This name function returns the name of the custom action.Here is is action_session_start

def fetch_slots(tracker: Tracker) -> List[EventType]:
    """Collect slots that contain the user's name and phone number."""

    slots = []

    for key in ("name", "email", "pincode", "mobnumber"):
        value = tracker.get_slot(key)
        if value is not None:  # this is how to check if slot value is filled or not.
            slots.append(SlotSet(key=key, value=value))

    return slots

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    # noinspection PyProtectedMember
async def run(
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
) -> List[EventType]:

    # the session should begin with a `session_started` event
    events = [SessionStarted()]
    # # any slots that should be carried over should come after the
    # # `session_started` event
    # events.extend(self.fetch_slots(tracker))
    # # an `action_listen` should be added at the end as a user message follows

    return events

But Still it dosn’t seem to start the conversation with utter_ask_greet

I ran the command rasa run actions -p 5002 in one terminal and rasa run in another.

Using ngrok to connect to telegram.( ngrok is running in port 5005, so earlier I got error as action server can’t be started.) All telegram configutations are done and set up the bot in telegram as well.

Here are my logs…

I can’t seem to figure it out…Could you please help :slight_smile:?

Hey @Jmg007 , did you get it to work ??

I realized the above issue is actually a feature of Rasa Here.

I couldn’t really figure out how to implement it .

Guess it’s the default behaviour Rasa had in place taking security into consideration.:slight_smile:

Works fine now.