Propagate a signal to the input channel

We have a question about how to best tell the input channel that it should trigger a hand-off.

First off, our setup consists of using Rasa core with the http API via the RestInput channel. This channel is connected to a custom channel that in turn connects to our messenger service.

Now assume that a user wants to trigger a hand-off, we have to communicate this information to our channel. However, as far as I can tell, RestInput only returns a text and a couple of special elements (e.g. buttons). How would we convey the information that a hand-off should be triggered?

What we did so far:

We thought about using a special button that contains the information that a hand-off must be triggered. This doesn’t seem to be very elegant but oh well. Then we have the challenge how to inject the button into the message. Is there a way to do that without using a special template in the domain.yml? Ideally, we would like to send an event through the action server that signals that contains this information. Is that possible?

Hi Benjamin,

yes, this is definitely possible :slight_smile: If you want to send custom information to Rasa Core I suggest to write a custom channel which can process your additional information and pass it on to your messenger service. From the action server you could for example use utter_custom_message to pass extra data to your OutputChannel which then in turn sends this information to your messenger service.

Thanks for the reply.

From the action server you could for example use utter_custom_message to pass extra data to your OutputChannel which then in turn sends this information to your messenger service.

Our action server is not written in Python. We really hopedto avoid having to re-implement dispatcher etc. on the action server side (unlike the Python SDK). Is it possible to do what you suggested without reimplementing too much?

The current solution is that we have a special “handoff” event that all actions that need it can add to the list of returned events. The action server then translates this into a special “trigger-handoff” button. Since rasa_core is able to handle buttons, this button is passed through to the input channel, which in turn knows that this must trigger a handoff. Is there a more elegant solution?

There should not be required a lot of re-implementation. I guess your action server is currently return something a response similar to this one to Rasa Core, right?

{
    "text": "hey there",
    "buttons": [],
    "image": null,
    "elements": [],
    "attachments": []
}

To mimic utter_custom_messages, just include your additional information as dictionary to the attachments list, e.g.:

{
    "text": "hey there",
    "buttons": [],
    "image": null,
    "elements": [{"should_trigger_handoff": true}],
    "attachments": []
}

You can then overwrite send_custom_message in your custom channel, to check whether a dictionary with should_trigger_handoff is present, and depending on that tell your input channel that it should do a handoff.

Okay, thanks, I will look into this.

@benjamin-work Any news?

We have a working solution using buttons that allowed us not to have to write custom input or output channels.