Skip to content
This repository was archived by the owner on Jun 26, 2025. It is now read-only.

Commit c8a8d2d

Browse files
committed
add basic support for dialogflow messenger list response
1 parent 32e520a commit c8a8d2d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

flask_assistant/response/base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,13 @@ def _add_message(self):
363363
"listSelect": {"title": self._title, "items": self._items},
364364
}
365365
)
366+
self._add_platform_msgs()
367+
368+
def _add_platform_msgs(self):
369+
370+
if "DIALOGFLOW_MESSENGER" in self._integrations:
371+
list_resp = df_messenger._build_list(self._title, self._items)
372+
self._platform_messages["DIALOGFLOW_MESSENGER"].extend(list_resp)
366373

367374

368375
class _CarouselCard(_ListSelector):

flask_assistant/response/df_messenger.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,17 @@ def _build_button(link, link_title):
3232
"link": link,
3333
}
3434
return btn
35+
36+
37+
def _build_list(title, items):
38+
list_responses = []
39+
for i in items:
40+
item = {
41+
"type": "list",
42+
"title": i["title"],
43+
"subtitle": i["description"],
44+
"event": {"name": "", "languageCode": "", "parameters": {}},
45+
}
46+
list_responses.append(item)
47+
48+
return list_responses

0 commit comments

Comments
 (0)