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.7 KB
Raw Blame
import {
  createTrigger,
  Property,
  TriggerStrategy,
} from '@activepieces/pieces-framework';
import { moonclerkAuth } from '../common/auth';
export const paymentSucceeds = createTrigger({
  auth: moonclerkAuth,
  name: 'paymentSucceeds',
  displayName: 'Payment Succeeds',
  description: '',
  aiMetadata: {
    description: 'Fires when a payment in MoonClerk succeeds (is collected successfully). Use to react only to successful charges, distinct from the New Payment trigger which fires on payments in any state. Requires a MoonClerk webhook configured for the Payment Succeeds event.',
  },
  props: {
    markdown: Property.MarkDown({
      value: `## MoonClerk Webhook Setup
                                To use this trigger, you need to manually set up a webhook in your MoonClerk account:
                    
                                1. Login to your MoonClerk account.
                                2. Navigate to **Account** -> **Settings** -> **Webhooks**.
                                3. **Create webhook Endpoint**. keep state as active.
                                4. Specify the following URL in the **Webhook URL** field:
                                \`\`\`text
                                {{webhookUrl}}
                                \`\`\`
                                5. Select the **Payment Succeeds** event.
                                5. Click Save Agent.
                                `,
    }),
  },
  sampleData: {},
  type: TriggerStrategy.WEBHOOK,
  async onEnable(context) {
    // implement webhook creation logic
  },
  async onDisable(context) {
    // implement webhook deletion logic
  },
  async run(context) {
    return [context.payload.body];
  },
});