Skip to content

Commit

Permalink
Updated Code
Browse files Browse the repository at this point in the history
  • Loading branch information
DaggieBlanqx committed Jun 22, 2022
1 parent 9c43c46 commit e5cf0a6
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions msg_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,32 @@ module.exports = ({ requestBody, currentWABA_ID }) => {
name: contacts.profile.name,
phone: message?.from,
};

if (output.isMessage) {
let context = null;

if (message.context) {
context = {
sender: {
name: null,
phone: message.context?.from,
message_id: message.context?.id,
},
};
}

output['message'] = {
...message,
context,
message_id: message.id || null,
};

delete output.message.id; //keep the data light
delete output.message.from; //keep the data light
}
} else {
console.warn('An unidentified.');
}

output['message'] = message;
output['notificationMessage'] = notificationMessage;

return output;
Expand Down

0 comments on commit e5cf0a6

Please sign in to comment.