Utter_custom_message using rest input channel - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum

Utter_custom_message using rest input channel

post by JiteshGaikwad on May 1, 2019

I had made some changes to the channel.py file, you can get the file here: 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 save in my chat UI,

so I used the utter_custom_message as you can see below:

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

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

I hope it helps !

post by Bunny99 on Sep 20, 2019

Hey @JiteshGaikwad, 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 is 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 you please show how to do this? Thank you

post by JiteshGaikwad on Sep 20, 2019

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

post by anuragchaudhary on Jan 14, 2020

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 recipient id and custom elements the buttons and text disappears in the response.

post by JiteshGaikwad on Jan 14, 2020

Are you using rest channel?

post by anuragchaudhary on Jan 14, 2020

Yes

post by JiteshGaikwad on Jan 14, 2020

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 we need to make changes to our custom channel to send the custom object.

post by anuragchaudhary on Jan 14, 2020

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 the custom object should have both of them in single object.

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