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 { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework';
import { lemonSqueezyAuth } from '../common/auth';
import { createStoreDropdownProperty, disableWebhook, enableWebhook, handleWebhook } from '../common/webhook';
import { webhookSchemas } from '../common/output-schemas';
export const licenseKeyCreatedTrigger = createTrigger({
auth: lemonSqueezyAuth,
name: 'license_key_created',
classification: 'READ',
displayName: 'License Key Created',
description: 'Triggers when a license key is created from a new order',
aiMetadata: {
description: 'Fires when a license key is generated in Lemon Squeezy as a result of a new order for a license-enabled product. Represents the newly issued license key record.',
},
type: TriggerStrategy.WEBHOOK,
props: {
store_id: createStoreDropdownProperty()
},
async onEnable(context) {
await enableWebhook({
auth: context.auth,
store: context.store,
storeId: context.propsValue.store_id,
webhookUrl: context.webhookUrl,
eventName: 'license_key_created',
});
},
async onDisable(context) {
await disableWebhook({ auth: context.auth, store: context.store, eventName: 'license_key_created' });
},
async run(context) {
return handleWebhook({ payload: context.payload, store: context.store, eventName: 'license_key_created' });
},
outputSchema: webhookSchemas.licenseKey,
sampleData: {
meta: {
event_name: 'license_key_created',
custom_data: {
user_id: 123
}
},
data: {
type: 'license_keys',
id: '1',
attributes: {
store_id: 1,
order_id: 1,
order_item_id: 1,
product_id: 1,
variant_id: 1,
user_name: 'John Doe',
user_email: '[email protected]',
key: 'ABCD-EFGH-IJKL-MNOP-QRST-UVWX',
activation_limit: 1,
usage: 0,
status: 'active',
status_formatted: 'Active',
expires_at: null,
created_at: '2021-08-17T09:45:53.000000Z',
updated_at: '2021-08-17T09:45:53.000000Z',
test_mode: false
}
}
}
});