Skip to content

Instantly share code, notes, and snippets.

@teenoh
Last active November 1, 2017 23:04
Show Gist options
  • Save teenoh/bfd43e9a6a6d178b36ed1d44e18050a6 to your computer and use it in GitHub Desktop.
Save teenoh/bfd43e9a6a6d178b36ed1d44e18050a6 to your computer and use it in GitHub Desktop.
def send_text_message(recipient_id, message):
data = json.dumps({
"recipient": {"id": recipient_id},
"message": {"text": message}
})
params = {
"access_token": <PAGE_ACCESS_TOKEN>
}
headers = {
"Content-Type": "application/json"
}
r = requests.post("https://graph.facebook.com/v2.6/me/messages",
params=params, headers=headers, data=data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment