Initial Commit
This commit is contained in:
@@ -61,6 +61,18 @@ function extractShare(node) {
|
||||
};
|
||||
}
|
||||
|
||||
// A raw photo/video message has content_type 'IMAGES' with one or more
|
||||
// attachments (Instagram allows sending several photos in a single message).
|
||||
function extractAttachments(node) {
|
||||
const attachments = node.content?.attachments;
|
||||
if (!attachments?.length) return null;
|
||||
return attachments.map((a) => ({
|
||||
url: a.attachment_cdn_url || a.preview_cdn_url || null,
|
||||
width: a.preview_width || null,
|
||||
height: a.preview_height || null,
|
||||
})).filter((a) => a.url);
|
||||
}
|
||||
|
||||
function extractMessage(node, thread, fbidLookup) {
|
||||
const senderDict = node.sender?.user_dict;
|
||||
const resolved = senderDict
|
||||
@@ -85,6 +97,7 @@ function extractMessage(node, thread, fbidLookup) {
|
||||
text: node.text_body || node.content?.text_body || null,
|
||||
timestamp_ms: node.timestamp_ms ? Number(node.timestamp_ms) : null,
|
||||
share: extractShare(node),
|
||||
attachments: extractAttachments(node),
|
||||
reactions: reactions.length ? reactions : null,
|
||||
replied_to_id: node.replied_to_message_id || null,
|
||||
replied_to_text: node.replied_to_message?.text_body || null,
|
||||
|
||||
Reference in New Issue
Block a user