Format response yml for custom response for different channels

Ive spent so much time trying to format rasa responses in the domain and its not working, breaks the model training. The documentation is inconsistent. What is the correct way to format a response in the domain that has 2 channel responses, 1 with a custom payload.

It would look something like this:

domain.yml

# ... rest of domain ...
responses:
    utter_multi_channel:
      - text: "This is the default, REST channel utterance"
      - channel: "facebook"
        text: "This is the Facebook channel response"
      - channel: "telegram"
        text: "This is the Telegram channel response"
      - channel: "slack"
        text: "This is the Slack channel response"
        custom:
          someCustomKey: "someCustomValue"

# ... rest of domain ... 

See more here. Let me know if that clears things up! Something else to note is that since the domain is in YAML format, it could be an invalid file causing issues; in that case, I’d recommend pasting the domain into something like https://yamlvalidator.com/, or adding an extension to your IDE that adds YAML format support!

Thanks but the format you shared above is very different than whats shown in the documentation… very confusing… where did you get this? From reading the code? can you point me to the place in the code that would help me understand how rasa parses this… I already use a yaml linter and yaml to json converter to help me understand the payload being generated but its not helping, def an issue with rasa parsing

I tried the format you suggested and rasa is only returning the default response and not the channel response.

I got the format from the link to the docs I provided in my previous comment, specifically the Channel-specific responses. The only change I made was reordering the keys to make the different channels a little clearer, but the order doesn’t matter, since it’s a list of objects that the response has access to. Can you provide a sample of the custom payload you’re trying to send?

Hi @niveK Is it possible for rasa to send different response based on the user persona? For example, suppose I have 3 age groups of user, can I respond to each age group with different responses?

@jhzape Yes, you can handle that in a few different ways:

  • Create a categorical slot called age_group, with the 3 groups you mentioned, then create stories where that slot is set and provide the appropriate response depending on the value of age_group. The docs cover an example of that here
  • Run a custom action that calculates the users age and dispatches the appropriate response based on their age group
1 Like

Thank you @niveK. Just a guess, is there possibility that I can use different domain.yml which contain utterances for each group users? And when I retrieve the group index, the bot responds using utterances from the corresponding domain.yml. Besides, can response be organized in a hierarchical way, e.g. utter_response/group_1, utter_response/group_2? since I saw chitchat/ and faq/ functions in rasa before.

As far as hierarchical response format, I think the only option is to use your own naming conventions unfortunately. That would look something like utter_response_group_1, utter_response_group_2, etc.

There isn’t really anything that would provide that structure out-of-the-box – that being said, you can use an NLG server to abstract that on the Rasa side and create that hierarchy yourself, though you’d own the implementation of that server and the business logic for that as well.

The naming convention you mentioned only works for selectors like ResponseSelector, and would require following the training data format described in those docs.

1 Like

Hi @niveK can we set also the channel to “rasa” ( when using rasa-x ) or “rest” or it’s limited to slack, twilio, facebook…?

There’s no rasa channel AFAIK, I believe rasa-x uses the rest channel based on this. Just keep in mind whether you’re using the REST or callback channel for anything user-facing.