Utter_custom_message using rest input channel

I had made some changes to the channel.py file, you can get the file here: https://github.com/JiteshGaikwad/rasa_customChannel/blob/master/channel.py

so how it works, I wanted to send some custom JSON data from custom action which I was not able to send using utter_custom_message so I had made changes to channel.py since I am using Rest channel, so the changes are:

so after making the above changes below are the result, which I was expecting and it worked:

so I had the below json data of restaurant that I wanted to same in my chat UI,

so I used the utter_custom_message as you can see below:

image

and then when my custom action executed I got the above json data in the response as expected:

so i can easily process my cutsom message or any json data that I want to send from my custom actions.

I hope it helps :wink: :slight_smile:

Hey @ JiteshGaikwadJG I am creating a chat ui using this link GitHub - JiteshGaikwad/Rasa_CustomUI-v_2.0: Custom UI for Rasa. it’s working also good.

My code like this

     def run(self, dispatcher, tracker, domain):
         gt = {
            "attachment": {
            "type": "template",
            "payload": {
                "template_type": "generic",
                        "elements": [
                             {
                                "title": "Debit Card",
                              "image_url":"https://www.yesbank.in/squareimages/YES%20Premia%20Debit%20Card_1027x656.png",
                        "buttons": [
                            {

                                "title": "Debit Card",
                                "payload": "/greet"
                            }
                        ]
                    },
                    {
                        "title": "Credit Card",
                        "image_url": "https://www.bajajfinserv.in/Platinum_Choice_SuperCard_image_SuperCARD-Blue.png",
                        "buttons": [
                            {

                                "title": "Credit Card",
                                "payload": "/greet"
                            }
                        ]
                    }
                ]
            }
        }
    }
    dispatcher.utter_custom_json(gt)
    return[]

But in my chat window it is not responding. generally what i want is in chat ui i want a carousel type. can u please how to do this? Thank you

Hey @Bunny99, you handle this in front end using css

Hey @JiteshGaikwad Is it possible to render all text, buttons and custom all at once in our custom channel inside one response . Currently if I use custom after text and buttons. the response is only receipent id and custom elements the buttons and text disappears in the response.

So is there any way it is achievable to define utter template for our own channel to get the “- text” and "- custom’ all at once.

Is your question w.r.t domain.yml?

Yes. currently when I make changes in the domain.yml. So which file of rasa to define or change the utter template for our own channel to get the “- text” and "- custom’ all at once. although I have checked channel specific utterances in the docs to send “- custom” to my UI but it “channel” key is only reponding with text.

are you using rest channel?

Yes

hi @anuragchaudhary, I checked according to what you had explained and this is what I found:

domain.yml :

API Response:

I am getting the response as two different objects and not all in one single object. So I think so we need to make changes to our custom channel to send the custom object.

Yes exactly, we need to make changes to our custom channel to send custom object. But if we make changes in our domain.yml the assistant won’t respond in fb messenger. So we need to make sure that custom object should have both of them in single object.

ultimate goal is to make the same assistant work on multiple channels.

Do you have any idea about channel specific utterances.

Hey @anuragchaudhary, I haven’t done that yet but I will try sending channel specific responses and let you know. :slight_smile:

1 Like