# Multiple chat conversation

**URL:** <https://forum.rasa.com/t/multiple-chat-conversation/1556>\
**Category:** Rasa Open Source\
**Created:** [October 1, 2018, 3:16pm UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556 "2018-10-01T15:16:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![amsolu](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/amsolu/32/547_2.png) [@amsolu](https://forum.rasa.com/u/amsolu)\
**Post date:** [October 1, 2018, 3:16pm UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/1 "2018-10-01T15:16:53Z")

</div>

Hi, How can I handle several clients chatting with the bot and not get either in a queue or mixing conversations? Scenario: having 4 or more persons chatting thru Telegram with the bot. I am using the weather bot as a trial

Also, how should I size the server to manage the simultaneous conversations

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [October 2, 2018, 9:05am UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/2 "2018-10-02T09:05:55Z")

</div>

Rasa Core handles this out of the box

---

<div class="post-metadata">

**Author:** ![vigneshp826](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vigneshp826/32/657_2.png) [@vigneshp826](https://forum.rasa.com/u/vigneshp826)\
**Post date:** [February 13, 2019, 9:18am UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/3 "2019-02-13T09:18:08Z")

</div>

@akelad, lets assume that all the 4 users requesting bot to trigger a function at a time in actions.py which will take 3+ minutes to execute for each request, how we can queue that requests so that my bot will be freed up to respond the simple 5th user query? is it already taken care by Rasa core or i need to include RabitMQ or Celery in my actions.py?

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [February 27, 2019, 1:39pm UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/4 "2019-02-27T13:39:28Z")

</div>

if your custom action takes 3 minutes to execute then yes you may have to add some extra handling to that

---

<div class="post-metadata">

**Author:** ![vigneshp826](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vigneshp826/32/657_2.png) [@vigneshp826](https://forum.rasa.com/u/vigneshp826)\
**Post date:** [March 4, 2019, 1:27pm UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/5 "2019-03-04T13:27:23Z")

</div>

@akelad Any code snippet available? do i need to add celery in slack.py ?

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [March 6, 2019, 6:51pm UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/6 "2019-03-06T18:51:52Z")

</div>

not really sure, i’m afraid this is up to you to decide how to implement

---

<div class="post-metadata">

**Author:** ![vigneshp826](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vigneshp826/32/657_2.png) [@vigneshp826](https://forum.rasa.com/u/vigneshp826)\
**Post date:** [September 17, 2019, 4:56pm UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/7 "2019-09-17T16:56:59Z")

</div>

@akelad @erohmensing @ricwo

I have implemented asynchronous action task handler using redis and Celery setup in actions.py but with a challenge.

```auto
class Blackout(Action):
    def name(self):
        return 'action_blackout'
    def run(self, dispatcher, tracker, domain):	
        if tracker.get_slot("hostname") is None:
       
           db_or_hostname = tracker.get_slot("dbname")
        else:
            db_or_hostname = tracker.get_slot("hostname")

        usrid = slackitems(tracker)
        tgtname = db_or_hostname
        total_hours = tracker.get_slot("duration")
        comments = tracker.get_slot("blackout_comments")
        if tracker.get_slot("hostname") is None:
    
            argmnt = "database"
        else:
            argmnt = "host"
        
        final_msg = blackoutfn.delay(dispatcher,cxpassword,usrid,tgtname,total_hours,comments,argmnt)

```

With out sending dispatcher to celery `blackoutfn` function , bot can’t send message back to slack. But sending dispatcher to celery blackoutfn throwing up “kombu.exceptions.EncodeError: Object of type CollectingDispatcher is not JSON serializable”.

```auto

@celery.task(task_acks_late = True,worker_prefetch_multiplier = 1)	
def blackoutfn(dispatcher,cxpassword,usrid,tgtname,total_hours,comments,argmnt):
    
    checkpriv = BlackoutBackend(cxpassword,usrid,tgtname)
    validation = checkpriv.validate_target_privs()
    #dispatcher.utter_message("validation op")
    #dispatcher.utter_message(validation)
    
    if validation != 0:

        msg = checkpriv.run_blackout(total_hours,comments,argmnt)
        dispatcher.utter_message(msg)

```

Any idea how to convert `dispatcher` into json serializable format?

---

<div class="post-metadata">

**Author:** ![Tobias\_Wochinger](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tobias_wochinger/32/4580_2.png) [@Tobias\_Wochinger](https://forum.rasa.com/u/Tobias_Wochinger)\
**Post date:** [October 23, 2019, 9:19am UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/8 "2019-10-23T09:19:40Z")

</div>

Hi @vigneshp826,

I wouldn’t try serializing the `Dispatcher` but rather use [External Action triggers](https://rasa.com/docs/rasa/core/actions/#proactively-reaching-out-to-the-user-using-actions) to get the message back to the user. Does that make sense?

---

<div class="post-metadata">

**Author:** ![vigneshp826](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vigneshp826/32/657_2.png) [@vigneshp826](https://forum.rasa.com/u/vigneshp826)\
**Post date:** [November 14, 2019, 12:48pm UTC](https://forum.rasa.com/t/multiple-chat-conversation/1556/9 "2019-11-14T12:48:27Z")

</div>

Oh yes, it worked. I directly reached the user through slack api call. Thanks @Tobias_Wochinger
