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 { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { gammaAuth } from '../common/auth';
export const generateGamma = createAction({
auth: gammaAuth,
name: 'generateGamma',
classification: 'WRITE',
displayName: 'Generate Gamma',
description: 'Create a new Gamma generation job.',
audience: 'both',
aiMetadata: {
description: 'Starts an asynchronous Gamma generation job from input text, producing a presentation, document, social post, or webpage (set via the format prop). Use to kick off AI content creation; the job runs in the background, so follow up with "Get Generation" using the returned generation ID to poll for completion and outputs. Requires input text (1-400,000 chars); not idempotent — each call queues a new generation and consumes credits.',
idempotent: false,
},
props: {
folderId: Property.Dropdown({
displayName: 'Folder',
description: 'The folder to save the generated gamma into.',
required: false,
refreshers: ['auth'],
auth: gammaAuth,
options: async ({ auth }) => {
if (!auth) return { disabled: true, options: [], placeholder: 'Connect your account first' };
try {
const response = await httpClient.sendRequest<{ data: { id: string; name: string }[] }>({
method: HttpMethod.GET,
url: 'https://public-api.gamma.app/v1.0/folders',
headers: { 'X-API-KEY': auth.props.apiKey },
});
return {
options: (response.body.data ?? []).map((f) => ({ label: f.name, value: f.id })),
};
} catch {
return { disabled: true, options: [], placeholder: 'Failed to load folders' };
}
},
}),
inputText: Property.LongText({
displayName: 'Input Text',
description:
'Text used to generate your gamma (1-400,000 characters).',
required: true,
}),
textMode: Property.StaticDropdown({
displayName: 'Text Mode',
description: 'How you want your inputText to be modified.',
required: false,
options: {
options: [
{ label: 'Generate', value: 'generate' },
{ label: 'Condense', value: 'condense' },
{ label: 'Preserve', value: 'preserve' },
],
},
}),
format: Property.StaticDropdown({
displayName: 'Format',
description: 'The type of artifact you want to create.',
required: false,
options: {
options: [
{ label: 'Presentation', value: 'presentation' },
{ label: 'Document', value: 'document' },
{ label: 'Social', value: 'social' },
{ label: 'Webpage', value: 'webpage' },
],
},
}),
themeName: Property.ShortText({
displayName: 'Theme Name',
description:
'The theme from Gamma to be used. Defaults to workspace default.',
required: false,
}),
numCards: Property.Number({
displayName: 'Number of Cards',
description:
'How many cards to create (default 10). Pro: 1-50, Ultra: 1-75.',
required: false,
}),
cardSplit: Property.StaticDropdown({
displayName: 'Card Split',
description: "How your content will be divided into cards. Use '---' in text for breaks.",
required: false,
options: {
options: [
{ label: 'Auto', value: 'auto' },
{ label: 'Input Text Breaks', value: 'inputTextBreaks' },
],
},
}),
additionalInstructions: Property.LongText({
displayName: 'Additional Instructions',
description:
'Extra specifications about the desired content and layouts (1-500 characters).',
required: false,
}),
exportAs: Property.StaticDropdown({
displayName: 'Export As',
description: 'Additional file types for saving your gamma.',
required: false,
options: {
placeholder: "Don't export",
options: [
{ label: 'PDF', value: 'pdf' },
{ label: 'PowerPoint (PPTX)', value: 'pptx' },
],
},
}),
textOptions: Property.Json({
displayName: 'Text Options',
description:
'JSON object for text attributes (e.g., amount, tone, audience, language).',
required: false,
defaultValue: {},
}),
imageOptions: Property.Json({
displayName: 'Image Options',
description:
'JSON object for image attributes (e.g., source, model, style).',
required: false,
defaultValue: {},
}),
cardOptions: Property.Json({
displayName: 'Card Options',
description: 'JSON object for card attributes (e.g., dimensions).',
required: false,
defaultValue: {},
}),
sharingOptions: Property.Json({
displayName: 'Sharing Options',
description:
'JSON object for sharing attributes (e.g., workspaceAccess, externalAccess).',
required: false,
defaultValue: {},
}),
},
async run(context) {
const {
inputText,
textMode,
format,
themeName,
numCards,
cardSplit,
additionalInstructions,
exportAs,
textOptions,
imageOptions,
cardOptions,
sharingOptions,
folderId,
} = context.propsValue;
const body: Record<string, unknown> = {
inputText,
};
if (textMode) body['textMode'] = textMode;
if (format) body['format'] = format;
if (themeName) body['themeName'] = themeName;
if (numCards) body['numCards'] = numCards;
if (cardSplit) body['cardSplit'] = cardSplit;
if (additionalInstructions)
body['additionalInstructions'] = additionalInstructions;
if (exportAs) body['exportAs'] = exportAs;
if (textOptions && Object.keys(textOptions).length > 0)
body['textOptions'] = textOptions;
if (imageOptions && Object.keys(imageOptions).length > 0)
body['imageOptions'] = imageOptions;
if (cardOptions && Object.keys(cardOptions).length > 0)
body['cardOptions'] = cardOptions;
if (sharingOptions && Object.keys(sharingOptions).length > 0)
body['sharingOptions'] = sharingOptions;
if (folderId) body['folderIds'] = [folderId];
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: 'https://public-api.gamma.app/v1.0/generations',
headers: {
'X-API-KEY': context.auth.props.apiKey,
'Content-Type': 'application/json',
},
body: body,
});
return response.body;
},
});