Created
May 17, 2018 23:42
-
-
Save enginebai/f7af2ff9ca7f7fc6ba9e02c525cfc702 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_fb_message(to, message): | |
post_message_url = 'https://graph.facebook.com/v2.6/me/messages?access_token={token}'.format(token=config.FB_TOKEN) | |
response_message = json.dumps({"recipient":{"id": to}, | |
"message":{"text":message}}) | |
req = requests.post(post_message_url, | |
headers={"Content-Type": "application/json"}, | |
data=response_message) | |
print("[{}] Reply to {}: {}", req.status_code, to, message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment