From 8e1b983e377dbbcb85001179da603bd4772a9f91 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Wed, 16 Apr 2025 17:25:06 -0400 Subject: [PATCH 1/3] new components --- .../download-attachment.mjs | 55 +++++++++++ .../microsoft_outlook.app.mjs | 39 ++++++++ components/microsoft_outlook/package.json | 2 +- .../sources/common/common-new-email.mjs | 58 +++++++++++ .../sources/{ => common}/common.mjs | 2 +- .../new-attachment-received.mjs | 97 +++++++++++++++++++ .../sources/new-contact/new-contact.mjs | 4 +- .../sources/new-email/new-email.mjs | 54 +---------- 8 files changed, 255 insertions(+), 56 deletions(-) create mode 100644 components/microsoft_outlook/actions/download-attachment/download-attachment.mjs create mode 100644 components/microsoft_outlook/sources/common/common-new-email.mjs rename components/microsoft_outlook/sources/{ => common}/common.mjs (97%) create mode 100644 components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs diff --git a/components/microsoft_outlook/actions/download-attachment/download-attachment.mjs b/components/microsoft_outlook/actions/download-attachment/download-attachment.mjs new file mode 100644 index 0000000000000..68381ba5345b2 --- /dev/null +++ b/components/microsoft_outlook/actions/download-attachment/download-attachment.mjs @@ -0,0 +1,55 @@ +import microsoftOutlook from "../../microsoft_outlook.app.mjs"; +import fs from "fs"; +import mime from "mime-types"; + +export default { + key: "microsoft_outlook-download-attachment", + name: "Download Attachment", + description: "Downloads an attachment to the /tmp directory. [See the documentation](https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http)", + version: "0.0.1", + type: "action", + props: { + microsoftOutlook, + messageId: { + propDefinition: [ + microsoftOutlook, + "messageId", + ], + description: "The identifier of the message containing the attachment to download", + }, + attachmentId: { + propDefinition: [ + microsoftOutlook, + "attachmentId", + (c) => ({ + messageId: c.messageId, + }), + ], + }, + filename: { + type: "string", + label: "Filename", + description: "The filename to save the attachment as in the /tmp directory", + }, + }, + async run({ $ }) { + const response = await this.microsoftOutlook.getAttachment({ + $, + messageId: this.messageId, + attachmentId: this.attachmentId, + responseType: "arraybuffer", + }); + + const rawcontent = response.toString("base64"); + const buffer = Buffer.from(rawcontent, "base64"); + const downloadedFilepath = `/tmp/${this.filename}`; + fs.writeFileSync(downloadedFilepath, buffer); + const contentType = mime.lookup(downloadedFilepath); + + return { + fileName: this.filename, + contentType, + filePath: downloadedFilepath, + }; + }, +}; diff --git a/components/microsoft_outlook/microsoft_outlook.app.mjs b/components/microsoft_outlook/microsoft_outlook.app.mjs index c648457cb9cce..d46c01ff3c3d4 100644 --- a/components/microsoft_outlook/microsoft_outlook.app.mjs +++ b/components/microsoft_outlook/microsoft_outlook.app.mjs @@ -170,6 +170,29 @@ export default { })) || []; }, }, + attachmentId: { + type: "string", + label: "Attachment ID", + description: "The identifier of the attachment to download", + async options({ + messageId, page, + }) { + const limit = DEFAULT_LIMIT; + const { value: attachments } = await this.listAttachments({ + messageId, + params: { + $top: limit, + $skip: limit * page, + }, + }); + return attachments?.map(({ + id: value, name: label, + }) => ({ + value, + label, + })) || []; + }, + }, maxResults: { type: "integer", label: "Max Results", @@ -403,6 +426,22 @@ export default { ...args, }); }, + getAttachment({ + messageId, attachmentId, ...args + }) { + return this._makeRequest({ + path: `/me/messages/${messageId}/attachments/${attachmentId}/$value`, + ...args, + }); + }, + listAttachments({ + messageId, ...args + }) { + return this._makeRequest({ + path: `/me/messages/${messageId}/attachments`, + ...args, + }); + }, async *paginate({ fn, args = {}, max, }) { diff --git a/components/microsoft_outlook/package.json b/components/microsoft_outlook/package.json index df31991cbb3f1..10435130a43eb 100644 --- a/components/microsoft_outlook/package.json +++ b/components/microsoft_outlook/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/microsoft_outlook", - "version": "1.4.1", + "version": "1.5.0", "description": "Pipedream Microsoft Outlook Components", "main": "microsoft_outlook.app.mjs", "keywords": [ diff --git a/components/microsoft_outlook/sources/common/common-new-email.mjs b/components/microsoft_outlook/sources/common/common-new-email.mjs new file mode 100644 index 0000000000000..5ceaa8492bdfd --- /dev/null +++ b/components/microsoft_outlook/sources/common/common-new-email.mjs @@ -0,0 +1,58 @@ +import common from "./common.mjs"; + +export default { + ...common, + props: { + ...common.props, + folderIds: { + propDefinition: [ + common.props.microsoftOutlook, + "folderIds", + ], + optional: true, + }, + }, + hooks: { + ...common.hooks, + async deploy() { + this.db.set("sentItemFolderId", await this.getFolderIdByName("Sent Items")); + this.db.set("draftsFolderId", await this.getFolderIdByName("Drafts")); + + const events = await this.getSampleEvents({ + pageSize: 25, + }); + if (!events || events.length == 0) { + return; + } + for (const item of events) { + this.emitEvent(item); + } + }, + async activate() { + await this.activate({ + changeType: "created", + resource: "/me/messages", + }); + }, + async deactivate() { + await this.deactivate(); + }, + }, + methods: { + ...common.methods, + async getFolderIdByName(name) { + const { value: folders } = await this.microsoftOutlook.listFolders(); + const folder = folders.find(({ displayName }) => displayName === name); + return folder?.id; + }, + isRelevant(item) { + if (this.folderIds?.length) { + return this.folderIds.includes(item.parentFolderId); + } + // if no folderIds are specified, filter out items in Sent Items & Drafts + const sentItemFolderId = this.db.get("sentItemFolderId"); + const draftsFolderId = this.db.get("draftsFolderId"); + return item.parentFolderId !== sentItemFolderId && item.parentFolderId !== draftsFolderId; + }, + }, +}; diff --git a/components/microsoft_outlook/sources/common.mjs b/components/microsoft_outlook/sources/common/common.mjs similarity index 97% rename from components/microsoft_outlook/sources/common.mjs rename to components/microsoft_outlook/sources/common/common.mjs index 90cc7f377dd16..2264b7656479e 100644 --- a/components/microsoft_outlook/sources/common.mjs +++ b/components/microsoft_outlook/sources/common/common.mjs @@ -1,4 +1,4 @@ -import microsoftOutlook from "../microsoft_outlook.app.mjs"; +import microsoftOutlook from "../../microsoft_outlook.app.mjs"; const getRenewalInterval = (period) => { let day = 24 * 60 * 60; diff --git a/components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs b/components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs new file mode 100644 index 0000000000000..0d8adbd68f423 --- /dev/null +++ b/components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs @@ -0,0 +1,97 @@ +import common from "../common/common-new-email.mjs"; +import md5 from "md5"; + +export default { + ...common, + key: "microsoft_outlook-new-attachment-received", + name: "New Attachment Received (Instant)", + description: "Emit new event when a new email containing one or more attachments arrives in a specified Microsoft Outlook folder.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + async getSampleEvents({ pageSize }) { + const folders = this.folderIds?.length + ? this.folderIds.map((id) => `/me/mailFolders/${id}/messages`) + : [ + "/me/messages", + ]; + + const messagesWithAttachments = []; + for (const folder of folders) { + const { value: messages } = await this.microsoftOutlook.listMessages({ + resource: folder, + params: { + $top: pageSize, + $filter: "hasAttachments eq true", + }, + }); + messagesWithAttachments.push(...messages); + } + + const attachments = []; + for (const message of messagesWithAttachments) { + const messageAttachments = await this.getMessageAttachments(message); + attachments.push(...messageAttachments); + } + return attachments; + }, + async getMessageAttachments(message) { + const { value: attachments } = await this.microsoftOutlook.listAttachments({ + messageId: message.id, + }); + if (!attachments?.length) { + return []; + } + return attachments.map((attachment) => ({ + ...attachment, + messageId: message.id, + messageSubject: message.subject, + messageSender: message.sender, + messageReceivedDateTime: message.receivedDateTime, + parentFolderId: message.parentFolderId, + contentBytes: undefined, + })); + }, + emitEvent(item) { + if (this.isRelevant(item)) { + this.$emit(item, this.generateMeta(item)); + } + }, + generateMeta(item) { + return { + id: md5(item.id), // id > 64 characters, so dedupe on hash of id + summary: `New attachment ${item.name}`, + ts: Date.parse(item.messageReceivedDateTime), + }; + }, + }, + async run(event) { + const folders = this.folderIds?.length + ? this.folderIds.map((id) => `/me/mailFolders/${id}/messages`) + : [ + "/me/messages", + ]; + + for (const folder of folders) { + await this.run({ + event, + emitFn: async ({ resourceId } = {}) => { + try { + const message = await this.microsoftOutlook.getMessage({ + resource: folder, + messageId: resourceId, + }); + if (message.hasAttachments) { + const attachments = await this.getMessageAttachments(message); + attachments.forEach((item) => this.emitEvent(item)); + } + } catch { + console.log(`Could not fetch message with ID: ${resourceId}`); + } + }, + }); + } + }, +}; diff --git a/components/microsoft_outlook/sources/new-contact/new-contact.mjs b/components/microsoft_outlook/sources/new-contact/new-contact.mjs index 080c130eae44e..719b5bb49be63 100644 --- a/components/microsoft_outlook/sources/new-contact/new-contact.mjs +++ b/components/microsoft_outlook/sources/new-contact/new-contact.mjs @@ -1,11 +1,11 @@ -import common from "../common.mjs"; +import common from "../common/common.mjs"; export default { ...common, key: "microsoft_outlook-new-contact", name: "New Contact Event (Instant)", description: "Emit new event when a new Contact is created", - version: "0.0.13", + version: "0.0.14", type: "source", hooks: { ...common.hooks, diff --git a/components/microsoft_outlook/sources/new-email/new-email.mjs b/components/microsoft_outlook/sources/new-email/new-email.mjs index 0b1eac16900ef..5d6b6ce84531e 100644 --- a/components/microsoft_outlook/sources/new-email/new-email.mjs +++ b/components/microsoft_outlook/sources/new-email/new-email.mjs @@ -1,4 +1,4 @@ -import common from "../common.mjs"; +import common from "../common/common-new-email.mjs"; import md5 from "md5"; import sampleEmit from "./test-event.mjs"; @@ -7,52 +7,11 @@ export default { key: "microsoft_outlook-new-email", name: "New Email Event (Instant)", description: "Emit new event when an email is received in specified folders.", - version: "0.0.16", + version: "0.0.17", type: "source", dedupe: "unique", - props: { - ...common.props, - folderIds: { - propDefinition: [ - common.props.microsoftOutlook, - "folderIds", - ], - optional: true, - }, - }, - hooks: { - ...common.hooks, - async deploy() { - this.db.set("sentItemFolderId", await this.getFolderIdByName("Sent Items")); - this.db.set("draftsFolderId", await this.getFolderIdByName("Drafts")); - - const events = await this.getSampleEvents({ - pageSize: 25, - }); - if (!events || events.length == 0) { - return; - } - for (const item of events) { - this.emitEvent(item); - } - }, - async activate() { - await this.activate({ - changeType: "created", - resource: "/me/messages", - }); - }, - async deactivate() { - await this.deactivate(); - }, - }, methods: { ...common.methods, - async getFolderIdByName(name) { - const { value: folders } = await this.microsoftOutlook.listFolders(); - const folder = folders.find(({ displayName }) => displayName === name); - return folder?.id; - }, async getSampleEvents({ pageSize }) { const folders = this.folderIds?.length ? this.folderIds.map((id) => `/me/mailFolders/${id}/messages`) @@ -73,15 +32,6 @@ export default { } return results; }, - isRelevant(item) { - if (this.folderIds?.length) { - return this.folderIds.includes(item.parentFolderId); - } - // if no folderIds are specified, filter out items in Sent Items & Drafts - const sentItemFolderId = this.db.get("sentItemFolderId"); - const draftsFolderId = this.db.get("draftsFolderId"); - return item.parentFolderId !== sentItemFolderId && item.parentFolderId !== draftsFolderId; - }, emitEvent(item) { if (this.isRelevant(item)) { this.$emit( From 149e90cbda5acad9e70bde7c4d7783cd0ab4c471 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Wed, 16 Apr 2025 17:30:03 -0400 Subject: [PATCH 2/3] versions --- .../actions/add-label-to-email/add-label-to-email.mjs | 2 +- .../actions/approve-workflow/approve-workflow.mjs | 2 +- .../microsoft_outlook/actions/create-contact/create-contact.mjs | 2 +- .../actions/create-draft-email/create-draft-email.mjs | 2 +- .../microsoft_outlook/actions/find-contacts/find-contacts.mjs | 2 +- components/microsoft_outlook/actions/find-email/find-email.mjs | 2 +- .../microsoft_outlook/actions/list-contacts/list-contacts.mjs | 2 +- .../microsoft_outlook/actions/list-folders/list-folders.mjs | 2 +- .../microsoft_outlook/actions/list-labels/list-labels.mjs | 2 +- .../actions/move-email-to-folder/move-email-to-folder.mjs | 2 +- .../actions/remove-label-from-email/remove-label-from-email.mjs | 2 +- .../microsoft_outlook/actions/reply-to-email/reply-to-email.mjs | 2 +- components/microsoft_outlook/actions/send-email/send-email.mjs | 2 +- .../microsoft_outlook/actions/update-contact/update-contact.mjs | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs b/components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs index 23d0df5a27034..45b0dceb9b250 100644 --- a/components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs +++ b/components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs @@ -5,7 +5,7 @@ export default { key: "microsoft_outlook-add-label-to-email", name: "Add Label to Email", description: "Adds a label/category to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)", - version: "0.0.5", + version: "0.0.6", type: "action", props: { microsoftOutlook, diff --git a/components/microsoft_outlook/actions/approve-workflow/approve-workflow.mjs b/components/microsoft_outlook/actions/approve-workflow/approve-workflow.mjs index a4a04c320b2c4..7abbc9b8adaf9 100644 --- a/components/microsoft_outlook/actions/approve-workflow/approve-workflow.mjs +++ b/components/microsoft_outlook/actions/approve-workflow/approve-workflow.mjs @@ -4,7 +4,7 @@ export default { key: "microsoft_outlook-approve-workflow", name: "Approve Workflow", description: "Suspend the workflow until approved by email. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { microsoftOutlook, diff --git a/components/microsoft_outlook/actions/create-contact/create-contact.mjs b/components/microsoft_outlook/actions/create-contact/create-contact.mjs index c76b7c9841721..3ca74216de1d6 100644 --- a/components/microsoft_outlook/actions/create-contact/create-contact.mjs +++ b/components/microsoft_outlook/actions/create-contact/create-contact.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-create-contact", - version: "0.0.12", + version: "0.0.13", name: "Create Contact", description: "Add a contact to the root Contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)", props: { diff --git a/components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs b/components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs index 00f81f8961387..739c3fef06f16 100644 --- a/components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs +++ b/components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-create-draft-email", - version: "0.0.12", + version: "0.0.13", name: "Create Draft Email", description: "Create a draft email, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-post-messages)", props: { diff --git a/components/microsoft_outlook/actions/find-contacts/find-contacts.mjs b/components/microsoft_outlook/actions/find-contacts/find-contacts.mjs index aefcad73d8da1..2d0ac938d84d6 100644 --- a/components/microsoft_outlook/actions/find-contacts/find-contacts.mjs +++ b/components/microsoft_outlook/actions/find-contacts/find-contacts.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-find-contacts", - version: "0.0.12", + version: "0.0.13", name: "Find Contacts", description: "Finds contacts with the given search string. [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)", props: { diff --git a/components/microsoft_outlook/actions/find-email/find-email.mjs b/components/microsoft_outlook/actions/find-email/find-email.mjs index 72fb7cbba9d6b..0163c31c4474b 100644 --- a/components/microsoft_outlook/actions/find-email/find-email.mjs +++ b/components/microsoft_outlook/actions/find-email/find-email.mjs @@ -4,7 +4,7 @@ export default { key: "microsoft_outlook-find-email", name: "Find Email", description: "Search for an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-messages)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { microsoftOutlook, diff --git a/components/microsoft_outlook/actions/list-contacts/list-contacts.mjs b/components/microsoft_outlook/actions/list-contacts/list-contacts.mjs index 022e1ff6ff601..a9e19ba61fff8 100644 --- a/components/microsoft_outlook/actions/list-contacts/list-contacts.mjs +++ b/components/microsoft_outlook/actions/list-contacts/list-contacts.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-list-contacts", - version: "0.0.12", + version: "0.0.13", name: "List Contacts", description: "Get a contact collection from the default contacts folder, [See the documentation](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)", props: { diff --git a/components/microsoft_outlook/actions/list-folders/list-folders.mjs b/components/microsoft_outlook/actions/list-folders/list-folders.mjs index 7d13a27985183..2ebe2d0b58fd8 100644 --- a/components/microsoft_outlook/actions/list-folders/list-folders.mjs +++ b/components/microsoft_outlook/actions/list-folders/list-folders.mjs @@ -4,7 +4,7 @@ export default { key: "microsoft_outlook-list-folders", name: "List Folders", description: "Retrieves a list of all folders in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-mailfolders)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { microsoftOutlook, diff --git a/components/microsoft_outlook/actions/list-labels/list-labels.mjs b/components/microsoft_outlook/actions/list-labels/list-labels.mjs index eeae28070eb10..bec17bb4d6098 100644 --- a/components/microsoft_outlook/actions/list-labels/list-labels.mjs +++ b/components/microsoft_outlook/actions/list-labels/list-labels.mjs @@ -4,7 +4,7 @@ export default { key: "microsoft_outlook-list-labels", name: "List Labels", description: "Get all the labels/categories that have been defined for a user. [See the documentation](https://learn.microsoft.com/en-us/graph/api/outlookuser-list-mastercategories)", - version: "0.0.5", + version: "0.0.6", type: "action", props: { microsoftOutlook, diff --git a/components/microsoft_outlook/actions/move-email-to-folder/move-email-to-folder.mjs b/components/microsoft_outlook/actions/move-email-to-folder/move-email-to-folder.mjs index 7a6e551df79ce..59a6e0838fcc2 100644 --- a/components/microsoft_outlook/actions/move-email-to-folder/move-email-to-folder.mjs +++ b/components/microsoft_outlook/actions/move-email-to-folder/move-email-to-folder.mjs @@ -4,7 +4,7 @@ export default { key: "microsoft_outlook-move-email-to-folder", name: "Move Email to Folder", description: "Moves an email to the specified folder in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-move)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { microsoftOutlook, diff --git a/components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs b/components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs index 79c9840a6c857..0fb2bcb78345d 100644 --- a/components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs +++ b/components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs @@ -4,7 +4,7 @@ export default { key: "microsoft_outlook-remove-label-from-email", name: "Remove Label from Email", description: "Removes a label/category from an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)", - version: "0.0.5", + version: "0.0.6", type: "action", props: { microsoftOutlook, diff --git a/components/microsoft_outlook/actions/reply-to-email/reply-to-email.mjs b/components/microsoft_outlook/actions/reply-to-email/reply-to-email.mjs index 60575e033553a..b87a4e06f69a5 100644 --- a/components/microsoft_outlook/actions/reply-to-email/reply-to-email.mjs +++ b/components/microsoft_outlook/actions/reply-to-email/reply-to-email.mjs @@ -4,7 +4,7 @@ export default { key: "microsoft_outlook-reply-to-email", name: "Reply to Email", description: "Reply to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-reply)", - version: "0.0.2", + version: "0.0.3", type: "action", props: { microsoftOutlook, diff --git a/components/microsoft_outlook/actions/send-email/send-email.mjs b/components/microsoft_outlook/actions/send-email/send-email.mjs index c0c776e009903..cb58c9c94db4f 100644 --- a/components/microsoft_outlook/actions/send-email/send-email.mjs +++ b/components/microsoft_outlook/actions/send-email/send-email.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-send-email", - version: "0.0.13", + version: "0.0.14", name: "Send Email", description: "Send an email to one or multiple recipients, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-sendmail)", props: { diff --git a/components/microsoft_outlook/actions/update-contact/update-contact.mjs b/components/microsoft_outlook/actions/update-contact/update-contact.mjs index cb389b05e7ed1..ec7569c648bb4 100644 --- a/components/microsoft_outlook/actions/update-contact/update-contact.mjs +++ b/components/microsoft_outlook/actions/update-contact/update-contact.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-update-contact", - version: "0.0.12", + version: "0.0.13", name: "Update Contact", description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)", props: { From 0a05f67b6bbfdf1fa367e5ad44782420699ebb1d Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Fri, 18 Apr 2025 11:09:22 -0400 Subject: [PATCH 3/3] dedupe by contentId --- .../new-attachment-received/new-attachment-received.mjs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs b/components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs index 0d8adbd68f423..4e194afb6e2b7 100644 --- a/components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs +++ b/components/microsoft_outlook/sources/new-attachment-received/new-attachment-received.mjs @@ -1,5 +1,4 @@ import common from "../common/common-new-email.mjs"; -import md5 from "md5"; export default { ...common, @@ -61,7 +60,7 @@ export default { }, generateMeta(item) { return { - id: md5(item.id), // id > 64 characters, so dedupe on hash of id + id: item.contentId, summary: `New attachment ${item.name}`, ts: Date.parse(item.messageReceivedDateTime), };