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, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { talkableAuth } from '../../..';
import { TALKABLE_API_URL } from '../../common/constants';
export const refund = createAction({
name: 'refund', // Must be a unique across the piece, this shouldn't be changed.
classification: 'WRITE',
auth: talkableAuth,
displayName: 'Refund purchase/event',
description: 'Mark origin as refund',
audience: 'both',
aiMetadata: { description: 'Mark an existing purchase or event origin in Talkable as refunded, identified by its order/event number (origin slug), optionally with a partial refund subtotal and refund date. Use when an order is returned or canceled so referral attribution is reversed. Not idempotent: each call records a refund against the origin.', idempotent: false },
props: {
origin_slug: Property.ShortText({
displayName: 'Order or event number',
description: undefined,
required: true,
}),
refund_subtotal: Property.Number({
displayName: 'Refund subtotal',
description: undefined,
required: false,
}),
refunded_at: Property.DateTime({
displayName: 'Refunded date',
description: undefined,
required: false,
}),
},
async run(context) {
const { site, api_key } = context.auth.props;
const { origin_slug, refund_subtotal, refunded_at } = context.propsValue;
const refundResponse = await httpClient
.sendRequest<string[]>({
method: HttpMethod.POST,
url: `${TALKABLE_API_URL}/origins/${origin_slug}/refund`,
headers: {
Authorization: `Bearer ${api_key}`,
'Content-Type': 'application/json',
},
body: {
site_slug: site,
data: {
refunded_at,
refund_subtotal,
},
},
});
return refundResponse.body;
},
});