Last active
July 10, 2016 20:30
-
-
Save koji/1c5436b8ce79f6b95fa5b7da78b8f644 to your computer and use it in GitHub Desktop.
Facebook Quick Replies
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
function sendQuickReplies(sender) { | |
messageData = { | |
"text": "Hey!!!:", | |
"quick_replies": [ | |
{ | |
"content_type": "text", | |
"title": "yoyo", | |
"payload": "yoyo" | |
}, | |
{ | |
"content_type": "text", | |
"title": "yo!", | |
"payload": "yo" | |
} | |
] | |
} | |
request({ | |
url: 'https://graph.facebook.com/v2.6/me/messages', | |
qs: {access_token: token}, | |
method: 'POST', | |
json: { | |
recipient: {id: sender}, | |
message: messageData, | |
} | |
}, function (error, response, body) { | |
if (error) { | |
console.log('Error sending messages: ', error) | |
} else if (response.body.error) { | |
console.log('Error: ', response.body.error) | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment