Skip to content

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

1.6 KB
Raw Blame

import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
import { respaidAuth } from '../auth';
import { respaidTriggersCommon } from '../common';

interface NewCancelledCaseTriggerPayload {
    unique_identifier?: string;
    name?: string;
    company_name?: string;
    email?: string;
    phone_number?: string;
    invoice_number?: string;
    amount?: number;
    currency?: string;
    reason?: string;
}
  

export const newCancelledCase = createTrigger({
    name: 'new_cancelled_case',
    classification: 'READ',
    displayName: 'New Cancelled Case',
    description: "Triggers when a collection process for a given sequence (case) was cancelled.",
    aiMetadata: {
      description: 'Fires when the collection process for a debtor case (sequence) is cancelled, carrying the debtor/invoice details and the cancellation reason. Use to react to a case being dropped from active collection.',
    },
    auth: respaidAuth,
    props: {},
    sampleData: {
        "unique_identifier": "123",
        "name": "John Doe",
        "company_name": "Company XYZ",
        "email": "[email protected]",
        "phone_number": "1234567890",
        "invoice_number": "INV123",
        "amount": 1000,
        "currency": "usd",
        "reason": "Issue with invoice"
    },
    type: TriggerStrategy.WEBHOOK,
    onEnable: respaidTriggersCommon.onEnable('new_cancelled_case'),
    onDisable: respaidTriggersCommon.onDisable('new_cancelled_case'),
    async run(context) {
        const payload = respaidTriggersCommon.getPayload(context);
        return [payload as NewCancelledCaseTriggerPayload];
    },
})