in SampleIntegrations/SampleBots/NodeJS/ExpenseBot/app.js [427:448]
function callSendAPI(messageData) {
graphapi({
url: '/me/messages',
method: 'POST',
json: messageData
}, function (error, response, body) {
if (!error && response.statusCode == 200) {
var recipientId = body.recipient_id;
var messageId = body.message_id;
if (messageId) {
console.log('Successfully sent message with id %s to recipient %s',
messageId, recipientId);
} else {
console.log('Successfully called Send API for recipient %s',
recipientId);
}
} else {
console.error('Failed calling Send API', response.statusCode, response.statusMessage, body.error);
}
});
}