Hello everyone, i am currently on learning phase and i was trying to implement custom json templates for buttons and payloads with images and i am not getting answer as expected.
For the function i have written:
class action_book_room(Action):
def name(self) -> Text:
return "action_book_rooms"
def run(self,dispatcher:CollectingDispatcher,tracker:Tracker,domain:Dict[Text,Any]) -> List[Dict[Text,Any]]:
print("hi")
gt = {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Deluxe Room",
"subtitle": "These Deluxe Rooms let you relax as you admire a beautiful view of the pool. Stay connected as you enjoy our free WiFi and watch movies with our 32-inch LCD TV and DVD player.",
"buttons": [
{
"type": "postback",
"payload": "/deluxe_room_details",
"title": "Read More"
},
{
"type": "postback",
"payload": "/book_room_now",
"title": "Book Now"
},
]
},
{
"title": "Junior Suite",
"subtitle": "Large bedroom with exquisitely embroidered queen or king size bed. Elegant, luxury decor with rich fabrics. Separate sitting room with sofa and armchairs.",
"buttons": [
{
"type": "postback",
"payload": "/junior_suite_details",
"title": "Read More"
},
{
"type": "postback",
"payload": "/book_room_now",
"title": "Book Now"
},
]
},
{
"title": "Club Suite",
"image_url":"https://media-cdn.tripadvisor.com/media/photo-s/12/77/d8/18/club-suite-living-room.jpg",
"subtitle": "The Club Suite is the ideal choice for a comfortable and lavish stay for both small families and business travelers alike. The gently soothing views and the calming ambiance of the suite add to an enriching experience for our guests.",
"buttons": [
{
"type": "postback",
"payload": "/club_suite_details",
"title": "Read More"
},
{
"type": "postback",
"payload": "/book_room_now",
"title": "Book Now"
},
]
},
]
}
}
}
dispatcher.utter_message(json_message=gt)
return []
`
I am getting output as above.
But what i was looking is .
Please help me what i am missing as i am not finding the proper documentation for this as well.
Here are my complete files: stories.md (374 Bytes) nlu.md (3.6 KB) domain.yml (4.1 KB) config.yml (671 Bytes) actions.py (6.8 KB)