Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(gmail): recipient tabs, rich text bodies, message picker and a filter builder for Find Email (#15753)

Talal Jaber1a64357d6959
diff --git a/bun.lock b/bun.lock
index bf4312062fa..c4e9e98326d 100644
--- a/bun.lock
+++ b/bun.lock
@@ -3716,7 +3716,7 @@
},
"packages/pieces/community/gmail": {
"name": "@activepieces/piece-gmail",
- "version": "0.16.0",
+ "version": "0.17.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/gmail/package.json b/packages/pieces/community/gmail/package.json
index c536f1ad5dd..501d9d25e99 100644
--- a/packages/pieces/community/gmail/package.json
+++ b/packages/pieces/community/gmail/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-gmail",
- "version": "0.16.0",
+ "version": "0.17.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
diff --git a/packages/pieces/community/gmail/src/i18n/de.json b/packages/pieces/community/gmail/src/i18n/de.json
index 24ba0a235df..3a99d358d80 100644
--- a/packages/pieces/community/gmail/src/i18n/de.json
+++ b/packages/pieces/community/gmail/src/i18n/de.json
@@ -125,5 +125,15 @@
"Only trigger for emails containing this text in the subject.": "Trigger nur für E-Mails, die diesen Text im Betreff enthalten.",
"Filter by Gmail label.": "Nach Google Mail-Label filtern.",
"Filter by Gmail category.": "Nach Google Mail-Kategorie filtern.",
- "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Trigger nur für Anhänge mit dieser Dateiendung (z.B. pdf, jpg, docx)."
+ "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Trigger nur für Anhänge mit dieser Dateiendung (z.B. pdf, jpg, docx).",
+ "Plain Text": "Einfacher Text",
+ "Reply To": "Antwort an",
+ "Save as Draft": "Als Entwurf speichern",
+ "Reply": "Antwort",
+ "Create Label": "Label erstellen",
+ "Label Name": "Labelname",
+ "Add Label to Email": "Label zur E-Mail hinzufügen",
+ "Archive Email": "E-Mail archivieren",
+ "Response is Binary": "Antwort ist binär",
+ "Return Error as Output": "Rückgabewert Fehler als Ausgabe"
}
\ No newline at end of file
diff --git a/packages/pieces/community/gmail/src/i18n/es.json b/packages/pieces/community/gmail/src/i18n/es.json
index 1c62e1c153c..a8a96e7c89f 100644
--- a/packages/pieces/community/gmail/src/i18n/es.json
+++ b/packages/pieces/community/gmail/src/i18n/es.json
@@ -125,5 +125,17 @@
"Only trigger for emails containing this text in the subject.": "Disparador sólo para correos electrónicos que contengan este texto en el tema.",
"Filter by Gmail label.": "Filtrar por etiqueta Gmail.",
"Filter by Gmail category.": "Filtrar por categoría de Gmail.",
- "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Sólo para archivos adjuntos con esta extensión de archivo (por ejemplo, pdf, jpg, docx)."
+ "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Sólo para archivos adjuntos con esta extensión de archivo (por ejemplo, pdf, jpg, docx).",
+ "Bcc": "Cco",
+ "Plain Text": "Texto simple",
+ "Reply To": "Responder a",
+ "Save as Draft": "Guardar como borrador",
+ "Reply": "Responder",
+ "Create Label": "Crear etiqueta",
+ "Label Name": "Nombre de etiqueta",
+ "Add Label to Email": "Añadir etiqueta al email",
+ "Archive Email": "Archivar Email",
+ "Response is Binary": "Respuesta es binaria",
+ "Return Error as Output": "Devolver error como salida",
+ "Timeout": "Tiempo agotado"
}
\ No newline at end of file
diff --git a/packages/pieces/community/gmail/src/i18n/fr.json b/packages/pieces/community/gmail/src/i18n/fr.json
index 4955f7ffaa3..6f1bbd44f48 100644
--- a/packages/pieces/community/gmail/src/i18n/fr.json
+++ b/packages/pieces/community/gmail/src/i18n/fr.json
@@ -125,5 +125,17 @@
"Only trigger for emails containing this text in the subject.": "Ne déclenche que pour les e-mails contenant ce texte dans le sujet.",
"Filter by Gmail label.": "Filtrer par étiquette Gmail.",
"Filter by Gmail category.": "Filtrer par catégorie Gmail.",
- "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Déclenche uniquement les pièces jointes avec cette extension de fichier (par exemple, pdf, jpg, docx)."
+ "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Déclenche uniquement les pièces jointes avec cette extension de fichier (par exemple, pdf, jpg, docx).",
+ "Bcc": "Cci",
+ "Plain Text": "Texte brut",
+ "Reply To": "Répondre à",
+ "Save as Draft": "Enregistrer en tant que brouillon",
+ "Reply": "Répondre",
+ "Create Label": "Créer une étiquette",
+ "Label Name": "Nom de l'étiquette",
+ "Add Label to Email": "Ajouter une étiquette à l'e-mail",
+ "Archive Email": "Archiver l'e-mail",
+ "Response is Binary": "La réponse est binaire",
+ "Return Error as Output": "Erreur de retour en sortie",
+ "Timeout": "Délai d'expiration"
}
\ No newline at end of file
diff --git a/packages/pieces/community/gmail/src/i18n/ja.json b/packages/pieces/community/gmail/src/i18n/ja.json
index edd7f2a5248..7a238630134 100644
--- a/packages/pieces/community/gmail/src/i18n/ja.json
+++ b/packages/pieces/community/gmail/src/i18n/ja.json
@@ -125,5 +125,16 @@
"Only trigger for emails containing this text in the subject.": "件名にこのテキストを含むメールのみトリガーします。",
"Filter by Gmail label.": "Gmail のラベルで絞り込みます。",
"Filter by Gmail category.": "Gmailカテゴリでフィルター",
- "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "このファイル拡張子を持つ添付ファイルのみトリガーします (例: pdf, jpg, docx)。"
+ "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "このファイル拡張子を持つ添付ファイルのみトリガーします (例: pdf, jpg, docx)。",
+ "Plain Text": "プレーンテキスト",
+ "Reply To": "返信先",
+ "Save as Draft": "下書きとして保存",
+ "Reply": "返信",
+ "Create Label": "ラベルを作成",
+ "Label Name": "ラベル名",
+ "Add Label to Email": "電子メールにラベルを追加",
+ "Archive Email": "電子メールをアーカイブ",
+ "Response is Binary": "応答はバイナリです",
+ "Return Error as Output": "出力としてエラーを返します",
+ "Timeout": "タイムアウト"
}
\ No newline at end of file
diff --git a/packages/pieces/community/gmail/src/i18n/nl.json b/packages/pieces/community/gmail/src/i18n/nl.json
index 2f0364876a0..e5edb267130 100644
--- a/packages/pieces/community/gmail/src/i18n/nl.json
+++ b/packages/pieces/community/gmail/src/i18n/nl.json
@@ -125,5 +125,16 @@
"Only trigger for emails containing this text in the subject.": "Alleen activeren voor e-mails met deze tekst in het onderwerp.",
"Filter by Gmail label.": "Filter op Gmail label.",
"Filter by Gmail category.": "Filteren op Gmail categorie.",
- "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Alleen trigger voor bijlagen met deze bestandsextensie (bijv. pdf, jpg, docx)."
+ "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Alleen trigger voor bijlagen met deze bestandsextensie (bijv. pdf, jpg, docx).",
+ "Plain Text": "Onopgemaakte tekst",
+ "Reply To": "Antwoord aan",
+ "Save as Draft": "Opslaan als concept",
+ "Reply": "Beantwoorden",
+ "Create Label": "Label maken",
+ "Label Name": "Label naam",
+ "Add Label to Email": "Label toevoegen aan e-mail",
+ "Archive Email": "Archief e-mail",
+ "Response is Binary": "Antwoord is binair",
+ "Return Error as Output": "Retourfout als uitvoer",
+ "Timeout": "Time-out"
}
\ No newline at end of file
diff --git a/packages/pieces/community/gmail/src/i18n/pt.json b/packages/pieces/community/gmail/src/i18n/pt.json
index c36ac02a926..1e43cb18a79 100644
--- a/packages/pieces/community/gmail/src/i18n/pt.json
+++ b/packages/pieces/community/gmail/src/i18n/pt.json
@@ -125,5 +125,17 @@
"Only trigger for emails containing this text in the subject.": "Ativar apenas os e-mails que contém este texto no assunto.",
"Filter by Gmail label.": "Filtrar por rótulo do Gmail.",
"Filter by Gmail category.": "Filtrar por categoria do Gmail.",
- "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Apenas gatilho para anexos com esta extensão de arquivo (por exemplo, pdf, jpg, docx)."
+ "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Apenas gatilho para anexos com esta extensão de arquivo (por exemplo, pdf, jpg, docx).",
+ "Bcc": "CCO",
+ "Plain Text": "Texto sem Formatação",
+ "Reply To": "Responder a",
+ "Save as Draft": "Salvar como Rascunho",
+ "Reply": "Responder",
+ "Create Label": "Criar etiqueta",
+ "Label Name": "Nome da etiqueta",
+ "Add Label to Email": "Adicionar etiqueta ao e-mail",
+ "Archive Email": "Arquivo Email",
+ "Response is Binary": "Resposta é Binária",
+ "Return Error as Output": "Erro ao retornar como saída",
+ "Timeout": "Tempo esgotado"
}
\ No newline at end of file
diff --git a/packages/pieces/community/gmail/src/i18n/ru.json b/packages/pieces/community/gmail/src/i18n/ru.json
index bb58e02c104..7488ce1c76f 100644
--- a/packages/pieces/community/gmail/src/i18n/ru.json
+++ b/packages/pieces/community/gmail/src/i18n/ru.json
@@ -59,5 +59,21 @@
"Updates": "Обновления",
"Forums": "Форумы",
"Reservations": "Оговорки",
- "Purchases": "Покупки"
+ "Purchases": "Покупки",
+ "To": "Кому",
+ "Plain Text": "Обычный текст",
+ "Reply To": "Ответить",
+ "From": "От",
+ "Attachments": "Вложения",
+ "Reply to Email": "Ответить на E-mail",
+ "Message": "Сообщение",
+ "Reply": "Ответ",
+ "Find Email": "Найти E-mail",
+ "Max Results": "Макс. результатов",
+ "None": "Нет",
+ "Form Data": "Данные формы",
+ "Raw": "Сырье",
+ "Response is Binary": "Ответ является двоичным",
+ "File Extension": "Расширение файла",
+ "New Label": "Новая метка"
}
\ No newline at end of file
diff --git a/packages/pieces/community/gmail/src/i18n/translation.json b/packages/pieces/community/gmail/src/i18n/translation.json
index 559a142c6df..366b388aa1a 100644
--- a/packages/pieces/community/gmail/src/i18n/translation.json
+++ b/packages/pieces/community/gmail/src/i18n/translation.json
@@ -24,13 +24,24 @@
"Get Profile": "Get Profile",
"List History": "List History",
"Stop Watch": "Stop Watch",
+ "Create Label": "Create Label",
+ "Add Label to Email": "Add Label to Email",
+ "Remove Label From Email": "Remove Label From Email",
+ "Archive Email": "Archive Email",
+ "Archive Message": "Archive Message",
+ "Get or Create Label": "Get or Create Label",
+ "Modify Labels": "Modify Labels",
+ "Trash Message": "Trash Message",
+ "Untrash Message": "Untrash Message",
+ "Update Label": "Update Label",
+ "Modify Thread Labels": "Modify Thread Labels",
"Custom API Call": "Custom API Call",
"Send an email through a Gmail account": "Send an email through a Gmail account",
- "Send approval request email and then wait until the email is approved or disapproved": "Send approval request email and then wait until the email is approved or disapproved",
+ "Send an email with an approval link and pause until it is answered.": "Send an email with an approval link and pause until it is answered.",
"Reply to an existing email.": "Reply to an existing email.",
"Creates a draft reply to an existing email.": "Creates a draft reply to an existing email.",
- "Get an email via Id.": "Get an email via Id.",
- "Find emails using advanced search criteria. If no filters are provided, the latest emails are returned.": "Find emails using advanced search criteria. If no filters are provided, the latest emails are returned.",
+ "Read one email by its message ID, including attachments.": "Read one email by its message ID, including attachments.",
+ "Search your mailbox; with no filters it returns the latest emails.": "Search your mailbox; with no filters it returns the latest emails.",
"Reply to an existing email thread.": "Reply to an existing email thread.",
"Get a single email message by its ID.": "Get a single email message by its ID.",
"Search emails using advanced criteria. If no filters are provided, the latest emails are returned.": "Search emails using advanced criteria. If no filters are provided, the latest emails are returned.",
@@ -49,88 +60,100 @@
"Get the connected mailbox profile.": "Get the connected mailbox profile.",
"List mailbox changes since a given history ID.": "List mailbox changes since a given history ID.",
"Stop push notifications on the mailbox.": "Stop push notifications on the mailbox.",
+ "Create a new label in the mailbox.": "Create a new label in the mailbox.",
+ "Apply a label to an email message.": "Apply a label to an email message.",
+ "Remove a label from an email message.": "Remove a label from an email message.",
+ "Archive an email message by removing it from the inbox.": "Archive an email message by removing it from the inbox.",
+ "Get an existing label by name, creating it first if it does not exist.": "Get an existing label by name, creating it first if it does not exist.",
+ "Add and/or remove labels across one or more email messages in a single call.": "Add and/or remove labels across one or more email messages in a single call.",
+ "Move an email message to Trash.": "Move an email message to Trash.",
+ "Restore an email message from Trash.": "Restore an email message from Trash.",
+ "Rename, recolor, or change the visibility of a user label.": "Rename, recolor, or change the visibility of a user label.",
+ "Add and/or remove labels across every message in a thread in a single call.": "Add and/or remove labels across every message in a thread in a single call.",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
- "Receiver Email (To)": "Receiver Email (To)",
- "CC Email": "CC Email",
- "BCC Email": "BCC Email",
+ "To": "To",
+ "Cc": "Cc",
+ "Bcc": "Bcc",
"Subject": "Subject",
"Body Type": "Body Type",
"Body": "Body",
- "Reply-To Email": "Reply-To Email",
+ "Reply To": "Reply To",
"Sender Name": "Sender Name",
- "Sender Email": "Sender Email",
+ "From": "From",
"Attachments": "Attachments",
- "File": "File",
- "In reply to": "In reply to",
- "Create draft": "Create draft",
+ "In Reply To": "In Reply To",
+ "Save as Draft": "Save as Draft",
"Message": "Message",
"Reply Type": "Reply Type",
- "Reply Body": "Reply Body",
"Attachment": "Attachment",
"Attachment Name": "Attachment Name",
- "Draft Reply Body": "Draft Reply Body",
"Include Original Message": "Include Original Message",
- "Message ID": "Message ID",
- "Email sender": "Email sender",
- "Email recipient": "Email recipient",
- "Email subject": "Email subject",
- "Email Content": "Email Content",
"Has Attachment": "Has Attachment",
"Label": "Label",
"Category": "Category",
- "After Date": "After Date",
- "Before Date": "Before Date",
- "Include Spam & Trash": "Include Spam & Trash",
+ "After": "After",
+ "Before": "Before",
+ "Spam and Trash": "Spam and Trash",
"Max Results": "Max Results",
"Thread ID": "Thread ID",
"Format": "Format",
+ "Receiver Email (To)": "Receiver Email (To)",
+ "CC Email": "CC Email",
+ "BCC Email": "BCC Email",
+ "Sender Email": "Sender Email",
"Draft ID": "Draft ID",
"Search Query": "Search Query",
"Label IDs": "Label IDs",
+ "Include Spam & Trash": "Include Spam & Trash",
+ "Message ID": "Message ID",
"Attachment ID": "Attachment ID",
"File Name": "File Name",
"Note": "Note",
"Label ID": "Label ID",
"Start History ID": "Start History ID",
"History Types": "History Types",
+ "Label Name": "Label Name",
+ "Message IDs": "Message IDs",
+ "Label IDs to Add": "Label IDs to Add",
+ "Label IDs to Remove": "Label IDs to Remove",
+ "New Name": "New Name",
+ "Label List Visibility": "Label List Visibility",
+ "Message List Visibility": "Message List Visibility",
+ "Background Color (hex)": "Background Color (hex)",
+ "Text Color (hex)": "Text Color (hex)",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
- "Response is Binary ?": "Response is Binary ?",
- "No Error on Failure": "No Error on Failure",
- "Timeout (in seconds)": "Timeout (in seconds)",
+ "Response is Binary": "Response is Binary",
+ "Return Error as Output": "Return Error as Output",
+ "Timeout": "Timeout",
"Follow redirects": "Follow redirects",
- "Body for the email you want to send": "Body for the email you want to send",
- "Email address to set as the \"Reply-To\" header": "Email address to set as the \"Reply-To\" header",
- "The address must be listed in your GMail account's settings": "The address must be listed in your GMail account's settings",
- "Reply to this Message-ID": "Reply to this Message-ID",
- "Create draft without sending the actual email": "Create draft without sending the actual email",
- "The email address of the recipient who will receive the approval request.": "The email address of the recipient who will receive the approval request.",
- "The email addresses of the recipients who will receive a carbon copy of the approval request.": "The email addresses of the recipients who will receive a carbon copy of the approval request.",
- "The email addresses of the recipients who will receive a blind carbon copy of the approval request.": "The email addresses of the recipients who will receive a blind carbon copy of the approval request.",
- "The subject of the approval request email.": "The subject of the approval request email.",
- "Select a message from the list or enter a message ID manually.": "Select a message from the list or enter a message ID manually.",
- "Choose whether to reply to sender only or to all recipients": "Choose whether to reply to sender only or to all recipients",
- "Your reply message content": "Your reply message content",
- "Optional sender name to display": "Optional sender name to display",
- "Optional file to attach to your reply": "Optional file to attach to your reply",
- "Custom name for the attachment": "Custom name for the attachment",
- "Your draft reply message content": "Your draft reply message content",
- "Include the original message content in the draft reply": "Include the original message content in the draft reply",
- "Optional file to attach to your draft reply": "Optional file to attach to your draft reply",
- "The messageId of the mail to read.": "The messageId of the mail to read.",
- "Optional filteration, leave empty to filter based on the email sender": "Optional filteration, leave empty to filter based on the email sender",
- "Optional filteration, leave empty to filter based on the email recipient": "Optional filteration, leave empty to filter based on the email recipient",
- "The email subject": "The email subject",
- "Search for specific text within email body": "Search for specific text within email body",
- "Only find emails with attachments": "Only find emails with attachments",
- "Search for emails with specific attachment filename": "Search for emails with specific attachment filename",
- "Optional filteration, leave unselected to filter based on the email label": "Optional filteration, leave unselected to filter based on the email label",
- "Optional filteration, leave unselected to filter based on the email category": "Optional filteration, leave unselected to filter based on the email category",
- "Find emails sent after this date": "Find emails sent after this date",
- "Find emails sent before this date": "Find emails sent before this date",
- "Include emails from Spam and Trash folders in search results": "Include emails from Spam and Trash folders in search results",
- "Maximum number of emails to return (1-500)": "Maximum number of emails to return (1-500)",
+ "How the text in Body is interpreted.": "How the text in Body is interpreted.",
+ "Replies go to these addresses instead of the sender.": "Replies go to these addresses instead of the sender.",
+ "Name shown in the inbox instead of your address.": "Name shown in the inbox instead of your address.",
+ "A send-as address already set up in your Gmail settings.": "A send-as address already set up in your Gmail settings.",
+ "Message-ID header of the email to thread this under.": "Message-ID header of the email to thread this under.",
+ "Save to Drafts instead of sending.": "Save to Drafts instead of sending.",
+ "Address that receives the approval request.": "Address that receives the approval request.",
+ "Text shown above the Review & Respond button.": "Text shown above the Review & Respond button.",
+ "Pick a recent message, or map its ID from a trigger or Find Email.": "Pick a recent message, or map its ID from a trigger or Find Email.",
+ "Reply to the sender only, or to everyone on the thread.": "Reply to the sender only, or to everyone on the thread.",
+ "File to attach.": "File to attach.",
+ "Overrides the uploaded file name.": "Overrides the uploaded file name.",
+ "Quote the original message below your reply.": "Quote the original message below your reply.",
+ "Only emails sent from this address.": "Only emails sent from this address.",
+ "Only emails sent to this address.": "Only emails sent to this address.",
+ "Only emails whose subject contains this text.": "Only emails whose subject contains this text.",
+ "Only emails with this text in the body.": "Only emails with this text in the body.",
+ "Only emails with at least one attachment.": "Only emails with at least one attachment.",
+ "Only emails with an attachment of this file name.": "Only emails with an attachment of this file name.",
+ "Only emails carrying this label.": "Only emails carrying this label.",
+ "Only emails in this inbox tab, such as Primary or Promotions.": "Only emails in this inbox tab, such as Primary or Promotions.",
+ "Only emails received after this date.": "Only emails received after this date.",
+ "Only emails received before this date.": "Only emails received before this date.",
+ "Also search the Spam and Trash folders.": "Also search the Spam and Trash folders.",
+ "Newest first, up to 500.": "Newest first, up to 500.",
+ "Message ID from a Find Email step or a Gmail trigger.": "Message ID from a Find Email step or a Gmail trigger.",
"The thread Id of the mail to read": "The thread Id of the mail to read",
"Format of the mail": "Format of the mail",
"Body for the draft email.": "Body for the draft email.",
@@ -158,14 +181,33 @@
"Return changes after this history ID (obtain from Get Profile or a previous history result).": "Return changes after this history ID (obtain from Get Profile or a previous history result).",
"Limit results to these change types (leave empty for all).": "Limit results to these change types (leave empty for all).",
"Maximum number of history records to return (1-500).": "Maximum number of history records to return (1-500).",
+ "Appears in your Gmail label list.": "Appears in your Gmail label list.",
+ "Label to add.": "Label to add.",
+ "Label to remove.": "Label to remove.",
+ "The exact display name of the label, e.g. \"Follow Up\". Matching is case-sensitive.": "The exact display name of the label, e.g. \"Follow Up\". Matching is case-sensitive.",
+ "The Gmail message IDs to modify (obtain from Search Email or Get Message). Up to 1000 per call.": "The Gmail message IDs to modify (obtain from Search Email or Get Message). Up to 1000 per call.",
+ "Label IDs to add to every message listed above (obtain from List Labels or Get or Create Label).": "Label IDs to add to every message listed above (obtain from List Labels or Get or Create Label).",
+ "Label IDs to remove from every message listed above (obtain from List Labels).": "Label IDs to remove from every message listed above (obtain from List Labels).",
+ "The Gmail message ID to move to Trash (obtain from Search Email or Get Message).": "The Gmail message ID to move to Trash (obtain from Search Email or Get Message).",
+ "The Gmail message ID to restore from Trash (obtain from Search Email or Get Message).": "The Gmail message ID to restore from Trash (obtain from Search Email or Get Message).",
+ "The ID of the user label to update (obtain from List Labels).": "The ID of the user label to update (obtain from List Labels).",
+ "Leave empty to keep the current name.": "Leave empty to keep the current name.",
+ "Leave unselected to keep the current setting.": "Leave unselected to keep the current setting.",
+ "Leave empty to keep the current background color.": "Leave empty to keep the current background color.",
+ "Leave empty to keep the current text color.": "Leave empty to keep the current text color.",
+ "The Gmail thread ID to modify (obtain from Search Email or Get Thread).": "The Gmail thread ID to modify (obtain from Search Email or Get Thread).",
+ "Label IDs to add to every message in the thread (obtain from List Labels or Get or Create Label).": "Label IDs to add to every message in the thread (obtain from List Labels or Get or Create Label).",
+ "Label IDs to remove from every message in the thread (obtain from List Labels).": "Label IDs to remove from every message in the thread (obtain from List Labels).",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
+ "Appended to the URL as ?key=value.": "Appended to the URL as ?key=value.",
"Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
- "plain text": "plain text",
- "html": "html",
- "Reply (to sender only)": "Reply (to sender only)",
- "Reply All (to all recipients)": "Reply All (to all recipients)",
- "Plain text": "Plain text",
+ "On a failed request, output the error instead of failing the step.": "On a failed request, output the error instead of failing the step.",
+ "Seconds to wait for a response. Empty: up to the flow limit (10 min).": "Seconds to wait for a response. Empty: up to the flow limit (10 min).",
+ "Follow 3xx redirects instead of returning them as the response.": "Follow 3xx redirects instead of returning them as the response.",
+ "Plain Text": "Plain Text",
"HTML": "HTML",
+ "Reply": "Reply",
+ "Reply All": "Reply All",
"Primary": "Primary",
"Social": "Social",
"Promotions": "Promotions",
@@ -177,35 +219,30 @@
"Full": "Full",
"Raw": "Raw",
"Metadata": "Metadata",
+ "plain text": "plain text",
+ "html": "html",
"Message Added": "Message Added",
"Message Deleted": "Message Deleted",
"Label Added": "Label Added",
"Label Removed": "Label Removed",
+ "Show": "Show",
+ "Show if unread": "Show if unread",
+ "Hide": "Hide",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
- "None": "None",
- "JSON": "JSON",
- "Form Data": "Form Data",
"New Email": "New Email",
"New Labeled Email": "New Labeled Email",
"New Attachment": "New Attachment",
"New Label": "New Label",
- "Triggers when new mail is found in your Gmail inbox": "Triggers when new mail is found in your Gmail inbox",
- "Triggers when a label is added to an email": "Triggers when a label is added to an email",
- "Triggers when an email with an attachment arrives.": "Triggers when an email with an attachment arrives.",
- "Triggers when a new label is created.": "Triggers when a new label is created.",
- "From": "From",
- "To": "To",
- "Subject Contains": "Subject Contains",
+ "Triggers when a new email matching the filters arrives.": "Triggers when a new email matching the filters arrives.",
+ "Triggers when this label is added to an email.": "Triggers when this label is added to an email.",
+ "Triggers for each attachment on a new email.": "Triggers for each attachment on a new email.",
+ "Triggers when a new label is created in Gmail.": "Triggers when a new label is created in Gmail.",
"File Extension": "File Extension",
- "Filter by sender email.": "Filter by sender email.",
- "Filter by recipient email.": "Filter by recipient email.",
- "Only trigger for emails containing this text in the subject.": "Only trigger for emails containing this text in the subject.",
- "Filter by Gmail label.": "Filter by Gmail label.",
- "Filter by Gmail category.": "Filter by Gmail category.",
- "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).": "Only trigger for attachments with this file extension (e.g., pdf, jpg, docx)."
+ "Emails that receive this label start the flow.": "Emails that receive this label start the flow.",
+ "Only attachments with this extension.": "Only attachments with this extension."
}
\ No newline at end of file
diff --git a/packages/pieces/community/gmail/src/index.ts b/packages/pieces/community/gmail/src/index.ts
index cccc2fef590..7fde14068cb 100644
--- a/packages/pieces/community/gmail/src/index.ts
+++ b/packages/pieces/community/gmail/src/index.ts
@@ -51,7 +51,7 @@ export {
} from './lib/auth';
export const gmail = createPiece({
- minimumSupportedRelease: '0.87.0',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/gmail.png',
categories: [
PieceCategory.COMMUNICATION,
diff --git a/packages/pieces/community/gmail/src/lib/actions/add-label-to-email-action.ts b/packages/pieces/community/gmail/src/lib/actions/add-label-to-email-action.ts
index 1f8fe75b36b..83063041e49 100644
--- a/packages/pieces/community/gmail/src/lib/actions/add-label-to-email-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/add-label-to-email-action.ts
@@ -1,4 +1,4 @@
-import { createAction, Property } from '@activepieces/pieces-framework';
+import { createAction } from '@activepieces/pieces-framework';
import { gmailAuth, createGoogleClient } from '../auth';
import { gmail as googleGmail } from '@googleapis/gmail';
import { GmailProps } from '../common/props';
@@ -12,14 +12,9 @@ export const gmailAddLabelToEmailAction = createAction({
description: 'Apply a label to an email message.',
audience: 'human',
props: {
- message_id: Property.ShortText({
- displayName: 'Message ID',
- description:
- 'The Gmail message ID to label (obtain from Search Email or Get Message).',
- required: true,
- }),
+ message_id: GmailProps.message,
label: GmailProps.label({
- description: 'The label to apply to the message.',
+ description: 'Label to add.',
required: true,
}),
},
diff --git a/packages/pieces/community/gmail/src/lib/actions/ai-archive-email-action.ts b/packages/pieces/community/gmail/src/lib/actions/ai-archive-email-action.ts
index 04c353ea789..3578311bb6a 100644
--- a/packages/pieces/community/gmail/src/lib/actions/ai-archive-email-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/ai-archive-email-action.ts
@@ -1,6 +1,6 @@
-import { createAction } from '@activepieces/pieces-framework';
+import { createAction, Property } from '@activepieces/pieces-framework';
import { gmailAuth } from '../auth';
-import { gmailArchiveEmailAction } from './archive-email-action';
+import { archiveGmailMessage } from './archive-email-action';
import { gmailArchiveEmailActionOutputSchema } from '../output-schemas';
export const gmailAiArchiveMessageAction = createAction({
@@ -16,6 +16,17 @@ export const gmailAiArchiveMessageAction = createAction({
idempotent: true,
},
outputSchema: gmailArchiveEmailActionOutputSchema,
- props: gmailArchiveEmailAction.props,
- run: gmailArchiveEmailAction.run,
+ props: {
+ message_id: Property.ShortText({
+ displayName: 'Message',
+ description: 'Message ID from a Find Email step or a Gmail trigger.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return archiveGmailMessage({
+ auth: context.auth,
+ messageId: context.propsValue.message_id,
+ });
+ },
});
diff --git a/packages/pieces/community/gmail/src/lib/actions/ai-get-message-action.ts b/packages/pieces/community/gmail/src/lib/actions/ai-get-message-action.ts
index 83deea0b748..8586bb235e0 100644
--- a/packages/pieces/community/gmail/src/lib/actions/ai-get-message-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/ai-get-message-action.ts
@@ -1,6 +1,6 @@
-import { createAction } from '@activepieces/pieces-framework';
+import { createAction, Property } from '@activepieces/pieces-framework';
import { gmailAuth } from '../auth';
-import { gmailGetEmailAction } from './get-mail-action';
+import { getGmailMessage } from './get-mail-action';
import { gmailAiGetMessageActionOutputSchema } from '../output-schemas';
export const gmailAiGetMessageAction = createAction({
@@ -16,6 +16,18 @@ export const gmailAiGetMessageAction = createAction({
idempotent: true,
},
outputSchema: gmailAiGetMessageActionOutputSchema,
- props: gmailGetEmailAction.props,
- run: gmailGetEmailAction.run,
+ props: {
+ message_id: Property.ShortText({
+ displayName: 'Message',
+ description: 'Message ID from a Find Email step or a Gmail trigger.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return getGmailMessage({
+ auth: context.auth,
+ messageId: context.propsValue.message_id,
+ files: context.files,
+ });
+ },
});
diff --git a/packages/pieces/community/gmail/src/lib/actions/archive-email-action.ts b/packages/pieces/community/gmail/src/lib/actions/archive-email-action.ts
index 8e778ada486..19ebfda132b 100644
--- a/packages/pieces/community/gmail/src/lib/actions/archive-email-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/archive-email-action.ts
@@ -1,6 +1,7 @@
-import { createAction, Property } from '@activepieces/pieces-framework';
-import { gmailAuth, createGoogleClient } from '../auth';
+import { createAction } from '@activepieces/pieces-framework';
+import { gmailAuth, createGoogleClient, GmailAuthValue } from '../auth';
import { gmail as googleGmail } from '@googleapis/gmail';
+import { GmailProps } from '../common/props';
import { gmailArchiveEmailActionOutputSchema } from '../output-schemas';
export const gmailArchiveEmailAction = createAction({
@@ -11,38 +12,48 @@ export const gmailArchiveEmailAction = createAction({
description: 'Archive an email message by removing it from the inbox.',
audience: 'human',
props: {
- message_id: Property.ShortText({
- displayName: 'Message ID',
- description:
- 'The Gmail message ID to archive (obtain from Search Email or Get Message).',
- required: true,
- }),
+ message_id: GmailProps.message,
},
outputSchema: gmailArchiveEmailActionOutputSchema,
async run(context) {
- const authClient = await createGoogleClient(context.auth);
- const gmail = googleGmail({ version: 'v1', auth: authClient });
-
- try {
- const response = await gmail.users.messages.modify({
- userId: 'me',
- id: context.propsValue.message_id,
- requestBody: {
- removeLabelIds: ['INBOX'],
- },
- });
- return response.data;
- } catch (error: any) {
- if (error.code === 403) {
- throw new Error(
- 'Insufficient permissions to modify labels on a message. Ensure the gmail.modify scope is granted.'
- );
- } else if (error.code === 404) {
- throw new Error(
- `Message not found: "${context.propsValue.message_id}". Use Search Email or Get Message to find a valid message ID.`
- );
- }
- throw new Error(`Failed to archive email: ${error.message}`);
- }
+ return archiveGmailMessage({
+ auth: context.auth,
+ messageId: context.propsValue.message_id,
+ });
},
});
+
+export async function archiveGmailMessage({
+ auth,
+ messageId,
+}: ArchiveGmailMessageParams) {
+ const authClient = await createGoogleClient(auth);
+ const gmail = googleGmail({ version: 'v1', auth: authClient });
+
+ try {
+ const response = await gmail.users.messages.modify({
+ userId: 'me',
+ id: messageId,
+ requestBody: {
+ removeLabelIds: ['INBOX'],
+ },
+ });
+ return response.data;
+ } catch (error: any) {
+ if (error.code === 403) {
+ throw new Error(
+ 'Insufficient permissions to modify labels on a message. Ensure the gmail.modify scope is granted.'
+ );
+ } else if (error.code === 404) {
+ throw new Error(
+ `Message not found: "${messageId}". Use Search Email or Get Message to find a valid message ID.`
+ );
+ }
+ throw new Error(`Failed to archive email: ${error.message}`);
+ }
+}
+
+type ArchiveGmailMessageParams = {
+ auth: GmailAuthValue;
+ messageId: string;
+};
diff --git a/packages/pieces/community/gmail/src/lib/actions/create-draft-reply-action.ts b/packages/pieces/community/gmail/src/lib/actions/create-draft-reply-action.ts
index 3371f1f29b9..2a8ae3559e2 100644
--- a/packages/pieces/community/gmail/src/lib/actions/create-draft-reply-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/create-draft-reply-action.ts
@@ -23,67 +23,81 @@ export const gmailCreateDraftReplyAction = createAction({
message_id: GmailProps.message,
reply_type: Property.StaticDropdown({
displayName: 'Reply Type',
- description:
- 'Choose whether to reply to sender only or to all recipients',
+ description: 'Reply to the sender only, or to everyone on the thread.',
required: true,
defaultValue: 'reply',
+ display: 'cards',
options: {
disabled: false,
options: [
{
- label: 'Reply (to sender only)',
+ label: 'Reply',
value: 'reply',
+ description: 'Sender only',
+ icon: 'reply',
},
{
- label: 'Reply All (to all recipients)',
+ label: 'Reply All',
value: 'reply_all',
+ description: 'All recipients',
+ icon: 'reply-all',
},
],
},
}),
body_type: Property.StaticDropdown({
displayName: 'Body Type',
+ description: 'How the text in Body is interpreted.',
required: true,
defaultValue: 'plain_text',
+ display: 'cards',
options: {
disabled: false,
options: [
{
- label: 'Plain text',
+ label: 'Plain Text',
value: 'plain_text',
+ description: 'Sent as written',
+ icon: 'text',
},
{
label: 'HTML',
value: 'html',
+ description: 'Bold, links, lists',
+ icon: 'code',
},
],
},
}),
- body: Property.LongText({
- displayName: 'Draft Reply Body',
- description: 'Your draft reply message content',
+ body: Property.RichText({
+ displayName: 'Body',
required: false,
+ formatProperty: 'body_type',
}),
include_original_message: Property.Checkbox({
displayName: 'Include Original Message',
- description: 'Include the original message content in the draft reply',
- required: true,
+ description: 'Quote the original message below your reply.',
+ required: false,
defaultValue: true,
}),
sender_name: Property.ShortText({
displayName: 'Sender Name',
- description: 'Optional sender name to display',
+ description: 'Name shown in the inbox instead of your address.',
+ placeholder: 'Jane at Acme',
required: false,
+ advanced: true,
}),
attachment: Property.File({
displayName: 'Attachment',
- description: 'Optional file to attach to your draft reply',
+ description: 'File to attach.',
required: false,
}),
attachment_name: Property.ShortText({
displayName: 'Attachment Name',
- description: 'Custom name for the attachment',
+ description: 'Overrides the uploaded file name.',
+ placeholder: 'report.pdf',
required: false,
+ advanced: true,
}),
},
outputSchema: createDraftReplyActionOutputSchema,
@@ -211,17 +225,16 @@ export const gmailCreateDraftReplyAction = createAction({
const senderEmail = await getUserEmail(context.auth, authClient);
let draftBody = context.propsValue.body || '';
+ const isPlainText = context.propsValue.body_type === 'plain_text';
if (context.propsValue.include_original_message && originalMessageContent) {
- const separator =
- context.propsValue.body_type === 'html'
- ? '<br><br>--- Original Message ---<br>'
- : '\n\n--- Original Message ---\n';
+ const separator = isPlainText
+ ? '\n\n--- Original Message ---\n'
+ : '<br><br>--- Original Message ---<br>';
- const quotedContent =
- context.propsValue.body_type === 'html'
- ? originalMessageContent.replace(/\n/g, '<br>')
- : originalMessageContent;
+ const quotedContent = isPlainText
+ ? originalMessageContent
+ : originalMessageContent.replace(/\n/g, '<br>');
draftBody = draftBody
? `${draftBody}${separator}${quotedContent}`
@@ -233,9 +246,8 @@ export const gmailCreateDraftReplyAction = createAction({
to: toRecipients.join(', '),
cc: ccRecipients.length > 0 ? ccRecipients.join(', ') : undefined,
subject: `=?UTF-8?B?${subjectBase64}?=`,
- text:
- context.propsValue.body_type === 'plain_text' ? draftBody : undefined,
- html: context.propsValue.body_type === 'html' ? draftBody : undefined,
+ text: isPlainText ? draftBody : undefined,
+ html: isPlainText ? undefined : draftBody,
attachments: [],
headers: [
{
diff --git a/packages/pieces/community/gmail/src/lib/actions/create-label-action.ts b/packages/pieces/community/gmail/src/lib/actions/create-label-action.ts
index ddc6522901d..cd9dedcf53b 100644
--- a/packages/pieces/community/gmail/src/lib/actions/create-label-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/create-label-action.ts
@@ -13,7 +13,8 @@ export const gmailCreateLabelAction = createAction({
props: {
name: Property.ShortText({
displayName: 'Label Name',
- description: 'The display name of the new label, e.g. "Follow Up".',
+ description: 'Appears in your Gmail label list.',
+ placeholder: 'Follow Up',
required: true,
}),
},
diff --git a/packages/pieces/community/gmail/src/lib/actions/get-mail-action.ts b/packages/pieces/community/gmail/src/lib/actions/get-mail-action.ts
index 37daa873247..733c66f8e06 100644
--- a/packages/pieces/community/gmail/src/lib/actions/get-mail-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/get-mail-action.ts
@@ -1,14 +1,15 @@
-import { createAction, Property } from '@activepieces/pieces-framework';
-import { gmailAuth, createGoogleClient } from '../auth';
+import { createAction, FilesService } from '@activepieces/pieces-framework';
+import { gmailAuth, createGoogleClient, GmailAuthValue } from '../auth';
import { gmail as googleGmail } from '@googleapis/gmail';
import { convertAttachment, parseStream } from '../common/data';
+import { GmailProps } from '../common/props';
import { gmailGetMailActionOutputSchema } from '../output-schemas';
export const gmailGetEmailAction = createAction({
auth: gmailAuth,
name: 'gmail_get_mail',
classification: 'READ',
- description: 'Get an email via Id.',
+ description: 'Read one email by its message ID, including attachments.',
audience: 'human',
aiMetadata: {
description:
@@ -17,37 +18,46 @@ export const gmailGetEmailAction = createAction({
},
displayName: 'Get Email',
props: {
- message_id: Property.ShortText({
- displayName: 'Message ID',
- description: 'The messageId of the mail to read.',
- required: true,
- }),
+ message_id: GmailProps.message,
},
outputSchema: gmailGetMailActionOutputSchema,
async run(context) {
- const authClient = await createGoogleClient(context.auth);
+ return getGmailMessage({
+ auth: context.auth,
+ messageId: context.propsValue.message_id,
+ files: context.files,
+ });
+ },
+});
- const gmail = googleGmail({ version: 'v1', auth: authClient });
+export async function getGmailMessage({
+ auth,
+ messageId,
+ files,
+}: GetGmailMessageParams) {
+ const authClient = await createGoogleClient(auth);
- const rawMailResponse = await gmail.users.messages.get({
- userId: 'me',
- id: context.propsValue.message_id!,
- format: 'raw',
- });
+ const gmail = googleGmail({ version: 'v1', auth: authClient });
- const parsedMailResponse = await parseStream(
- Buffer.from(rawMailResponse.data.raw as string, 'base64').toString(
- 'utf-8'
- )
- );
+ const rawMailResponse = await gmail.users.messages.get({
+ userId: 'me',
+ id: messageId,
+ format: 'raw',
+ });
- return {
- id: context.propsValue.message_id,
- ...parsedMailResponse,
- attachments: await convertAttachment(
- parsedMailResponse.attachments,
- context.files
- ),
- };
- },
-});
+ const parsedMailResponse = await parseStream(
+ Buffer.from(rawMailResponse.data.raw as string, 'base64').toString('utf-8')
+ );
+
+ return {
+ id: messageId,
+ ...parsedMailResponse,
+ attachments: await convertAttachment(parsedMailResponse.attachments, files),
+ };
+}
+
+type GetGmailMessageParams = {
+ auth: GmailAuthValue;
+ messageId: string;
+ files: FilesService;
+};
diff --git a/packages/pieces/community/gmail/src/lib/actions/remove-label-from-email-action.ts b/packages/pieces/community/gmail/src/lib/actions/remove-label-from-email-action.ts
index e3d9e9a33be..743968849d7 100644
--- a/packages/pieces/community/gmail/src/lib/actions/remove-label-from-email-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/remove-label-from-email-action.ts
@@ -1,4 +1,4 @@
-import { createAction, Property } from '@activepieces/pieces-framework';
+import { createAction } from '@activepieces/pieces-framework';
import { gmailAuth, createGoogleClient } from '../auth';
import { gmail as googleGmail } from '@googleapis/gmail';
import { GmailProps } from '../common/props';
@@ -12,14 +12,9 @@ export const gmailRemoveLabelFromEmailAction = createAction({
description: 'Remove a label from an email message.',
audience: 'human',
props: {
- message_id: Property.ShortText({
- displayName: 'Message ID',
- description:
- 'The Gmail message ID to unlabel (obtain from Search Email or Get Message).',
- required: true,
- }),
+ message_id: GmailProps.message,
label: GmailProps.label({
- description: 'The label to remove from the message.',
+ description: 'Label to remove.',
required: true,
}),
},
diff --git a/packages/pieces/community/gmail/src/lib/actions/reply-to-email-action.ts b/packages/pieces/community/gmail/src/lib/actions/reply-to-email-action.ts
index 0872af85bcd..c780941b4ce 100644
--- a/packages/pieces/community/gmail/src/lib/actions/reply-to-email-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/reply-to-email-action.ts
@@ -23,61 +23,75 @@ export const gmailReplyToEmailAction = createAction({
message_id: GmailProps.message,
reply_type: Property.StaticDropdown({
displayName: 'Reply Type',
- description:
- 'Choose whether to reply to sender only or to all recipients',
+ description: 'Reply to the sender only, or to everyone on the thread.',
required: true,
defaultValue: 'reply',
+ display: 'cards',
options: {
disabled: false,
options: [
{
- label: 'Reply (to sender only)',
+ label: 'Reply',
value: 'reply',
+ description: 'Sender only',
+ icon: 'reply',
},
{
- label: 'Reply All (to all recipients)',
+ label: 'Reply All',
value: 'reply_all',
+ description: 'All recipients',
+ icon: 'reply-all',
},
],
},
}),
body_type: Property.StaticDropdown({
displayName: 'Body Type',
+ description: 'How the text in Body is interpreted.',
required: true,
defaultValue: 'plain_text',
+ display: 'cards',
options: {
disabled: false,
options: [
{
- label: 'Plain text',
+ label: 'Plain Text',
value: 'plain_text',
+ description: 'Sent as written',
+ icon: 'text',
},
{
label: 'HTML',
value: 'html',
+ description: 'Bold, links, lists',
+ icon: 'code',
},
],
},
}),
- body: Property.LongText({
- displayName: 'Reply Body',
- description: 'Your reply message content',
+ body: Property.RichText({
+ displayName: 'Body',
required: true,
+ formatProperty: 'body_type',
}),
sender_name: Property.ShortText({
displayName: 'Sender Name',
- description: 'Optional sender name to display',
+ description: 'Name shown in the inbox instead of your address.',
+ placeholder: 'Jane at Acme',
required: false,
+ advanced: true,
}),
attachment: Property.File({
displayName: 'Attachment',
- description: 'Optional file to attach to your reply',
+ description: 'File to attach.',
required: false,
}),
attachment_name: Property.ShortText({
displayName: 'Attachment Name',
- description: 'Custom name for the attachment',
+ description: 'Overrides the uploaded file name.',
+ placeholder: 'report.pdf',
required: false,
+ advanced: true,
}),
},
outputSchema: replyToEmailActionOutputSchema,
@@ -159,18 +173,13 @@ export const gmailReplyToEmailAction = createAction({
const senderEmail = await getUserEmail(context.auth, authClient);
const subjectBase64 = Buffer.from(replySubject).toString('base64');
+ const isPlainText = context.propsValue.body_type === 'plain_text';
const mailOptions: Mail.Options = {
to: toRecipients.join(', '),
cc: ccRecipients.length > 0 ? ccRecipients.join(', ') : undefined,
subject: `=?UTF-8?B?${subjectBase64}?=`,
- text:
- context.propsValue.body_type === 'plain_text'
- ? context.propsValue.body
- : undefined,
- html:
- context.propsValue.body_type === 'html'
- ? context.propsValue.body
- : undefined,
+ text: isPlainText ? context.propsValue.body : undefined,
+ html: isPlainText ? undefined : context.propsValue.body,
attachments: [],
headers: [
{
diff --git a/packages/pieces/community/gmail/src/lib/actions/request-approval-in-email.ts b/packages/pieces/community/gmail/src/lib/actions/request-approval-in-email.ts
index 05b1e4e7acc..a91f4ef9b9b 100644
--- a/packages/pieces/community/gmail/src/lib/actions/request-approval-in-email.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/request-approval-in-email.ts
@@ -19,57 +19,92 @@ export const requestApprovalInEmail = createAction({
classification: 'WRITE',
displayName: 'Request Approval in Email',
description:
- 'Send approval request email and then wait until the email is approved or disapproved',
+ 'Send an email with an approval link and pause until it is answered.',
audience: 'both',
aiMetadata: {
description:
'Sends an email, optionally with file attachments, carrying a single link to a confirmation page where the recipient chooses Approve or Disapprove, then pauses the flow until they respond, resuming with their decision. Use this as a human-in-the-loop gate before proceeding with a sensitive action. The flow blocks indefinitely until a response arrives. Not idempotent: each call sends a new approval email and creates a new wait.',
idempotent: false,
},
+ propertyGroups: [
+ {
+ key: 'recipients',
+ display: 'tabs',
+ label: 'Recipients',
+ description:
+ 'Press Enter after each address. Reply To receives replies instead of the sender.',
+ props: ['receiver', 'cc', 'bcc', 'reply_to'],
+ },
+ ],
props: {
receiver: Property.ShortText({
- displayName: 'Receiver Email (To)',
- description:
- 'The email address of the recipient who will receive the approval request.',
+ displayName: 'To',
+ description: 'Address that receives the approval request.',
+ placeholder: '[email protected]',
required: true,
}),
cc: Property.Array({
- displayName: 'CC Email',
- description:
- 'The email addresses of the recipients who will receive a carbon copy of the approval request.',
+ displayName: 'Cc',
required: false,
}),
bcc: Property.Array({
- displayName: 'BCC Email',
- description:
- 'The email addresses of the recipients who will receive a blind carbon copy of the approval request.',
+ displayName: 'Bcc',
required: false,
}),
subject: Property.ShortText({
displayName: 'Subject',
- description: 'The subject of the approval request email.',
+ placeholder: 'Approval needed: purchase order 1042',
+ required: true,
+ }),
+ body_type: Property.StaticDropdown({
+ displayName: 'Body Type',
+ description: 'How the text in Body is interpreted.',
required: true,
+ defaultValue: 'plain_text',
+ display: 'cards',
+ options: {
+ disabled: false,
+ options: [
+ {
+ label: 'Plain Text',
+ value: 'plain_text',
+ description: 'Sent as written',
+ icon: 'text',
+ },
+ {
+ label: 'HTML',
+ value: 'html',
+ description: 'Bold, links, lists',
+ icon: 'code',
+ },
+ ],
+ },
}),
- body: Property.ShortText({
+ body: Property.RichText({
displayName: 'Body',
- description: 'Body for the email you want to send',
+ description: 'Text shown above the Review & Respond button.',
required: true,
+ formatProperty: 'body_type',
}),
reply_to: Property.Array({
- displayName: 'Reply-To Email',
- description: 'Email address to set as the "Reply-To" header',
+ displayName: 'Reply To',
+ description: 'Replies go to these addresses instead of the sender.',
required: false,
}),
sender_name: Property.ShortText({
displayName: 'Sender Name',
+ description: 'Name shown in the inbox instead of your address.',
+ placeholder: 'Jane at Acme',
required: false,
+ advanced: true,
}),
from: Property.ShortText({
- displayName: 'Sender Email',
- description:
- "The address must be listed in your GMail account's settings",
+ displayName: 'From',
+ description: 'A send-as address already set up in your Gmail settings.',
+ placeholder: '[email protected]',
required: false,
+ advanced: true,
}),
attachments: Property.Array({
displayName: 'Attachments',
@@ -77,20 +112,21 @@ export const requestApprovalInEmail = createAction({
properties: {
file: Property.File({
displayName: 'File',
- description: 'File to attach to the approval request email.',
required: true,
}),
name: Property.ShortText({
displayName: 'Attachment Name',
- description: 'In case you want to change the name of the attachment.',
+ description: 'Overrides the uploaded file name.',
+ placeholder: 'report.pdf',
required: false,
}),
},
}),
in_reply_to: Property.ShortText({
- displayName: 'In reply to',
- description: 'Reply to this Message-ID',
+ displayName: 'In Reply To',
+ description: 'Message-ID header of the email to thread this under.',
required: false,
+ advanced: true,
}),
},
outputSchema: requestApprovalInMailActionOutputSchema,
@@ -112,9 +148,14 @@ export const requestApprovalInEmail = createAction({
const confirmationLink = `${waitpoint.resumeUrl}/confirm`;
+ const bodyHtml =
+ context.propsValue.body_type === 'plain_text'
+ ? escapeHtml(body).replace(/\r?\n/g, '<br>')
+ : body;
+
const htmlBody = `
<div>
- <p>${body}</p>
+ <div>${bodyHtml}</div>
<br />
<p>
<a href="${confirmationLink}" style="display: inline-block; padding: 10px 20px; background-color: #6e41e2; color: white; text-decoration: none; border-radius: 4px;">Review &amp; Respond</a>
@@ -145,10 +186,6 @@ export const requestApprovalInEmail = createAction({
bcc: bcc ? bcc.join(', ') : undefined,
subject: `=?UTF-8?B?${subjectBase64}?=`,
replyTo: replyTo ? replyTo.join(', ') : '',
- // text:
- // context.propsValue.body_type === 'plain_text'
- // ? context.propsValue['body']
- // : undefined,
html: htmlBody,
attachments: [],
};
@@ -195,7 +232,7 @@ export const requestApprovalInEmail = createAction({
userId: 'me',
q: `Rfc822msgid:${context.propsValue.in_reply_to}`,
});
- threadId = messages.data.messages?.[0].threadId;
+ threadId = messages.data.messages?.[0]?.threadId;
}
const mail: any = new MailComposer(mailOptions).compile();
mail.keepBcc = true;
@@ -234,3 +271,12 @@ export const requestApprovalInEmail = createAction({
}
},
});
+
+function escapeHtml(text: string): string {
+ return text
+ .replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;')
+ .replace(/'/g, '&#39;');
+}
diff --git a/packages/pieces/community/gmail/src/lib/actions/search-email-action.ts b/packages/pieces/community/gmail/src/lib/actions/search-email-action.ts
index 6b351e4dbbb..06e3042ea9c 100644
--- a/packages/pieces/community/gmail/src/lib/actions/search-email-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/search-email-action.ts
@@ -3,7 +3,6 @@ import { gmailAuth, createGoogleClient } from '../auth';
import { gmail as googleGmail } from '@googleapis/gmail';
import { convertAttachment, parseStream } from '../common/data';
import { GmailProps } from '../common/props';
-import { GmailLabel } from '../common/models';
import { gmailSearchMailActionOutputSchema } from '../output-schemas';
export const gmailSearchMailAction = createAction({
@@ -12,56 +11,109 @@ export const gmailSearchMailAction = createAction({
classification: 'SEARCH',
displayName: 'Find Email',
description:
- 'Find emails using advanced search criteria. If no filters are provided, the latest emails are returned.',
+ 'Search your mailbox; with no filters it returns the latest emails.',
audience: 'human',
aiMetadata: {
description:
'Searches the mailbox for emails matching combinable filters (sender, recipient, subject, body text, label, category, date range, attachment presence/name) and returns the matched messages with parsed contents. Use this to locate messages or discover their IDs before reading or replying; with no filters it returns the most recent emails. Bound results with Max Results (1-500, default 10). Idempotent: a read-only search that does not modify the mailbox.',
idempotent: true,
},
+ propertyGroups: [
+ {
+ key: 'people',
+ display: 'builder',
+ label: 'People',
+ icon: 'users',
+ props: ['from', 'to'],
+ },
+ {
+ key: 'content',
+ display: 'builder',
+ label: 'Content',
+ icon: 'type',
+ props: ['subject', 'content'],
+ },
+ {
+ key: 'attachments',
+ display: 'builder',
+ label: 'Attachments',
+ icon: 'paperclip',
+ props: ['has_attachment', 'attachment_name'],
+ },
+ {
+ key: 'mailbox',
+ display: 'builder',
+ label: 'Mailbox',
+ icon: 'inbox',
+ props: ['label', 'category', 'include_spam_trash'],
+ },
+ {
+ key: 'date',
+ display: 'builder',
+ label: 'Date',
+ icon: 'calendar',
+ props: ['after_date', 'before_date'],
+ },
+ {
+ key: 'footer',
+ display: 'footer',
+ icon: 'sliders',
+ props: ['max_results'],
+ },
+ ],
props: {
- from: GmailProps.from,
- to: GmailProps.to,
- subject: GmailProps.subject,
+ from: { ...GmailProps.from, icon: 'user' },
+ to: { ...GmailProps.to, icon: 'send' },
+ subject: { ...GmailProps.subject, icon: 'type' },
content: Property.ShortText({
- displayName: 'Email Content',
- description: 'Search for specific text within email body',
+ displayName: 'Body',
+ description: 'Only emails with this text in the body.',
+ placeholder: 'order confirmed',
+ icon: 'text',
required: false,
}),
has_attachment: Property.Checkbox({
displayName: 'Has Attachment',
- description: 'Only find emails with attachments',
+ description: 'Only emails with at least one attachment.',
+ icon: 'paperclip',
required: false,
defaultValue: false,
}),
attachment_name: Property.ShortText({
displayName: 'Attachment Name',
- description: 'Search for emails with specific attachment filename',
+ description: 'Only emails with an attachment of this file name.',
+ placeholder: 'invoice.pdf',
+ icon: 'file',
required: false,
}),
- label: GmailProps.label({ required: false }),
- category: GmailProps.category,
+ label: GmailProps.label({ required: false, icon: 'tag' }),
+ category: { ...GmailProps.category, icon: 'inbox' },
after_date: Property.DateTime({
- displayName: 'After Date',
- description: 'Find emails sent after this date',
+ displayName: 'After',
+ description: 'Only emails received after this date.',
+ icon: 'calendar',
required: false,
}),
before_date: Property.DateTime({
- displayName: 'Before Date',
- description: 'Find emails sent before this date',
+ displayName: 'Before',
+ description: 'Only emails received before this date.',
+ icon: 'calendar',
required: false,
}),
-
include_spam_trash: Property.Checkbox({
- displayName: 'Include Spam & Trash',
- description:
- 'Include emails from Spam and Trash folders in search results',
+ displayName: 'Spam and Trash',
+ description: 'Also search the Spam and Trash folders.',
+ icon: 'trash',
required: false,
defaultValue: false,
}),
max_results: Property.Number({
displayName: 'Max Results',
- description: 'Maximum number of emails to return (1-500)',
+ description: 'Newest first, up to 500.',
+ display: 'stepper',
+ min: 1,
+ max: 500,
+ step: 1,
required: false,
defaultValue: 10,
}),
@@ -97,7 +149,7 @@ export const gmailSearchMailAction = createAction({
}
if (context.propsValue.label) {
- const label = context.propsValue.label as GmailLabel;
+ const label = context.propsValue.label;
queryParts.push(`label:${label.name}`);
}
if (context.propsValue.category?.trim()) {
diff --git a/packages/pieces/community/gmail/src/lib/actions/send-email-action.ts b/packages/pieces/community/gmail/src/lib/actions/send-email-action.ts
index 64cb1c9fbfa..7e98a27a1b5 100644
--- a/packages/pieces/community/gmail/src/lib/actions/send-email-action.ts
+++ b/packages/pieces/community/gmail/src/lib/actions/send-email-action.ts
@@ -18,64 +18,82 @@ export const gmailSendEmailAction = createAction({
idempotent: false,
},
displayName: 'Send Email',
+ propertyGroups: [
+ {
+ key: 'recipients',
+ display: 'tabs',
+ label: 'Recipients',
+ description:
+ 'Press Enter after each address. Reply To receives replies instead of the sender.',
+ props: ['receiver', 'cc', 'bcc', 'reply_to'],
+ },
+ ],
props: {
receiver: Property.Array({
- displayName: 'Receiver Email (To)',
- description: undefined,
+ displayName: 'To',
required: true,
}),
cc: Property.Array({
- displayName: 'CC Email',
- description: undefined,
+ displayName: 'Cc',
required: false,
}),
bcc: Property.Array({
- displayName: 'BCC Email',
- description: undefined,
+ displayName: 'Bcc',
required: false,
}),
subject: Property.ShortText({
displayName: 'Subject',
description: undefined,
+ placeholder: 'Invoice for March',
required: true,
}),
body_type: Property.StaticDropdown({
displayName: 'Body Type',
+ description: 'How the text in Body is interpreted.',
required: true,
defaultValue: 'plain_text',
+ display: 'cards',
options: {
disabled: false,
options: [
{
- label: 'plain text',
+ label: 'Plain Text',
value: 'plain_text',
+ description: 'Sent as written',
+ icon: 'text',
},
{
- label: 'html',
+ label: 'HTML',
value: 'html',
+ description: 'Bold, links, lists',
+ icon: 'code',
},
],
},
}),
- body: Property.ShortText({
+ body: Property.RichText({
displayName: 'Body',
- description: 'Body for the email you want to send',
required: true,
+ formatProperty: 'body_type',
}),
reply_to: Property.Array({
- displayName: 'Reply-To Email',
- description: 'Email address to set as the "Reply-To" header',
+ displayName: 'Reply To',
+ description: 'Replies go to these addresses instead of the sender.',
required: false,
}),
sender_name: Property.ShortText({
displayName: 'Sender Name',
+ description: 'Name shown in the inbox instead of your address.',
+ placeholder: 'Jane at Acme',
required: false,
+ advanced: true,
}),
from: Property.ShortText({
- displayName: 'Sender Email',
- description:
- "The address must be listed in your GMail account's settings",
+ displayName: 'From',
+ description: 'A send-as address already set up in your Gmail settings.',
+ placeholder: '[email protected]',
required: false,
+ advanced: true,
}),
attachments: Property.Array({
displayName: 'Attachments',
@@ -83,25 +101,26 @@ export const gmailSendEmailAction = createAction({
properties: {
file: Property.File({
displayName: 'File',
- description: 'File to attach to the email you want to send.',
required: true,
}),
name: Property.ShortText({
displayName: 'Attachment Name',
- description: 'In case you want to change the name of the attachment.',
+ description: 'Overrides the uploaded file name.',
+ placeholder: 'report.pdf',
required: false,
}),
},
}),
in_reply_to: Property.ShortText({
- displayName: 'In reply to',
- description: 'Reply to this Message-ID',
+ displayName: 'In Reply To',
+ description: 'Message-ID header of the email to thread this under.',
required: false,
+ advanced: true,
}),
draft: Property.Checkbox({
- displayName: 'Create draft',
- description: 'Create draft without sending the actual email',
- required: true,
+ displayName: 'Save as Draft',
+ description: 'Save to Drafts instead of sending.',
+ required: false,
defaultValue: false,
}),
},
@@ -126,20 +145,15 @@ export const gmailSendEmailAction = createAction({
);
const cc = context.propsValue['cc']?.filter((email) => email !== '');
const bcc = context.propsValue['bcc']?.filter((email) => email !== '');
+ const isPlainText = context.propsValue.body_type === 'plain_text';
const mailOptions: Mail.Options = {
to: receiver.join(', '), // Join all email addresses with a comma
cc: cc ? cc.join(', ') : undefined,
bcc: bcc ? bcc.join(', ') : undefined,
subject: `=?UTF-8?B?${subjectBase64}?=`,
replyTo: replyTo ? replyTo.join(', ') : '',
- text:
- context.propsValue.body_type === 'plain_text'
- ? context.propsValue['body']
- : undefined,
- html:
- context.propsValue.body_type === 'html'
- ? context.propsValue['body']
- : undefined,
+ text: isPlainText ? context.propsValue['body'] : undefined,
+ html: isPlainText ? undefined : context.propsValue['body'],
attachments: [],
};
let threadId = undefined;
@@ -158,7 +172,7 @@ export const gmailSendEmailAction = createAction({
userId: 'me',
q: `Rfc822msgid:${context.propsValue.in_reply_to}`,
});
- threadId = messages.data.messages?.[0].threadId;
+ threadId = messages.data.messages?.[0]?.threadId;
}
const senderEmail =
diff --git a/packages/pieces/community/gmail/src/lib/common/props.ts b/packages/pieces/community/gmail/src/lib/common/props.ts
index 5ed765935cc..da6f165656e 100644
--- a/packages/pieces/community/gmail/src/lib/common/props.ts
+++ b/packages/pieces/community/gmail/src/lib/common/props.ts
@@ -6,29 +6,30 @@ import { gmail as googleGmail } from '@googleapis/gmail';
export const GmailProps = {
from: Property.ShortText({
- displayName: 'Email sender',
- description:
- 'Optional filteration, leave empty to filter based on the email sender',
+ displayName: 'From',
+ description: 'Only emails sent from this address.',
+ placeholder: '[email protected]',
required: false,
defaultValue: '',
}),
to: Property.ShortText({
- displayName: 'Email recipient',
- description:
- 'Optional filteration, leave empty to filter based on the email recipient',
+ displayName: 'To',
+ description: 'Only emails sent to this address.',
+ placeholder: '[email protected]',
required: false,
defaultValue: '',
}),
subject: Property.ShortText({
- displayName: 'Email subject',
- description: 'The email subject',
+ displayName: 'Subject',
+ description: 'Only emails whose subject contains this text.',
+ placeholder: 'Invoice',
required: false,
defaultValue: '',
}),
category: Property.StaticDropdown({
displayName: 'Category',
description:
- 'Optional filteration, leave unselected to filter based on the email category',
+ 'Only emails in this inbox tab, such as Primary or Promotions.',
required: false,
options: {
disabled: false,
@@ -47,14 +48,14 @@ export const GmailProps = {
displayName?: string;
description?: string;
required: R;
+ icon?: string;
}) =>
Property.Dropdown<GmailLabel, R, typeof gmailAuth>({
auth: gmailAuth,
displayName: overrides.displayName ?? 'Label',
- description:
- overrides.description ??
- 'Optional filteration, leave unselected to filter based on the email label',
+ description: overrides.description ?? 'Only emails carrying this label.',
required: overrides.required,
+ icon: overrides.icon,
defaultValue: '',
refreshers: [],
options: async ({ auth }) => {
@@ -62,19 +63,27 @@ export const GmailProps = {
return {
disabled: true,
options: [],
- placeholder: 'please authenticate first',
+ placeholder: 'Please connect your Gmail account first',
};
}
- const response = await GmailRequests.getLabels(auth);
+ try {
+ const response = await GmailRequests.getLabels(auth);
- return {
- disabled: false,
- options: response.body.labels.map((label) => ({
- label: label.name,
- value: label,
- })),
- };
+ return {
+ disabled: false,
+ options: response.body.labels.map((label) => ({
+ label: label.name,
+ value: label,
+ })),
+ };
+ } catch (error) {
+ return {
+ disabled: true,
+ options: [],
+ placeholder: 'Could not load labels. Check your connection.',
+ };
+ }
},
}),
unread: (required = false) =>
@@ -87,7 +96,7 @@ export const GmailProps = {
message: Property.Dropdown({
displayName: 'Message',
description:
- 'Select a message from the list or enter a message ID manually.',
+ 'Pick a recent message, or map its ID from a trigger or Find Email.',
required: true,
auth: gmailAuth,
refreshers: [],
@@ -96,7 +105,7 @@ export const GmailProps = {
return {
disabled: true,
options: [],
- placeholder: 'Please authenticate first',
+ placeholder: 'Please connect your Gmail account first',
};
}
@@ -174,7 +183,7 @@ export const GmailProps = {
}),
thread: Property.Dropdown({
displayName: 'Thread',
- description: 'Select a thread from the list or enter a thread ID manually',
+ description: 'Pick a recent thread, or paste a thread ID.',
required: true,
refreshers: [],
auth: gmailAuth,
@@ -183,7 +192,7 @@ export const GmailProps = {
return {
disabled: true,
options: [],
- placeholder: 'Please authenticate first',
+ placeholder: 'Please connect your Gmail account first',
};
}
@@ -213,7 +222,7 @@ export const GmailProps = {
.slice(0, 10)
.map(async (thread: { id: string; snippet?: string }) => {
try {
- const details = await await gmail.users.threads.get({
+ const details = await gmail.users.threads.get({
metadataHeaders: ['Subject'],
format: 'metadata',
id: thread.id,
diff --git a/packages/pieces/community/gmail/src/lib/triggers/new-attachment.ts b/packages/pieces/community/gmail/src/lib/triggers/new-attachment.ts
index b04a1867c22..bda825a5f0e 100644
--- a/packages/pieces/community/gmail/src/lib/triggers/new-attachment.ts
+++ b/packages/pieces/community/gmail/src/lib/triggers/new-attachment.ts
@@ -29,45 +29,21 @@ export const gmailNewAttachmentTrigger = createTrigger({
name: 'new_attachment',
classification: 'READ',
displayName: 'New Attachment',
- description: 'Triggers when an email with an attachment arrives.',
+ description: 'Triggers for each attachment on a new email.',
aiMetadata: {
description:
'Fires when a new email carrying one or more attachments arrives, optionally narrowed by sender, recipient, subject, label, category, or file extension. Each event represents a single attachment (a multi-attachment email emits one event per attachment) along with its source message.',
},
props: {
- from: {
- ...GmailProps.from,
- description: 'Filter by sender email.',
- displayName: 'From',
- required: false,
- },
- to: {
- ...GmailProps.to,
- description: 'Filter by recipient email.',
- displayName: 'To',
- required: false,
- },
- subject: Property.ShortText({
- displayName: 'Subject Contains',
- description:
- 'Only trigger for emails containing this text in the subject.',
- required: false,
- }),
- label: GmailProps.label({
- description: 'Filter by Gmail label.',
- displayName: 'Label',
- required: false,
- }),
- category: {
- ...GmailProps.category,
- description: 'Filter by Gmail category.',
- displayName: 'Category',
- required: false,
- },
+ from: GmailProps.from,
+ to: { ...GmailProps.to, advanced: true },
+ subject: GmailProps.subject,
+ label: GmailProps.label({ required: false }),
+ category: { ...GmailProps.category, advanced: true },
filenameExtension: Property.ShortText({
displayName: 'File Extension',
- description:
- 'Only trigger for attachments with this file extension (e.g., pdf, jpg, docx).',
+ description: 'Only attachments with this extension.',
+ placeholder: 'pdf',
required: false,
}),
},
diff --git a/packages/pieces/community/gmail/src/lib/triggers/new-email.ts b/packages/pieces/community/gmail/src/lib/triggers/new-email.ts
index 4de622f6c02..2bc9686d0f2 100644
--- a/packages/pieces/community/gmail/src/lib/triggers/new-email.ts
+++ b/packages/pieces/community/gmail/src/lib/triggers/new-email.ts
@@ -19,7 +19,7 @@ export const gmailNewEmailTrigger = createTrigger({
name: 'gmail_new_email_received',
classification: 'READ',
displayName: 'New Email',
- description: 'Triggers when new mail is found in your Gmail inbox',
+ description: 'Triggers when a new email matching the filters arrives.',
aiMetadata: {
description:
'Fires when a new email arrives in the connected Gmail account, optionally narrowed by sender, recipient, subject, label, or category filters. Each event represents one newly received message with its parsed contents and thread.',
@@ -27,9 +27,9 @@ export const gmailNewEmailTrigger = createTrigger({
props: {
subject: GmailProps.subject,
from: GmailProps.from,
- to: GmailProps.to,
+ to: { ...GmailProps.to, advanced: true },
label: GmailProps.label({ required: false }),
- category: GmailProps.category,
+ category: { ...GmailProps.category, advanced: true },
},
outputSchema: gmailNewEmailReceivedTriggerOutputSchema,
sampleData: {},
diff --git a/packages/pieces/community/gmail/src/lib/triggers/new-label.ts b/packages/pieces/community/gmail/src/lib/triggers/new-label.ts
index a252e39503e..525062290a8 100644
--- a/packages/pieces/community/gmail/src/lib/triggers/new-label.ts
+++ b/packages/pieces/community/gmail/src/lib/triggers/new-label.ts
@@ -12,7 +12,7 @@ export const gmailNewLabelTrigger = createTrigger({
name: 'new_label',
classification: 'READ',
displayName: 'New Label',
- description: 'Triggers when a new label is created.',
+ description: 'Triggers when a new label is created in Gmail.',
aiMetadata: {
description:
'Fires when a new label is created in the connected Gmail account. Each event represents one newly added label not seen on a prior poll.',
diff --git a/packages/pieces/community/gmail/src/lib/triggers/new-labeled-email.ts b/packages/pieces/community/gmail/src/lib/triggers/new-labeled-email.ts
index a2e30102716..f38836c9589 100644
--- a/packages/pieces/community/gmail/src/lib/triggers/new-labeled-email.ts
+++ b/packages/pieces/community/gmail/src/lib/triggers/new-labeled-email.ts
@@ -59,7 +59,7 @@ export const gmailNewLabeledEmailTrigger = createTrigger({
name: 'new_labeled_email',
classification: 'READ',
displayName: 'New Labeled Email',
- description: 'Triggers when a label is added to an email',
+ description: 'Triggers when this label is added to an email.',
aiMetadata: {
description:
'Fires when the specified label is applied to an email (either newly received with the label or labeled afterward). Each event represents one message that just gained that label, with its parsed contents and label info.',
@@ -67,6 +67,7 @@ export const gmailNewLabeledEmailTrigger = createTrigger({
props: {
label: GmailProps.label({
required: true,
+ description: 'Emails that receive this label start the flow.',
}),
},
outputSchema: newLabeledEmailTriggerOutputSchema,
diff --git a/packages/pieces/community/gmail/test/request-approval-body.test.ts b/packages/pieces/community/gmail/test/request-approval-body.test.ts
new file mode 100644
index 00000000000..06efcc65bfb
--- /dev/null
+++ b/packages/pieces/community/gmail/test/request-approval-body.test.ts
@@ -0,0 +1,81 @@
+/// <reference types="vitest/globals" />
+
+import { createMockActionContext } from '@activepieces/pieces-framework';
+import { simpleParser } from 'mailparser';
+
+const sendMock = vi.fn().mockResolvedValue({ data: { id: 'sent-message-id' } });
+const listMock = vi.fn().mockResolvedValue({ data: { messages: [] } });
+
+vi.mock('@googleapis/gmail', () => ({
+ gmail: () => ({
+ users: { messages: { send: sendMock, list: listMock } },
+ }),
+}));
+
+vi.mock('../src/lib/auth', () => ({
+ gmailAuth: {},
+ createGoogleClient: vi.fn().mockResolvedValue({}),
+ getAccessToken: vi.fn().mockResolvedValue('an-access-token'),
+ getUserEmail: vi.fn().mockResolvedValue('[email protected]'),
+}));
+
+import { requestApprovalInEmail } from '../src/lib/actions/request-approval-in-email';
+
+const RESUME_URL = 'https://ap.test/resume';
+
+type ApprovalContext = Parameters<typeof requestApprovalInEmail.run>[0];
+
+function buildContext(propsValue: Record<string, unknown>): ApprovalContext {
+ const context = createMockActionContext({
+ propsValue: {
+ receiver: '[email protected]',
+ subject: 'Please approve',
+ ...propsValue,
+ },
+ });
+
+ return {
+ ...context,
+ run: {
+ ...context.run,
+ createWaitpoint: async () => ({ id: 'waitpoint-1', resumeUrl: RESUME_URL }),
+ waitForWaitpoint: () => undefined,
+ },
+ } as unknown as ApprovalContext;
+}
+
+async function sentHtml(): Promise<string> {
+ expect(sendMock).toHaveBeenCalledTimes(1);
+ const raw = sendMock.mock.calls[0][0].requestBody.raw as string;
+ const mail = await simpleParser(
+ Buffer.from(raw.replace(/-/g, '+').replace(/_/g, '/'), 'base64')
+ );
+ return typeof mail.html === 'string' ? mail.html : '';
+}
+
+describe('request approval in email — body type', () => {
+ beforeEach(() => {
+ sendMock.mockClear();
+ listMock.mockClear();
+ });
+
+ test('a plain text body is escaped and keeps its line breaks', async () => {
+ await requestApprovalInEmail.run(
+ buildContext({ body_type: 'plain_text', body: 'a < b & c\nline 2' })
+ );
+
+ const html = await sentHtml();
+ expect(html).toContain('a &lt; b &amp; c<br>line 2');
+ expect(html).toContain(`${RESUME_URL}/confirm`);
+ });
+
+ test('a rich text body is sent as markup', async () => {
+ await requestApprovalInEmail.run(
+ buildContext({ body_type: 'html', body: '<p><strong>bold</strong></p>' })
+ );
+
+ const html = await sentHtml();
+ expect(html).toContain('<p><strong>bold</strong></p>');
+ expect(html).toContain(`${RESUME_URL}/confirm`);
+ });
+});