Skip to content

Instantly share code, notes, and snippets.

@koji
Last active July 10, 2016 20:30
Show Gist options
  • Save koji/1c5436b8ce79f6b95fa5b7da78b8f644 to your computer and use it in GitHub Desktop.
Save koji/1c5436b8ce79f6b95fa5b7da78b8f644 to your computer and use it in GitHub Desktop.
Facebook Quick Replies
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