Rasa 2.0: channel-specific response does'nt work for custom channel

We implemented a custom channel over RestInput and expected to use channel-specific response. But we could’nt get it. Solution from simular topics ( OutputChannel has to overwrite the name() function) unfortunatly did’nt help us.

credentials.yaml :

 rest:
 rasa.core.channels.myio.MyioInput:

domain.yml :

responses:
  utter_greet:
  - channel: "rest"
    text: "Hello, REST"
  - channel: "myio"
    text: "Hello, MYIO"
  - text: "Hello, default"

The connector implementation is basically identical to rasa.core.channels.channel.RestInput :

class MyioInput(InputChannel):
    @classmethod
    def name(cls) -> Text:
        return "myio"

    @staticmethod
    async def on_message_wrapper...

class MyioOutput(CollectingOutputChannel):
    @classmethod
    def name(cls) -> Text:
        return "myio"

But we have always not specific response:

[
    {
        "recipient_id": "user",
        "text": "Hello, default"
    }
]

What do I do wrong?

Hi there, the output channel attached to the message doesn’t come from the name directly. So it is still attaching the default CollectingOutputChannel here: rasa/rest.py at master · RasaHQ/rasa · GitHub

The response is chosen by the name of the output channel though, so that’s why you want to switch it. So I think you want to replace that line with

collector = MyioOutput()

Thank you! It really helped :slight_smile:

1 Like