How to show the output of requests.get method to user in cutom action

I have written a custom action message and calling request.get method to capture the data required using API.

I am able to get the response back on console but i am struggling to show this response to user using dispatcher.utter_message like not understanding which thing to use like text or json_message

Please help me out to understand how can we show the output of request.get method in utter_message using custom action

Hello @lelemh

You can use utter_message to send text to the user. So you could format the json data as a string and write dispatcher.utter_message(text=your_json_data_as_string). Depending on the content of your json data, you could also display buttons with dispatcher.utter_message(buttons=[{"item 1": "/select1"}, ...]) or images with dispatcher.utter_message(image=url_of_the_image). For anything else, you’d have to check what your channel supports and then write custom json messages.

thanks @j.mosig for the direction it helped and i am now able to retrieve data in string format

1 Like