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
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction, Property } from '@activepieces/pieces-framework';
import { calendar as googleCalendar, calendar_v3 } from '@googleapis/calendar';
import { googleCalendarCommon, googleCalendarAuth, createGoogleClient } from '../common';
import { eventOutputSchema } from '../output-schemas';
export const addAttendeesToEventAction = createAction({
auth: googleCalendarAuth,
name: 'google-calendar-add-attendees',
classification: 'WRITE',
displayName: 'Add Attendees to Event',
description: 'Adds guests to an existing event.',
audience: 'both',
aiMetadata: { description: 'Adds one or more guests (by email) to an existing Google Calendar event, identified by calendar and event ID, preserving the current attendee list. Use to invite people to an event that already exists rather than recreating it. Not idempotent: re-running appends the same emails again, producing duplicate attendee entries.', idempotent: false },
propertyGroups: [
{
key: 'event',
display: 'section',
label: 'Event',
icon: 'calendar',
props: ['calendar_id', 'eventId'],
},
{
key: 'guests',
display: 'section',
label: 'Guests',
icon: 'users',
props: ['attendees'],
},
],
props: {
calendar_id: googleCalendarCommon.calendarDropdown('writer'),
eventId: Property.ShortText({
displayName: 'Event ID',
description: 'Paste the ID from the event URL or a previous step.',
required: true,
}),
attendees: Property.Array({
displayName: 'Attendees',
description: 'One guest email per item.',
required: true,
}),
},
outputSchema: eventOutputSchema,
async run(context) {
const { calendar_id, eventId } = context.propsValue;
const attendeesInput = context.propsValue.attendees as string[];
const authClient = await createGoogleClient(context.auth);
const calendar = googleCalendar({ version: 'v3', auth: authClient });
// Note that each patch request consumes three quota units;
// prefer using a get followed by an update
const currentEvent = await calendar.events.get({
calendarId: calendar_id,
eventId: eventId,
});
const currentAttendees = currentEvent.data.attendees ?? [];
const attendeeFormattedList: calendar_v3.Schema$EventAttendee[] = [];
attendeeFormattedList.push(...currentAttendees);
attendeeFormattedList.push(...attendeesInput.map((email) => ({ email })));
const response = await calendar.events.update({
calendarId: calendar_id!,
eventId,
requestBody: {
...currentEvent.data,
attendees: attendeeFormattedList,
},
});
return response.data;
},
});