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.9 KB
Raw Blame

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


interface NewDisputedCaseTriggerPayload {
    unique_identifier?: string;
    name?: string;
    company_name?: string;
    email?: string;
    phone_number?: string;
    invoice_number?: string;
    amount?: number;
    currency?: string;
    context?: string;
    attachment?: string;
}

export const newDisputedCase = createTrigger({
    name: 'new_disputed_case',
    classification: 'READ',
    displayName: 'New Disputed Case',
    description: "Triggers when a collection process was disputed by the debtor.",
    aiMetadata: {
      description: 'Fires when a debtor disputes (contests) an ongoing collection case, carrying the debtor/invoice details plus the dispute context and any attachment. Use to react to a contested debt that may need manual review.',
    },
    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",
        "context": "Q: In order to stop the proceedings against you and not increase the amount of the debt, we can offer you\n" +
            "A: Payment in instalments of up to 5 months (activation of instalments within 1 working day).\n" +
            "Q: Do you agree to sign the following mandate?\n" +
            "A: I agree",
        "attachment": "https://link_excel.com/"
    },
    type: TriggerStrategy.WEBHOOK,
    onEnable: respaidTriggersCommon.onEnable('new_disputed_case'),
    onDisable: respaidTriggersCommon.onDisable('new_disputed_case'),
    async run(context) {
        const payload = respaidTriggersCommon.getPayload(context);
        return [payload as NewDisputedCaseTriggerPayload];
    },
})