|
|
|
@ -285,7 +285,8 @@ const whatsappMsgMapped = {
|
|
|
|
|
'whatsapp.inbound_message.received': {
|
|
|
|
|
getMsg: (result) => {
|
|
|
|
|
// console.log('whatsapp.inbound_message.received', result);
|
|
|
|
|
return isEmpty(result?.whatsappInboundMessage) ? null : { ...result.whatsappInboundMessage, conversationid: result.conversationid, messageorigin: result.messageorigin, msg_source: 'WABA', msg_direction: 'inbound' };
|
|
|
|
|
const data1 = pick(result, ['conversationid', 'opi_sn', 'coli_sn', 'coli_id']);
|
|
|
|
|
return isEmpty(result?.whatsappInboundMessage) ? null : { ...result.whatsappInboundMessage, ...data1, messageorigin: result.messageorigin, msg_source: 'WABA', msg_direction: 'inbound' };
|
|
|
|
|
},
|
|
|
|
|
contentToRender: (contentObj) => {
|
|
|
|
|
// console.log('whatsapp.inbound_message.received to render', contentObj);
|
|
|
|
@ -445,7 +446,7 @@ export const whatsappMsgTypeMapped = {
|
|
|
|
|
text: {
|
|
|
|
|
type: 'text',
|
|
|
|
|
data: (msg) => ({ id: msg.wamid, text: autoLinkText(msg?.text?.body), originText: msg?.text?.body, title: msg?.customerProfile?.name || '', }), // msg?.from ||
|
|
|
|
|
renderForReply: (msg) => ({ id: msg.wamid, message: msg?.text?.body }),
|
|
|
|
|
renderForReply: (msg) => ({ id: msg.wamid, message: msg?.text?.body || msg?.text }),
|
|
|
|
|
},
|
|
|
|
|
image: {
|
|
|
|
|
type: 'photo',
|
|
|
|
@ -638,6 +639,7 @@ export const parseRenderMessageItem = (msg) => {
|
|
|
|
|
// console.log('parseRenderMessageItem', msg);
|
|
|
|
|
const thisMsgType = Object.keys(whatsappMsgTypeMapped).includes(msg.type) ? msg.type : 'unsupported';
|
|
|
|
|
return {
|
|
|
|
|
opi_sn: msg.opi_sn || '',
|
|
|
|
|
msgOrigin: msg,
|
|
|
|
|
date: msg?.sendTime || msg?.createTime || '',
|
|
|
|
|
...(whatsappMsgTypeMapped?.[thisMsgType]?.data(msg) || {}),
|
|
|
|
|