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 { createAction } from '@activepieces/pieces-framework';
import { paperformAuth } from '../common/auth';
import { paperformCommon } from '../common/client';
import { HttpMethod } from '@activepieces/pieces-common';
import { paperformCommonProps } from '../common/props';
export const deleteFormCoupon = createAction({
auth: paperformAuth,
name: 'deleteFormCoupon',
displayName: 'Delete Form Coupon',
description: 'Deletes a coupon from a form.',
audience: 'both',
aiMetadata: { description: 'Permanently deletes a discount coupon, identified by its coupon code, from the specified Paperform form. Use to remove a promotional code; this is destructive and not idempotent.', idempotent: false },
props: {
formId: paperformCommonProps.formId,
couponCode:paperformCommonProps.couponCode,
},
async run({ auth, propsValue }) {
const { formId, couponCode } = propsValue;
try {
await paperformCommon.apiCall({
method: HttpMethod.DELETE,
url: `/forms/${formId}/coupons/${couponCode}`,
auth: auth.secret_text,
});
return {
success: true,
message: `Coupon "${couponCode}" has been successfully deleted.`,
};
} catch (error: any) {
throw new Error(`Failed to delete coupon: ${error.message}`);
}
},
});