Listen to multiple Users in group chat

Hey there! I have integrated my rasa bot into my slack channel. It works well for one user but if any member of the channel starts the conversation it only listens to that one member and ignores the rest. Can my bot interact with multiple users in one conversation?

Hi! Rasa chatbots arenā€™t supposed to handle a conversation with multiple users in it, but there are a couple of work-arounds with which you can potentially still make it work.

You could set up a custom connector and e.g. set the ā€˜sender_idā€™ depending on the channel instead of the user. The bot will then interact with all users in one conversation but without distinguishing between the users.

Or the bot could start a separate conversation for each user. It will then reply to each user as if that userā€™s messages were the only existing messages. That is what I would expect to happen by default. Is it the behaviour that you observed?

Okay, thank you a custom connector sounds good. But I have some questions:

How and where should i set a custom connector for slack up? I already looked up the examples in rasa/rasa/core/channels at master Ā· RasaHQ/rasa Ā· GitHub but i dont know

  1. if i only need a slack channel file?
  2. In which method of the slack file I should query the sender_id from slack?
  3. and how should I import the connector in the init.py file?

Hi @spokey you can customize the channel in a way similar to this

Hope that helps.

2 Likes

For how and where to set up a custom connector, see the response above by @saurabh-m523.

About your question in which method you should query the sender_id: The two places in the code where this is done in the pre-existing slack connector are

and In your custom connector, you would need to change those lines to set the ID based on the channel instead of the specific user.

2 Likes

@saurabh-m523 @chkoss thank you guys. Itā€™s working now!

2 Likes

Instead of hard coding the id you can just use this method: self.get_metadata(request).get(ā€œout_channelā€)