Hi Igor, thanks a lot for your blog. I could successfully deployed a webhook in AWS lambda nodejs. However I am getting 400 response code while sending message to the messenger.
function callSendAPI(messageData) {
var body = JSON.stringify(messageData);
var path = ‘/v2.6/me/messages?access_token=’ + PAGE_ACCESS_TOKEN;
var options = {
host: ‘graph.facebook.com’,
path: path,
method: ‘POST’,
headers: {‘Content-Type’: ‘application/json’}
};
var callback = function(response) {
console.log(“Response code is %d”, response.statusCode);
response.on(‘error’, function(e) {
console.log(“Response from FB messenger : “ + e);
});
var str = ‘’
response.on(‘data’, function (chunk) {
str += chunk;
});
response.on(‘end’, function () {
});
}
var req = https.request(options, callback);
req.on(‘error’, function(e) {
console.log(‘problem with request: ‘+ e);
});
req.write(body);
req.end();
}
Can you please help me how to go ahead.