Skip to content

Commit 1c2cc67

Browse files
Gmail updates for email replies (#16552)
* updates * versions * pnpm-lock.yaml * pnpm-lock.yaml * filter current user email * bump package version to rerun pr checks * pnpm-lock.yaml * Improve action summary --------- Co-authored-by: Leo Vu <[email protected]>
1 parent f6e736c commit 1c2cc67

File tree

23 files changed

+70
-22
lines changed

23 files changed

+70
-22
lines changed

components/gmail/actions/add-label-to-email/add-label-to-email.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-add-label-to-email",
55
name: "Add Label to Email",
66
description: "Add label(s) to an email message. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
7-
version: "0.0.7",
7+
version: "0.0.8",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/approve-workflow/approve-workflow.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-approve-workflow",
55
name: "Approve Workflow",
66
description: "Suspend the workflow until approved by email. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun#flowsuspend)",
7-
version: "0.0.3",
7+
version: "0.0.4",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/archive-email/archive-email.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "gmail-archive-email",
66
name: "Archive Email",
77
description: "Archive an email message. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "action",
1010
props: {
1111
gmail,

components/gmail/actions/create-draft/create-draft.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "gmail-create-draft",
77
name: "Create Draft",
88
description: "Create a draft from your Google Workspace email account. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.drafts/create)",
9-
version: "0.1.0",
9+
version: "0.1.1",
1010
type: "action",
1111
props: {
1212
gmail,

components/gmail/actions/download-attachment/download-attachment.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "gmail-download-attachment",
88
name: "Download Attachment",
99
description: "Download an attachment by attachmentId to the /tmp directory. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages.attachments/get)",
10-
version: "0.0.5",
10+
version: "0.0.6",
1111
type: "action",
1212
props: {
1313
gmail,

components/gmail/actions/find-email/find-email.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-find-email",
55
name: "Find Email",
66
description: "Find an email using Google's Search Engine. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list)",
7-
version: "0.0.10",
7+
version: "0.0.11",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/list-labels/list-labels.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-list-labels",
55
name: "List Labels",
66
description: "List all the existing labels in the connected account. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.labels/list)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/remove-label-from-email/remove-label-from-email.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-remove-label-from-email",
55
name: "Remove Label from Email",
66
description: "Remove label(s) from an email message. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/actions/send-email/send-email.mjs

+19-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "gmail-send-email",
77
name: "Send Email",
88
description: "Send an email from your Google Workspace email account. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/send)",
9-
version: "0.1.8",
9+
version: "0.1.9",
1010
type: "action",
1111
props: {
1212
gmail,
@@ -84,6 +84,7 @@ export default {
8484
label: "In Reply To",
8585
description: "Specify the `message-id` this email is replying to.",
8686
optional: true,
87+
reloadProps: true,
8788
},
8889
mimeType: {
8990
propDefinition: [
@@ -92,6 +93,22 @@ export default {
9293
],
9394
},
9495
},
96+
additionalProps(existingProps) {
97+
const props = {};
98+
if (this.inReplyTo) {
99+
props.replyAll = {
100+
type: "boolean",
101+
label: "Reply All",
102+
description: "Set to `true` to send reply to emails in the \"From\", \"To\", \"CC\", and \"BCC\" (if available) of the original email",
103+
optional: true,
104+
reloadProps: true,
105+
};
106+
}
107+
existingProps.to.hidden = !!this.replyAll;
108+
existingProps.cc.hidden = !!this.replyAll;
109+
existingProps.bcc.hidden = !!this.replyAll;
110+
return props;
111+
},
95112
async run({ $ }) {
96113
this.attachmentFilenames = utils.parseArray(this.attachmentFilenames);
97114
this.attachmentUrlsOrPaths = utils.parseArray(this.attachmentUrlsOrPaths);
@@ -100,7 +117,7 @@ export default {
100117
}
101118
const opts = await this.gmail.getOptionsToSendEmail($, this);
102119
const response = await this.gmail.sendEmail(opts);
103-
$.export("$summary", `Successfully sent email to ${this.to}`);
120+
$.export("$summary", "Successfully sent the email");
104121
return response;
105122
},
106123
};

components/gmail/actions/update-org-signature/update-org-signature.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
name: "Update Signature for Email in Organization",
99
description: `Update the signature for a specific email address in an organization.
1010
A Google Cloud service account with delegated domain-wide authority is required for this action. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs/update)`,
11-
version: "0.0.5",
11+
version: "0.0.6",
1212
type: "action",
1313
props: {
1414
gmail,

components/gmail/actions/update-primary-signature/update-primary-signature.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "gmail-update-primary-signature",
55
name: "Update Signature for Primary Email Address",
66
description: "Update the signature for the primary email address. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs/update)",
7-
version: "0.0.5",
7+
version: "0.0.6",
88
type: "action",
99
props: {
1010
gmail,

components/gmail/gmail.app.mjs

+29
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,35 @@ export default {
303303
opts.inReplyTo = inReplyTo;
304304
opts.references = inReplyTo;
305305
opts.threadId = repliedMessage.threadId;
306+
if (props.replyAll) {
307+
const from = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "from");
308+
const to = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "to");
309+
const cc = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "cc");
310+
const bcc = repliedMessage.payload.headers.find(({ name }) => name.toLowerCase() === "bcc");
311+
opts.to = from.value.split(",");
312+
opts.to.push(...to.value.split(","));
313+
314+
// Filter out the current user's email address
315+
const currentUserEmail = email.toLowerCase().trim();
316+
opts.to = opts.to.filter((addr) => {
317+
// Extract email from possible format like "Name <[email protected]>"
318+
const match = addr.match(/<(.+?)>/) || [
319+
null,
320+
addr.trim(),
321+
];
322+
return match[1].toLowerCase() !== currentUserEmail;
323+
});
324+
325+
opts.to = [
326+
...new Set(opts.to),
327+
];
328+
if (cc) {
329+
opts.cc = cc.value;
330+
}
331+
if (bcc) {
332+
opts.bcc = bcc.value;
333+
}
334+
}
306335
} catch (err) {
307336
opts.threadId = props.inReplyTo;
308337
}

components/gmail/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/gmail",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "Pipedream Gmail Components",
55
"main": "gmail.app.mjs",
66
"keywords": [

components/gmail/sources/common/base.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export default {
7575
"subject": this.getHeaderValue(headers, "subject"),
7676
"from": this.parseEmail(this.getHeaderValue(headers, "from")),
7777
"to": this.parseEmail(this.getHeaderValue(headers, "to")),
78+
"cc": this.parseEmail(this.getHeaderValue(headers, "cc")),
79+
"bcc": this.parseEmail(this.getHeaderValue(headers, "bcc")),
7880
"reply-to": this.parseEmail(this.getHeaderValue(headers, "reply-to")),
7981
"date": this.getHeaderValue(headers, "date"),
8082
"snippet": msg.snippet,

components/gmail/sources/new-attachment-received/new-attachment-received.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "gmail-new-attachment-received",
77
name: "New Attachment Received",
88
description: "Emit new event for each attachment in a message received. This source is capped at 100 max new messages per run.",
9-
version: "0.0.10",
9+
version: "0.0.11",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {

components/gmail/sources/new-email-matching-search/new-email-matching-search.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "gmail-new-email-matching-search",
77
name: "New Email Matching Search",
88
description: "Emit new event when an email matching the search criteria is received. This source is capped at 100 max new messages per run.",
9-
version: "0.0.8",
9+
version: "0.0.9",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {

components/gmail/sources/new-email-received/new-email-received.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
name: "New Email Received",
1616
description: "Emit new event when a new email is received.",
1717
type: "source",
18-
version: "0.2.3",
18+
version: "0.2.4",
1919
dedupe: "unique",
2020
props: {
2121
gmail,

components/gmail/sources/new-labeled-email/new-labeled-email.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
name: "New Labeled Email",
99
description: "Emit new event when a new email is labeled.",
1010
type: "source",
11-
version: "0.0.10",
11+
version: "0.0.11",
1212
dedupe: "unique",
1313
props: {
1414
gmail,

components/gmail/sources/new-sent-email/new-sent-email.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "gmail-new-sent-email",
77
name: "New Sent Email",
88
description: "Emit new event for each new email sent. (Maximum of 100 events emited per execution)",
9-
version: "0.0.9",
9+
version: "0.0.10",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {

components/oto/oto.app.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/test_apps_for_checking_something_005/test_apps_for_checking_something_005.app.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/test_apps_for_checking_something_006/test_apps_for_checking_something_006.app.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/transloadit/transloadit.app.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

0 commit comments

Comments
 (0)