I found a workaround to this from the following source, the script that gets only the messages and not threads is:
function listMessages () {
// Only return messages matching the specified query.
var msgs = Gmail.Users.Messages.list('me', {'q':'label:InProcess'}).messages;
msgs.forEach(function (e){
var message = GmailApp.getMessageById(e.id); // Fetch message by its ID
var plainBody = message.getPlainBody();
});
}