Last active
July 18, 2017 10:13
-
-
Save erika-dike/0205fb7dccb810d088afe4d52813fac9 to your computer and use it in GitHub Desktop.
Constructs list template from supplied elements and buttons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create_list_template(recipient_id, elements, buttons): | |
| """ | |
| Returns a list template for detail view | |
| recipient_id: integer | |
| elements: list of elements to be injected into template | |
| buttons: list of buttons to be injected into template | |
| """ | |
| template = copy.deepcopy(message_templates.LIST_TEMPLATE) | |
| template['recipient']['id'] = recipient_id | |
| payload_section = template['message']['attachment']['payload'] | |
| payload_section['template_type'] = 'list' | |
| payload_section['top_element_style'] = 'compact' | |
| template['message']['attachment']['payload']['elements'] = elements | |
| template['message']['attachment']['payload']['buttons'] = buttons | |
| return template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment