perf(wai): webhook msg类型

dev/supplier-email-drawer
Lei OT 9 months ago
parent 997f5a3174
commit 31808bcefc

@ -168,7 +168,7 @@ const setupMessageHandler = () => {
// todo: 现在只能收text 消息, 后续再加其他类型
const msgRow = await upsertOutboundMessage(
{ ...timeFields, ...upsertFields, ...pusher, ...contentFields, ...record, type: _type, message_origin: savedMsg?.message_origin || JSON.stringify(messageData) },
{ ...timeFields, ...upsertFields, ...pusher, ...contentFields, ...record, ...typeField, message_origin: savedMsg?.message_origin || JSON.stringify(messageData) },
targetUpsert,
);
// console.log('upsert=========================', upsert);

@ -52,6 +52,7 @@ const mediaMsg = {
caption: row.IVADS_caption,
filename: row.IVADS_filename,
},
type: row.msgtype,
...(row.context_id ? { context: { message_id: row.context_id, from: row.context_from } } : {}),
}),
};
@ -89,6 +90,7 @@ const waiMsgTypeMapped = {
};
},
DbData: row => ({
type: 'text',
text: { body: row.text_body, preview_url: row.text_preview_url },
...(row.context_id ? { context: { message_id: row.context_id, from: row.context_from } } : {}),
}),
@ -159,6 +161,7 @@ const waiMsgTypeMapped = {
};
},
DbData: row => ({
type: 'reaction',
reaction: { emoji: row.reaction_emoji, message_id: row.reaction_message_id },
}),
},
@ -183,6 +186,7 @@ const waiMsgTypeMapped = {
};
},
DbData: row => ({
type: 'location',
location: {
latitude: row.location_latitude,
longitude: row.location_longitude,
@ -214,6 +218,7 @@ const waiMsgTypeMapped = {
};
},
DbData: row => ({
type: 'contacts',
contacts: JSON.parse(row.contacts),
}),
},

Loading…
Cancel
Save