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 c88ee91 commit 6d89574
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions msg_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ module.exports = ({ requestBody, currentWABA_ID }) => {
? requestBody.entry[0].changes[0].value.messages[0]
: null;


if(!message){
//it doesn't have value.messages instead it only contains value.statuses
console.log({
// statuses:requestBody.entry[0].changes[0].statuses,
// metadata:requestBody.entry[0].changes[0].metadata
str: JSON.stringify( metadata:requestBody.entry[0].changes[0])
})
}


let actualType;
if (message?.type) {
actualType = message.type;
Expand Down Expand Up @@ -107,12 +118,17 @@ module.exports = ({ requestBody, currentWABA_ID }) => {
message['button_reply'] = message.interactive.button_reply;
} else if (actualType === 'unsupported') {
msgType = 'unknownMessage';
} else {
msgType = 'unknown';
// console.log({
// actualType,
// message
// })
}

message['type'] = msgType;
message['sender'] = {
name: contacts.profile.name,
phone: message.from,
phone: message?.from,
};

return {
Expand Down

0 comments on commit 6d89574

Please sign in to comment.