-
Notifications
You must be signed in to change notification settings - Fork 5k
Add multiple recipients (To/CC/BCC) to Send Email workflow action #17385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Greptile OverviewGreptile SummaryThis PR successfully extends the Send Email workflow action to support multiple recipients across To, CC, and BCC fields while maintaining backward compatibility with existing workflows using the single Key Changes:
Implementation Quality:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant EmailRecipientsInput
participant WorkflowEditActionSendEmail
participant SendEmailTool
participant MessagingSendMessageService
participant EmailProvider
User->>WorkflowEditActionSendEmail: Configure email action
WorkflowEditActionSendEmail->>EmailRecipientsInput: Render To/CC/BCC inputs
Note over EmailRecipientsInput: Initializes with defaultValue<br/>or legacy email field
User->>EmailRecipientsInput: Enter recipient emails
EmailRecipientsInput->>EmailRecipientsInput: handleEntryChange()
EmailRecipientsInput->>EmailRecipientsInput: Auto-add empty row if last filled
EmailRecipientsInput->>WorkflowEditActionSendEmail: onChange(emails[])
WorkflowEditActionSendEmail->>WorkflowEditActionSendEmail: handleFieldChange('recipients', {...})
WorkflowEditActionSendEmail->>WorkflowEditActionSendEmail: saveAction (debounced)
Note over User,EmailProvider: Workflow Execution Phase
User->>SendEmailTool: Execute workflow
SendEmailTool->>SendEmailTool: normalizeRecipients()
Note over SendEmailTool: Handles both new recipients<br/>format and legacy email field
SendEmailTool->>SendEmailTool: validateEmails()
Note over SendEmailTool: Validates all to/cc/bcc emails
alt Invalid emails found
SendEmailTool-->>User: Return error with invalid emails
end
SendEmailTool->>MessagingSendMessageService: sendMessage({to[], cc[], bcc[]})
alt Google Provider
MessagingSendMessageService->>MessagingSendMessageService: Build MailComposer with arrays
MessagingSendMessageService->>EmailProvider: Gmail API send
else Microsoft Provider
MessagingSendMessageService->>MessagingSendMessageService: toMicrosoftRecipients()
MessagingSendMessageService->>EmailProvider: Microsoft Graph API send
else SMTP Provider
MessagingSendMessageService->>MessagingSendMessageService: Build MailComposer with arrays
MessagingSendMessageService->>EmailProvider: SMTP send
end
EmailProvider-->>MessagingSendMessageService: Success
MessagingSendMessageService-->>SendEmailTool: Email sent
SendEmailTool-->>User: Success with recipient details
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
|
|
||
| const nonEmptyValues = newEntries | ||
| .map((entry) => entry.value.trim()) | ||
| .filter((value) => value.length > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use isNonEmptyString utility instead of manual check.
| .filter((value) => value.length > 0); | |
| .filter((value) => isNonEmptyString(value)); |
Context Used: Context from dashboard - Use the 'isNonEmptyString' utility function to check for non-empty strings instead of checking for e... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/EmailRecipientsInput.tsx
Line: 66:66
Comment:
Use `isNonEmptyString` utility instead of manual check.
```suggestion
.filter((value) => isNonEmptyString(value));
```
**Context Used:** Context from `dashboard` - Use the 'isNonEmptyString' utility function to check for non-empty strings instead of checking for e... ([source](https://app.greptile.com/review/custom-context?memory=1553f120-8908-4962-bc22-796896959d06))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 11 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/twenty-shared/src/workflow/schemas/send-email-action-settings-schema.ts">
<violation number="1" location="packages/twenty-shared/src/workflow/schemas/send-email-action-settings-schema.ts:15">
P2: The schema now allows a Send Email action with no recipients at all (both `email` and `recipients` can be missing), which can lead to invalid workflows or runtime errors when sending. Add validation to require at least one recipient (legacy `email` or any of `recipients.to/cc/bcc`).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| input: z.object({ | ||
| connectedAccountId: z.string(), | ||
| email: z.string(), | ||
| email: z.string().optional(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The schema now allows a Send Email action with no recipients at all (both email and recipients can be missing), which can lead to invalid workflows or runtime errors when sending. Add validation to require at least one recipient (legacy email or any of recipients.to/cc/bcc).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-shared/src/workflow/schemas/send-email-action-settings-schema.ts, line 15:
<comment>The schema now allows a Send Email action with no recipients at all (both `email` and `recipients` can be missing), which can lead to invalid workflows or runtime errors when sending. Add validation to require at least one recipient (legacy `email` or any of `recipients.to/cc/bcc`).</comment>
<file context>
@@ -2,11 +2,18 @@ import { z } from 'zod';
input: z.object({
connectedAccountId: z.string(),
- email: z.string(),
+ email: z.string().optional(),
+ recipients: workflowEmailRecipientsSchema.optional(),
subject: z.string().optional(),
</file context>
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:39807 This environment will automatically shut down when the PR is closed or after 5 hours. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
Adds support for multiple recipients in the Send Email workflow action
/closes #17383