fbbotw.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:fbbotw 作者: JoabMendes 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号