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 { Property, TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';
import { slackAuth } from '../auth';
import { getTeamId, SlackAuthValue } from '../common/auth-helpers';
import { ViewSubmissionPayload } from '../common/types';
import { interactivitySetupInfo } from '../common/props';
import { newModalInteractionTriggerOutputSchema } from '../output-schemas';
export const newModalInteractionTrigger = createTrigger({
auth: slackAuth,
name: 'new-modal-interaction',
classification: 'READ',
displayName: 'New Modal Interaction',
description: 'Triggers when a user interacts with a modal.',
aiMetadata: {
description:
'Fires when a user interacts with a Slack modal view, either submitting it (view_submission) or closing it (view_closed) depending on the selected interaction type. The event payload is the Slack interaction payload (with the auth token stripped), including the submitted view, its state values, and the acting user.',
},
props: {
info: interactivitySetupInfo,
interactionType: Property.StaticDropdown({
displayName: 'Interaction Type',
description:
'Submit fires on send, Close fires when the modal is dismissed.',
required: true,
defaultValue: 'view_submission',
options: {
disabled: false,
options: [
{ label: 'View Submission', value: 'view_submission' },
{ label: 'View Closed', value: 'view_closed' },
],
},
}),
},
type: TriggerStrategy.APP_WEBHOOK,
sampleData: undefined,
outputSchema: newModalInteractionTriggerOutputSchema,
onEnable: async (context) => {
const teamId = await getTeamId(context.auth as SlackAuthValue);
context.app.createListeners({
events: [context.propsValue.interactionType as string],
identifierValue: teamId,
});
},
onDisable: async (context) => {
// Ignored
},
run: async (context) => {
const body = context.payload.body as { payload: string };
const payload = JSON.parse(body.payload) as ViewSubmissionPayload;
const interactionType = context.propsValue.interactionType as string;
if (payload.type !== interactionType) {
return [];
}
const { token: _token, ...safePayload } = payload;
return [safePayload];
},
});