Skip to content

Instantly share code, notes, and snippets.

@andreas-optimizely
Created September 27, 2017 17:03
Embed
What would you like to do?
// Sending a Messenger template message
function sendGenericMessage(sender, data) {
messageData = data;
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