fbbotw.post_template_w_quickreplies

fbbotw.post_template_w_quickreplies(fbid, payload, quick_replies, messaging_type=’RESPONSE’, tag=None)[source]

Sends a template with quick replies buttons

Usage:
>>> # Set the user id and the template playload to send
>>> fbid = "<user page scoped id>"
>>> # This is a generic template payload dict
>>> payload = {
        "template_type": "generic",
        "elements": [
            {
                "title": "Welcome to Peter's Hats",
                "image_url": "https://site.com/company_image.png",
                "subtitle": "We've got the right hat for everyone.",
            }
        ]
    }
>>> # Set the quick replies list to be sent
>>> quick_replies = [
        {
            "content_type": "text",
            "title": "Payment options",
            "payload": "PAYMENT_OPTIONS"
        },
        {
            "content_type": "text",
            "title": "See hat options",
            "payload": "SEND_CATALOGUE"
        }
    ]
>>> # Send the template with the quick_replies
>>> response = fbbotw.post_template_w_quickreplies(
        fbid=fbid,
        payload=payload,
        quick_replies=quick_replies
    )
Parameters:
  • fbid (str) – User id to send the quick replies menu.
  • payload (dict) – template playload dict. See the payload field for every template type.
  • quick_replies (list) –

    (Max 11) format :

    >>> quick_replies = [
        {
            “content_type”: “text”,
            “title”: “Yes!”,
            “payload”: “USER_SAY_YES”
        },
        {
            “content_type”: “text”,
            “title”: “Nope”,
            “payload”: “USER_SAY_NOT”
        },
        {
            “content_type”: “location”,
        },
        {
            “content_type”: “text”,
            “title”: “Red”,
            “payload”: “DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_RED”,
            “image_url”: “http://petersfantastichats.com/img/red.png”
        },
    ]
    >>> # See all the fields for the quick reply object in the docs:
    >>> # /docs/messenger-platform/send-api-reference/quick-replies
    
  • 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:

Response object

Facebook docs:

/quick-replies