So, I have a nodejs app that receives a TWILIO POST request. The POST is being sent and currently upon reception I download the entire message history. I'm trying to find a way to only load the new message that is sent in the POST, but I can't find it anywhere... This is as close as I have been able to get but I still don't have anything resembling a message.
console.log(req.res.connection.parser.onBody) returns [Function: parserOnBody] in console and this...
Here is my code to respons to the POST. app is express
app.post('/respondToSMS', function(req, res) {
console.log(req.res.connection.parser.onBody)
msg.update(function(data){
io.emit('load_msgs',data)
});
});
THIS IS msg.update...
exports.update = function update_messages(callback){
client.messages.list(function(err, data) {
/*data.messages/*.forEach(function(message) {
console.log(message.body);*/
callback(data.messages)
});
};