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 { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
import { pinchPaymentsAuth } from '../common/auth';
import { createWebhook, deleteWebhook, WebhookResponse } from '../common/client';
export const refundUpdatedTrigger = createTrigger({
auth: pinchPaymentsAuth,
name: 'refund_updated',
classification: 'READ',
displayName: 'Refund Updated',
description: 'Triggers when a refund is updated (e.g., status change)',
aiMetadata: {
description: 'Fires when an existing refund changes in Pinch Payments, most commonly a status change (e.g., from pending to completed). Use to track a refund through to settlement.',
},
type: TriggerStrategy.WEBHOOK,
props: {},
async onEnable(context) {
const credentials = {
username: context.auth.props.username,
password: context.auth.props.password,
environment: context.auth.props.environment
};
const webhook = await createWebhook(credentials, {
uri: context.webhookUrl,
webhookFormat: 'camel-case',
eventTypes: ['refund-updated'],
});
await context.store.put<WebhookResponse>('pinch_refund_updated_webhook', webhook);
},
async onDisable(context) {
const webhook = await context.store.get<WebhookResponse>('pinch_refund_updated_webhook');
if (webhook) {
const credentials = {
username: context.auth.props.username,
password: context.auth.props.password,
environment: context.auth.props.environment
};
await deleteWebhook(credentials, webhook.id);
}
},
async run(context) {
return [context.payload.body];
},
sampleData: {
id: 'evt_sample123456',
type: 'refund-updated',
eventDate: '2024-01-15T10:30:00Z',
metadata: {},
data: {
refund: {
id: 'ref_sample123456',
amount: 2500,
status: 'completed',
paymentId: 'pay_sample123456',
},
},
},
});