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 { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';
import { slackAuth } from '../auth';
import { getTeamId, SlackAuthValue } from '../common/auth-helpers';
import { appWebhookSetupInfo } from '../common/props';
import { newSavedMessageTriggerOutputSchema } from '../output-schemas';
export const newSavedMessageTrigger = createTrigger({
auth: slackAuth,
name: 'new-saved-message',
classification: 'READ',
displayName: 'New Saved Message',
description: 'Triggers when a message is saved.',
aiMetadata: {
description:
'Fires when the connected Slack user saves (stars) a message. Only star_added events whose saved item is a message fire; saving other item types does not trigger. The event payload is the saved item, including its channel and message reference.',
},
props: {
info: appWebhookSetupInfo,
},
type: TriggerStrategy.APP_WEBHOOK,
sampleData: undefined,
outputSchema: newSavedMessageTriggerOutputSchema,
onEnable: async (context) => {
const teamId = await getTeamId(context.auth as SlackAuthValue);
context.app.createListeners({
events: ['star_added'],
identifierValue: teamId,
});
},
onDisable: async (context) => {
// Ignored
},
run: async (context) => {
const payloadBody = context.payload.body as PayloadBody;
if (payloadBody.event.type === 'star_added' && payloadBody.event.item.type ==='message') {
return [payloadBody.event.item];
}
return [];
},
});
type PayloadBody = {
event: {
type: string;
event_ts: string;
item:{
type:string
}
};
};