Skip to content

Instantly share code, notes, and snippets.

@varunngoyal
Created July 27, 2020 08:29
Show Gist options
  • Save varunngoyal/d5835aea6c80a4c83a6c7a8d2c362162 to your computer and use it in GitHub Desktop.
Save varunngoyal/d5835aea6c80a4c83a6c7a8d2c362162 to your computer and use it in GitHub Desktop.
class df_rich_responses():
def __init__(self):
self.abc = "abc"
def fulfillment_messages(self, message, responses):
return {
"fulfillmentMessages": [
{
"text": {
"text": [
message
]
}
},
{
"payload": {
"richContent": responses
}
}
]
}
def list_response(self, country_list):
buttonsList = []
for country in country_list[:-1]:
buttonsList.append({
"type": "list",
"title": country,
"subtitle": country,
"event": {
"name": "country_click",
"languageCode": "",
"parameters": {
"geo-country": country
}
}
})
buttonsList.append({
"type": "divider"
})
buttonsList.append({
"type": "list",
"title": country_list[-1:][0],
"subtitle": country_list[-1:][0],
"event": {
"name": "view_more_after",
"languageCode": "",
"parameters": {
"geo-country": country
}
}
})
return buttonsList
def image_response(self, name, url):
return [
[
{
"type": "image",
"rawUrl": url,
"accessibilityText": name
}
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment