Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gmail-add-label-to-email",
name: "Add Label to Email",
description: "Add label(s) to an email message. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
version: "0.0.14",
version: "0.0.15",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gmail-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.11",
version: "0.0.12",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/actions/archive-email/archive-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "gmail-archive-email",
name: "Archive Email",
description: "Archive an email message. [See the documentation](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
version: "0.0.9",
version: "0.0.10",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/actions/create-draft/create-draft.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "gmail-create-draft",
name: "Create Draft",
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)",
version: "0.1.9",
version: "0.1.10",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/actions/create-label/create-label.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "gmail-create-label",
name: "Create Label",
description: "Create a new label in the connected account. [See the documentation](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.labels/create)",
version: "0.0.3",
version: "0.0.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

Patch version bump looks good.

No functional changes here; the metadata bump to 0.0.4 is appropriate.

To keep versions consistent across the Gmail package and actions, you can run:


🏁 Script executed:

#!/bin/bash
# Check component package version
jq -r '.version' components/gmail/package.json

# List Gmail actions and their versions
rg -nP --glob 'components/gmail/actions/**/**/*.mjs' -C0 '^\s*version:\s*"[0-9]+\.[0-9]+\.[0-9]+"\s*,?'

# Verify new action exists (from PR context)
fd -a 'list-thread-messages.mjs' components/gmail/actions

Length of output: 1468


Patch version bump is consistent across Gmail actions.

The metadata bump to 0.0.4 aligns with peer actions in components/gmail/actions.
Optional refactors:

  • Return response.data instead of the full HTTP response for a more stable interface.
  • Make textColor/backgroundColor optional and validate hex codes.
🤖 Prompt for AI Agents
In components/gmail/actions/create-label/create-label.mjs around line 9, update
the action to (1) return response.data instead of the full HTTP response to
provide a stable interface, and (2) make textColor and backgroundColor optional
and validate any provided values as 3- or 6-character hex codes (with optional
leading '#'); if invalid, throw a clear validation error, and if absent omit
them from the request payload or use safe defaults. Ensure any related
types/exports and tests are adjusted to expect response.data.

annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/actions/delete-email/delete-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "gmail-delete-email",
name: "Delete Email",
description: "Moves the specified message to the trash. [See the documentation](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/trash)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "gmail-download-attachment",
name: "Download Attachment",
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)",
version: "0.0.14",
version: "0.0.15",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/actions/find-email/find-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "gmail-find-email",
name: "Find Email",
description: "Find an email using Google's Search Engine. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list)",
version: "0.1.8",
version: "0.1.9",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "gmail-get-send-as-alias",
name: "Get Send As Alias",
description: "Get a send as alias for the authenticated user. [See the documentation](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.sendAs/get)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/actions/list-labels/list-labels.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gmail-list-labels",
name: "List Labels",
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)",
version: "0.0.10",
version: "0.0.11",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gmail-list-send-as-aliases",
name: "List Send As Aliases",
description: "List all send as aliases for the authenticated user. [See the documentation](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.sendAs/list)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import gmail from "../../gmail.app.mjs";

export default {
key: "gmail-list-thread-messages",
name: "List Thread Messages",
description: "List messages in a thread. [See the docs](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/get)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
gmail,
threadId: {
propDefinition: [
gmail,
"threadId",
],
},
},
async run({ $ }) {
const { messages = [] } = await this.gmail.getThread({
threadId: this.threadId,
});

const suffix = messages.length === 1
? ""
: "s";
$.export("$summary", `Successfully listed ${messages.length} message${suffix}`);
return messages;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gmail-remove-label-from-email",
name: "Remove Label from Email",
description: "Remove label(s) from an email message. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)",
version: "0.0.12",
version: "0.0.13",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/actions/send-email/send-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "gmail-send-email",
name: "Send Email",
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)",
version: "0.2.1",
version: "0.2.2",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: "Update Signature for Email in Organization",
description: `Update the signature for a specific email address in an organization.
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)`,
version: "0.0.13",
version: "0.0.14",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "gmail-update-primary-signature",
name: "Update Signature for Primary Email Address",
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)",
version: "0.0.13",
version: "0.0.14",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
45 changes: 43 additions & 2 deletions components/gmail/gmail.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {
axios,
ConfigurationError,
} from "@pipedream/platform";
import { JWT } from "google-auth-library";
import { convert } from "html-to-text";
import mime from "mime/types/standard.js";
import MailComposer from "nodemailer/lib/mail-composer/index.js";
import addressparser from "nodemailer/lib/addressparser/index.js";
import MailComposer from "nodemailer/lib/mail-composer/index.js";
import constants from "./common/constants.mjs";
import { JWT } from "google-auth-library";

export default {
type: "app",
Expand Down Expand Up @@ -166,6 +166,33 @@ export default {
}
},
},
threadId: {
type: "string",
label: "Thread ID",
description: "Identifier of the thread to list messages from",
async options({ prevContext }) {
try {
const {
threads, nextPageToken,
} = await this.listThreads({
pageToken: prevContext?.nextPageToken,
});
return {
options: threads.map(({
id: value, snippet: label,
}) => ({
value,
label,
})),
context: {
nextPageToken,
},
};
} catch {
return [];
}
},
},
q: {
type: "string",
label: "Search Query",
Expand Down Expand Up @@ -421,6 +448,20 @@ export default {
});
return data;
},
async listThreads(opts = {}) {
const { data } = await this._client().users.threads.list({
userId: constants.USER_ID,
...opts,
});
return data;
},
async getThread({ threadId }) {
const { data } = await this._client().users.threads.get({
userId: constants.USER_ID,
id: threadId,
});
return data;
},
async getProfile() {
const { data } = await this._client().users.getProfile({
userId: constants.USER_ID,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/gmail",
"version": "1.3.5",
"version": "1.4.0",
"description": "Pipedream Gmail Components",
"main": "gmail.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
key: "gmail-new-attachment-received",
name: "New Attachment Received",
description: "Emit new event for each attachment in a message received. This source is capped at 100 max new messages per run.",
version: "0.2.2",
version: "0.2.3",
type: "source",
dedupe: "unique",
props: {
gmail,
info: {

Check warning on line 16 in components/gmail/sources/new-attachment-received/new-attachment-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 16 in components/gmail/sources/new-attachment-received/new-attachment-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "Note: May not emit events for attachments sent via a Gmail alias. [See issue](https://github.com/PipedreamHQ/pipedream/issues/15309) for more information.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "gmail-new-email-matching-search",
name: "New Email Matching Search",
description: "Emit new event when an email matching the search criteria is received. This source is capped at 100 max new messages per run.",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
name: "New Email Received",
description: "Emit new event when a new email is received.",
type: "source",
version: "0.3.2",
version: "0.3.3",
dedupe: "unique",
props: {
gmail,
Expand Down Expand Up @@ -47,14 +47,14 @@
description: "Convert the payload response into a single text field. **This reduces the size of the payload and makes it easier for LLMs work with.**",
default: false,
},
serviceAccountKeyJson: {

Check warning on line 50 in components/gmail/sources/new-email-received/new-email-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop serviceAccountKeyJson must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "string",
label: "Service Account Key JSON",
optional: true,
hidden: true,
reloadProps: true,
},
serviceAccountKeyJsonInstructions: {

Check warning on line 57 in components/gmail/sources/new-email-received/new-email-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop serviceAccountKeyJsonInstructions must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 57 in components/gmail/sources/new-email-received/new-email-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop serviceAccountKeyJsonInstructions must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `1) [Create a service account in GCP](https://cloud.google.com/iam/docs/creating-managing-service-accounts) and set the following permission: **Pub/Sub Admin**
Expand Down Expand Up @@ -110,7 +110,7 @@
description: "Emails with the specified labels will be excluded from results",
optional: true,
},
permissionAlert: {

Check warning on line 113 in components/gmail/sources/new-email-received/new-email-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop permissionAlert must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 113 in components/gmail/sources/new-email-received/new-email-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop permissionAlert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "error",
content: `Unable to grant publish permission to Gmail API service account.
Expand All @@ -123,7 +123,7 @@
`,
hidden: true,
},
latencyWarningAlert: {

Check warning on line 126 in components/gmail/sources/new-email-received/new-email-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop latencyWarningAlert must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 126 in components/gmail/sources/new-email-received/new-email-received.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop latencyWarningAlert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "warning",
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: "New Labeled Email",
description: "Emit new event when a new email is labeled.",
type: "source",
version: "0.1.2",
version: "0.1.3",
dedupe: "unique",
props: {
gmail,
Expand Down
2 changes: 1 addition & 1 deletion components/gmail/sources/new-sent-email/new-sent-email.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "gmail-new-sent-email",
name: "New Sent Email",
description: "Emit new event for each new email sent. (Maximum of 100 events emited per execution)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix typo in description ("emited" → "emitted").

-  description: "Emit new event for each new email sent. (Maximum of 100 events emited per execution)",
+  description: "Emit new event for each new email sent. (Maximum of 100 events emitted per execution)",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
description: "Emit new event for each new email sent. (Maximum of 100 events emited per execution)",
description: "Emit new event for each new email sent. (Maximum of 100 events emitted per execution)",
🤖 Prompt for AI Agents
In components/gmail/sources/new-sent-email/new-sent-email.mjs around line 8, the
description string contains a typo ("emited"); update the description to use the
correct spelling "emitted" so it reads: 'Emit new event for each new email sent.
(Maximum of 100 events emitted per execution)'. Ensure only the word is
corrected and punctuation/spacing remain unchanged.

version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Loading