def send_attachment_message(sender, attachment_type, payload):
fb_sender_id = sender['id']
content = {
'recipient': {
'id': fb_sender_id
},
'message': {
'attachment': {
'type': attachment_type,
'payload': payload
}
}
}
headers = {
'Content-Type': 'application/json'
}
payload = json.dumps(content)
logging.debug(payload)
url = 'https://graph.facebook.com/v2.6/me/messages?access_token=' + config.FACEBOOK_PAGE_ACCESS_TOKEN
if config.PRODUCTION:
req = urlfetch.fetch(
url,
payload,
urlfetch.POST,
headers
)
logging.debug(req.content)
评论列表
文章目录