This card carousel code is working, however when I press the button “See Menu” I would like the code to store the restaurant name in the slot. So far that has not worked.
I get this error:
UserWarning: Failed to parse arguments in line ‘/ask_chosen_restaurant_name_en{“chosen_restaurant_name_en”:restaurant_details_en[0]}’. Failed to decode parameters as a json object. Make sure the intent is followed by a proper json object. Error: Expecting value: line 1 column 30 (char 29) More info at Stories
This is the code please let me know what the error is, I have been trying for the past week and still no result.
Action file:
gt = { "attachment": { "type": "template", "payload": { "template_type": "generic", "elements": [ ] } } } for restaurant_details_en in all_restaurant_details_en: dict_card = {} dict_card['title'] = restaurant_details_en[0] ##restaurant name dict_card['image_url'] = restaurant_details_en[1] ##restaurant image dict_card['subtitle'] = city_loc_en + ", "+ restaurant_details_en[3] + ", "+ restaurant_details_en[4] + "\nRating: " + restaurant_details_en[8] ## First part shows the entire address and second part shows the rating dict_card['default_action'] = {} dict_card['default_action']['type'] = 'web_url' dict_card['default_action']['url'] = restaurant_details_en[11] ## restaurant facebook URL dict_card['default_action']['webview_height_ratio'] = 'tall' dict_card['buttons'] = [] dict_card['buttons'].append({}) dict_card['buttons'][0]['type'] = 'postback' dict_card['buttons'][0]['payload'] = '/ask_chosen_restaurant_name_en{"chosen_restaurant_name_en":restaurant_details_en[0]}' ## WHEN BUTTON IS PRESSED STORE RESTAURANT NAME TO SLOT dict_card['buttons'][0]['title'] = 'See menu' dict_card['buttons'].append({}) dict_card['buttons'][1]['type'] = 'web_url' dict_card['buttons'][1]['url'] = restaurant_details_en[11] ## Restaurant location using google maps dict_card['buttons'][1]['title'] = 'Open Location' gt['attachment']['payload']['elements'].append(dict_card)
NLU File:
- intent: ask_chosen_restaurant_name_en examples: |
The line in the action file that does not produce an output is:
dict_card['buttons'][0]['payload'] = '/ask_chosen_restaurant_name_en{"chosen_restaurant_name_en":restaurant_details_en[0]}' ## WHEN BUTTON IS PRESSED STORE RESTAURANT NAME TO SLOT
Please help me out I am pressed for time!!