def post_text_w_quickreplies(fbid, message, quick_replies):
""" Send text with quick replies buttons
(/docs/messenger-platform/send-api-reference/quick-replies).
:param str fbid: User id to send the quick replies menu.
:param str message: message to be displayed with the menu.
:param list quick_replies: (Max 10) format :
>>> quick_replies = [
{
"content_type": "text",
"title": "Yes!",
"payload": "USER_SAY_YES"
},
{
"content_type": "text",
"title": "Nope",
"payload": "USER_SAY_NOT"
}
]
:return: `Response object <http://docs.python-requests.org/en/\
master/api/#requests.Response>`_
"""
url = MSG_URL + PAGE_ACCESS_TOKEN
payload = {}
payload["recipient"] = {"id": fbid}
payload["message"] = {"text": message, "quick_replies": quick_replies}
data = json.dumps(payload)
status = requests.post(url, headers=HEADER, data=data)
return status
# Send API Templates
评论列表
文章目录