Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { azureCommunicationServiceAuth } from '../..';
|
||||
import { EmailClient, EmailMessage } from '@azure/communication-email';
|
||||
|
||||
export const sendEmail = createAction({
|
||||
auth: azureCommunicationServiceAuth,
|
||||
name: 'send_email',
|
||||
displayName: 'Send Email',
|
||||
description: 'Send a text or HTML email',
|
||||
props: {
|
||||
from: Property.ShortText({
|
||||
displayName: 'Sender Email (From)',
|
||||
description: 'Sender email',
|
||||
required: true,
|
||||
}),
|
||||
to: Property.Array({
|
||||
displayName: 'To',
|
||||
description: 'Emails of the recipients',
|
||||
required: true,
|
||||
}),
|
||||
cc: Property.Array({
|
||||
displayName: 'Cc',
|
||||
description: 'List of emails in cc',
|
||||
required: false,
|
||||
}),
|
||||
bcc: Property.Array({
|
||||
displayName: 'Bcc',
|
||||
description: 'List of emails in bcc',
|
||||
required: false,
|
||||
}),
|
||||
reply_to: Property.ShortText({
|
||||
displayName: 'Reply To',
|
||||
description: 'Email to receive replies on (defaults to sender)',
|
||||
required: false,
|
||||
}),
|
||||
subject: Property.ShortText({
|
||||
displayName: 'Subject',
|
||||
description: undefined,
|
||||
required: true,
|
||||
}),
|
||||
content_type: Property.Dropdown<'text' | 'html', true, typeof azureCommunicationServiceAuth>({
|
||||
auth: azureCommunicationServiceAuth,
|
||||
displayName: 'Content Type',
|
||||
refreshers: [],
|
||||
required: true,
|
||||
defaultValue: 'html',
|
||||
options: async () => {
|
||||
return {
|
||||
disabled: false,
|
||||
options: [
|
||||
{ label: 'Plain Text', value: 'text' },
|
||||
{ label: 'HTML', value: 'html' },
|
||||
],
|
||||
};
|
||||
},
|
||||
}),
|
||||
content: Property.ShortText({
|
||||
displayName: 'Content',
|
||||
description: 'HTML is only allowed if you selected HTML as type',
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
async run(context) {
|
||||
const { to, from, reply_to, subject, content_type, content, cc, bcc } =
|
||||
context.propsValue;
|
||||
const message = {
|
||||
senderAddress: from,
|
||||
content: {
|
||||
subject: subject,
|
||||
...(content_type === 'text' && { plainText: content }),
|
||||
...(content_type === 'html' && { html: content }),
|
||||
},
|
||||
replyTo: [
|
||||
{
|
||||
address: reply_to ?? from,
|
||||
},
|
||||
],
|
||||
recipients: {
|
||||
to: to.map((address) => ({ address })),
|
||||
cc: (cc || []).map((address) => ({ address })),
|
||||
bcc: (bcc || []).map((address) => ({ address })),
|
||||
},
|
||||
} as EmailMessage;
|
||||
const client = new EmailClient(context.auth.secret_text);
|
||||
const poller = await client.beginSend(message);
|
||||
return await poller.pollUntilDone();
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user