fbbotw.post_generic_template_carousel¶
-
fbbotw.
post_generic_template_carousel
(fbid, elements, sharable=True, image_aspect_ratio=’horizontal’, messaging_type=’RESPONSE’, tag=None)[source]¶ Sends up to 10 generic template elements as a carousel.
Usage: >>> # Set the user to receive generic templates >>> fbid = "<user page scoped id>" >>> # Build the elements list >>> elements = [ { "title": "Title Texts", "item_url": "https://mylink.com", "subtitle": "Subtitle Text", "default_action": { "type": "web_url", "url": "https://mylink.com", } "buttons": [ { 'type': 'web_url', 'url': 'https://mylink.com', 'title': 'My button' } ], "image_url": "http://i.imgur.com/SOnSwUT.jpg" }, # ... You can insert up to 10 elements in the list ] >>> # Send the carousel >>> response = fbbotw.post_generic_template_carousel( fbid=fbid, elements=elements )
Parameters: - fbid (str) – User to be messaged
- elements (list) –
generic templates elements (Max 10 itens). format:
>>> elements = [ { “title”: “Title Texts”, “item_url”: “https://mylink.com”, “subtitle”: “Subtitle Text”, “default_action”: { “type”: “web_url”, “url”: “https://mylink.com”, } “buttons”: [ { ‘type’: ‘web_url’, ‘url’: ‘https://mylink.com’, ‘title’: ‘My button’ } ], “image_url”: “http://i.imgur.com/SOnSwUT.jpg” } ]
- sharable (bool) – Able/Disable native share button in Messenger for the template message (Default: True).
- image_aspect_ratio (str) – Aspect ratio used to render images specified by image_url in element objects. Must be ‘horizontal’ or ‘square’. (Default ‘horizontal’)
- messaging_type (str) – Identifies the message type from: RESPONSE, UPDATE AND MESSAGE_TAG (Default: RESPONSE, if MESSAGE_TAG, tag param is required)
- tag (str) – Tag classifying the message, must be one of the following tags
Returns: Facebook docs: