# Chatroom let the bot start the conversation?

**URL:** <https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738>\
**Category:** Rasa Open Source\
**Created:** [November 16, 2018, 5:26pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738 "2018-11-16T17:26:27Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![e8180kimo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/e8180kimo/32/364_2.png) [@e8180kimo](https://forum.rasa.com/u/e8180kimo)\
**Post date:** [November 16, 2018, 5:26pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/1 "2018-11-16T17:26:27Z")

</div>

I am using chatroom platform for the RASA bot. Although it can set a welcome message to the user, the user still has to say something like “hi” to start the conversation.

I am wondering if there is a way for the bot start the conversation instead?

---

<div class="post-metadata">

**Author:** ![e8180kimo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/e8180kimo/32/364_2.png) [@e8180kimo](https://forum.rasa.com/u/e8180kimo)\
**Post date:** [November 21, 2018, 4:55am UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/2 "2018-11-21T04:55:54Z")

</div>

anyone knows?

---

<div class="post-metadata">

**Author:** ![ElenaBenito](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/elenabenito/32/2236_2.png) [@ElenaBenito](https://forum.rasa.com/u/ElenaBenito)\
**Post date:** [March 12, 2019, 12:38pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/3 "2019-03-12T12:38:32Z")

</div>

Hi! We have a rasa chatbot on a web page using chatroom too, and have the same problem. did you solve it? I’ve found this [chatroom/index.html at master · scalableminds/chatroom · GitHub](https://github.com/scalableminds/chatroom/blob/master/index.html) I’m not sure if putting the text (and if possible buttons) in the welcomeMessage it would appear first in the conversation thanks for helping!

---

<div class="post-metadata">

**Author:** ![Remy](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/remy/32/2030_2.png) [@Remy](https://forum.rasa.com/u/Remy)\
**Post date:** [March 12, 2019, 3:10pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/4 "2019-03-12T15:10:24Z")

</div>

You should set up the chat room to automatically send the ‘hello’ intent (or however you’re calling your greet intent) once the chatroom activates.

---

<div class="post-metadata">

**Author:** ![netcarver](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/netcarver/32/1147_2.png) [@netcarver](https://forum.rasa.com/u/netcarver)\
**Post date:** [March 12, 2019, 3:16pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/5 "2019-03-12T15:16:25Z")

</div>

The rasa-webchat component from mrbot-ai allows you to specify the initial intent payload to send to your bot. The example in the [readme page](https://github.com/mrbot-ai/rasa-webchat/#in-a-script-tag) show it set as follows…

```
initPayload: "/get_started",
```

---

<div class="post-metadata">

**Author:** ![rishier827](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rishier827/32/6957_2.png) [@rishier827](https://forum.rasa.com/u/rishier827)\
**Post date:** [March 19, 2020, 4:00pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/6 "2020-03-19T16:00:15Z")

</div>

@e8180kimo did you got answer

---

<div class="post-metadata">

**Author:** ![rishier827](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rishier827/32/6957_2.png) [@rishier827](https://forum.rasa.com/u/rishier827)\
**Post date:** [March 19, 2020, 4:04pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/7 "2020-03-19T16:04:07Z")

</div>

> [@Remy](#):
>
> hello

except intent can i use template from domain.yml

---

<div class="post-metadata">

**Author:** ![niveK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nivek/32/13710_2.png) [@niveK](https://forum.rasa.com/u/niveK)\
**Post date:** [March 19, 2020, 10:00pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/8 "2020-03-19T22:00:16Z")

</div>

You need to send `/session_start` as the initial payload for your custom chat channel, then you can hook into the default [`action_session_start`](https://rasa.com/docs/rasa/api/rasa-sdk/#custom-session-start). You can then enter a `dispatcher.utter_message()` in the `run` function to send a message to the user “proactively”.

---

<div class="post-metadata">

**Author:** ![\_sanjay\_r](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_sanjay_r/32/4451_2.png) [@\_sanjay\_r](https://forum.rasa.com/u/_sanjay_r)\
**Post date:** [April 14, 2020, 7:54pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/9 "2020-04-14T19:54:31Z")

</div>

Hey @niveK ,

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

Do you have a working example for this? Below is my actions.py 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 rasa_sdk.events 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

@staticmethod
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
    tracker._reset()
    
async def run(
        self,
        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
    dispatcher.utter_message(template="utter_greet_ask")
    events.append(ActionExecuted("action_listen"))
    #

    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. All telegram configutations are done and set up the bot in telegram as well.

Here are my logs…

1. 

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/697b5d07e425e19db5b024d98aefd62b8596a543.png)

1. 

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/65ba334b0feb2013f81e84b5261e8016c13000ca.png)

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

---

<div class="post-metadata">

**Author:** ![niveK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nivek/32/13710_2.png) [@niveK](https://forum.rasa.com/u/niveK)\
**Post date:** [April 14, 2020, 8:42pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/10 "2020-04-14T20:42:54Z")

</div>

I don’t think it’s possible on telegram to have the bot start the conversation, but I did notice that in your `run` action you’re using `utter_greet_ask` instead of `utter_ask_greet` in the `ActionSessionStart.run()` like you mentioned.

Also, I’m not sure if it was because of the way it pasted the python code in your comment, but it looks like you have some indenting issues in the class, which might be why it’s not finding the action by name.

---

<div class="post-metadata">

**Author:** ![\_sanjay\_r](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_sanjay_r/32/4451_2.png) [@\_sanjay\_r](https://forum.rasa.com/u/_sanjay_r)\
**Post date:** [April 15, 2020, 6:22am UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/11 "2020-04-15T06:22:53Z")

</div>

Hey @niveK ,

The indentaion in the class file is proper , I have verified …like you said it was because of the pasting issues 😅 in the comment.

Here is my github repo:

> **[GitHub - sanjayrjs16/covid\_info\_bot: Simpe bot made with rasa to give info...](https://github.com/sanjayrjs16/covid_info_bot)**
>
> Simpe bot made with rasa to give info during covid pandemic. - GitHub - sanjayrjs16/covid\_info\_bot: Simpe bot made with rasa to give info during covid pandemic.

Could you have a look ??

So, for telegram starting a convo by bot is out of the question 🤔??

---

<div class="post-metadata">

**Author:** ![niveK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nivek/32/13710_2.png) [@niveK](https://forum.rasa.com/u/niveK)\
**Post date:** [April 15, 2020, 7:39am UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/12 "2020-04-15T07:39:26Z")

</div>

Alright, so for the `action_session_start` not triggering, it was because you needed to retrain a new model after overriding the default `action_session_start`. Everything else with `action_session_start` looked good fine

As for the Telegram question it seems [others](http://forum.rasa.com/t/rasa-auto-greeting/4154/2) have mentioned this as part of the functionality – I haven’t used Telegram all that much, so I can’t say for sure, but from a quick search around, telegram might send `/start`? If that’s the case, you have to add this to your `domain.yml`'s `intents`:

```auto
- start:
    triggers: action_session_start

```

as well as a matching story:

```auto
## telegram sends start message (mapped action)
* start
    - action_session_start

```

Take that with a grain of salt, though, I’m not 100% sure that’s how Telegram handles it, so YMMV.

---

<div class="post-metadata">

**Author:** ![\_sanjay\_r](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_sanjay_r/32/4451_2.png) [@\_sanjay\_r](https://forum.rasa.com/u/_sanjay_r)\
**Post date:** [April 15, 2020, 9:47am UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/13 "2020-04-15T09:47:10Z")

</div>

Hey @niveK ,

Thanks a bunch man, it worked.

You can’t make a bot initiate a convo in telegram, has to start with a `/start` sent by the user.

So I just added the below to my domain.yml.

```auto
- start:
    triggers: utter_bot_function

```

I tried removing the whole `ActionSessionStart` class and have the default `action_session_start` and it works the way I want. That’s a workaround for telegram.

But the issue of bot not reponding first in normal `rasa run actions -p 5002 & rasa shell --debug ` command, is still not solved. Here is my logs :

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/a/af7f0a1924b0407dc75b1093c0ffd13b0fd1f0a5.png)

It still works and replies, but dosn’t start the conversation. Any thing I might be missing ?

Thanks, Cheers.

---

<div class="post-metadata">

**Author:** ![niveK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nivek/32/13710_2.png) [@niveK](https://forum.rasa.com/u/niveK)\
**Post date:** [April 15, 2020, 5:46pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/14 "2020-04-15T17:46:12Z")

</div>

I believe by default, the bot will not “start” (as in run the `action_session_start`) the conversation in `rasa shell` unless you explicitly send a message `/session_start`. Sessions don’t begin unless [Rasa is receives an event](https://rasa.com/docs/rasa/core/domains/#session-configuration).

In the docs you’ll see that there’s no proactive action that Rasa takes, unless triggered by an external event, so you won’t see the bot do anything in `rasa shell` until you send a message or send the slash command `/session_start`. It might be a good idea for this to be added as a behavior in a PR!

Let me know if that’s confusing!

---

<div class="post-metadata">

**Author:** ![\_sanjay\_r](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_sanjay_r/32/4451_2.png) [@\_sanjay\_r](https://forum.rasa.com/u/_sanjay_r)\
**Post date:** [April 15, 2020, 5:59pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/15 "2020-04-15T17:59:09Z")

</div>

Thanks for the Quick reply .

I understand now. Rasa won’t start unless you sent a `/session_start`. So, the option is to configure the UI or channel to do that explicitly , so that the action is run.

That helps a lot.🙂

Thanks you.

---

<div class="post-metadata">

**Author:** ![niveK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nivek/32/13710_2.png) [@niveK](https://forum.rasa.com/u/niveK)\
**Post date:** [April 15, 2020, 6:12pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/16 "2020-04-15T18:12:40Z")

</div>

Just created an issue for this [here](https://github.com/RasaHQ/rasa/issues/5641) since I think others might have similar confusion!

---

<div class="post-metadata">

**Author:** ![\_sanjay\_r](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_sanjay_r/32/4451_2.png) [@\_sanjay\_r](https://forum.rasa.com/u/_sanjay_r)\
**Post date:** [April 15, 2020, 6:56pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/17 "2020-04-15T18:56:46Z")

</div>

Cool man, it’ll be cool if Rasa had that.

That can be helpful. Maybe they designed it this way might have designed it with a bigger picture in mind. Maybe for security or something…

Someone commented in the below the issue.

---

<div class="post-metadata">

**Author:** ![\_sanjay\_r](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_sanjay_r/32/4451_2.png) [@\_sanjay\_r](https://forum.rasa.com/u/_sanjay_r)\
**Post date:** [April 18, 2020, 10:20am UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/18 "2020-04-18T10:20:19Z")

</div>

Hey @niveK ,

I need a bit guidance again. This is a totally different issue. So my apologies for coming out of nowhere.

But basically,

I have an image in my project directory. My bot is hosted on telegram via ngrok.

I have a custom action, to display the image as well. I tried using `

`dispatcher.utter_message(image="/p1.png")`

` But it dosn’t display the image.

What path do I give to display the image?

Thanks

Cheers

---

<div class="post-metadata">

**Author:** ![niveK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nivek/32/13710_2.png) [@niveK](https://forum.rasa.com/u/niveK)\
**Post date:** [April 18, 2020, 4:31pm UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/19 "2020-04-18T16:31:47Z")

</div>

Images are intended to be just special hyperlinks that sometimes get rendered by the channel, spending on support. You’d want to just upload the image to a hosting site like Cloudinary and replace the path with a link.

---

<div class="post-metadata">

**Author:** ![\_sanjay\_r](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_sanjay_r/32/4451_2.png) [@\_sanjay\_r](https://forum.rasa.com/u/_sanjay_r)\
**Post date:** [April 19, 2020, 7:21am UTC](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738/20 "2020-04-19T07:21:03Z")

</div>

Thanks for your help.

I used Imgur to solve the issue, it works now.

[Next page](https://forum.rasa.com/t/chatroom-let-the-bot-start-the-conversation/2738.md?page=2)
