function callSendAPI(messageData) {
	request({
		uri: 'https://graph.facebook.com/v2.6/me/messages',
		qs: { access_token: process.env.PAGE_ACCESS_TOKEN },
		method: 'POST',
		json: messageData
	}, function (error, response, body) {
		if (!error && response.statusCode == 200) {
			let recipientId = body.recipient_id;
			console.log("Successfully sent Facebook message to " + recipientId);
			console.log("Message: " + JSON.stringify(messageData));
		} else {
			console.error("Unable to send Facebook message.");
			console.error("Error: " + error);
			console.error("Response: " + response);
			console.error("Body: " + body);
		}
	});
}
//Postconditions: message data will be sent to Facebook's API
message data will be sent to Facebook's API
message data will be sent to Facebook ' s API
function callSendAPI(messageData) {
	request({
		uri: 'https://graph.facebook.com/v2.6/me/messages',
		qs: { access_token: process.env.PAGE_ACCESS_TOKEN },
		method: 'POST',
		json: messageData
	}, function (error, response, body) {
		if (!error && response.statusCode == 200) {
			let recipientId = body.recipient_id;
			console.log("Successfully sent Facebook message to " + recipientId);
			console.log("Message: " + JSON.stringify(messageData));
		} else {
			console.error("Unable to send Facebook message.");
			console.error("Error: " + error);
			console.error("Response: " + response);
			console.error("Body: " + body);
		}
	});
}
function callSendAPI ( messageData ) { request ( { uri : 'https://graph.facebook.com/v2.6/me/messages' , qs : { access_token : process . env . PAGE_ACCESS_TOKEN } , method : 'POST' , json : messageData } , function ( error , response , body ) { if ( ! error && response . statusCode == 200 ) { let recipientId = body . recipient_id ; console . log ( "Successfully sent Facebook message to " + recipientId ) ; console . log ( "Message: " + JSON . stringify ( messageData ) ) ; } else { console . error ( "Unable to send Facebook message." ) ; console . error ( "Error: " + error ) ; console . error ( "Response: " + response ) ; console . error ( "Body: " + body ) ; } } ) ; }
Postconditions: message data will be sent to Facebook's API
Postconditions : message data will be sent to Facebook ' s API