Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece - Create integrations app with Activepieces service layer - Add embed token endpoint for iframe integration - Create Automations page with embedded workflow builder - Add sidebar visibility fix for embed mode - Add list inactive customers endpoint to Public API - Include SmoothSchedule triggers: event created/updated/cancelled - Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import {
|
||||
createTrigger,
|
||||
Property,
|
||||
TriggerStrategy,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { uscreenAuth } from '../common/auth';
|
||||
import { uscreenProps } from '../common/props';
|
||||
|
||||
const sampleData = {
|
||||
event: 'video_play',
|
||||
title: 'How to Build an API',
|
||||
id: 987654,
|
||||
chapter_id: 123456,
|
||||
name: 'John Doe',
|
||||
email: 'john.doe@example.com',
|
||||
};
|
||||
|
||||
export const beganToPlayVideo = createTrigger({
|
||||
auth: uscreenAuth,
|
||||
name: 'began_to_play_video',
|
||||
displayName: 'Began to Play Video',
|
||||
description: 'Triggers when a user plays a video for the first time.',
|
||||
props: {
|
||||
setupInstructions: uscreenProps.webhookInstructions(),
|
||||
},
|
||||
sampleData: sampleData,
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
|
||||
async onEnable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async onDisable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
const payload = context.payload as unknown as typeof sampleData;
|
||||
|
||||
if (payload.event !== 'video_play') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [payload];
|
||||
},
|
||||
|
||||
async test(context) {
|
||||
return [sampleData];
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { uscreenAuth } from '../common/auth';
|
||||
import { uscreenProps } from '../common/props';
|
||||
|
||||
const sampleData = {
|
||||
event: 'subscription_canceled',
|
||||
user_id: 123456,
|
||||
user_email: 'user@example.com',
|
||||
subscription_id: 'sub_789xyz',
|
||||
subscription_title: 'Premium Plan',
|
||||
canceled_at: '2025-10-27T13:32:10Z',
|
||||
custom_fields: {
|
||||
favorite_genre: 'Comedy',
|
||||
referral_source: 'Google Ads',
|
||||
},
|
||||
};
|
||||
|
||||
export const canceledSubscription = createTrigger({
|
||||
auth: uscreenAuth,
|
||||
name: 'canceled_subscription',
|
||||
displayName: 'Canceled Subscription',
|
||||
description:
|
||||
'Triggers when a subscription is canceled for a user.',
|
||||
props: { setupInstructions: uscreenProps.webhookInstructions() },
|
||||
sampleData: sampleData,
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
|
||||
async onEnable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async onDisable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
const payload = context.payload as unknown as typeof sampleData;
|
||||
|
||||
if (payload.event !== 'subscription_canceled') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [payload];
|
||||
},
|
||||
|
||||
async test(context) {
|
||||
return [sampleData];
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { uscreenAuth } from '../common/auth';
|
||||
import { uscreenProps } from '../common/props';
|
||||
|
||||
const sampleData = {
|
||||
event: 'user.created',
|
||||
data: {
|
||||
id: 123456,
|
||||
email: 'newuser@example.com',
|
||||
first_name: 'John',
|
||||
last_name: 'Doe',
|
||||
created_at: '2025-10-27T13:00:00Z',
|
||||
custom_fields: {
|
||||
favorite_genre: 'Documentary',
|
||||
how_heard_about_us: 'Referral',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const newUser = createTrigger({
|
||||
auth: uscreenAuth,
|
||||
name: 'new_user',
|
||||
displayName: 'New User',
|
||||
description:
|
||||
'Triggers when a new user is added to your storefront.',
|
||||
props: { setupInstructions: uscreenProps.webhookInstructions() },
|
||||
sampleData: sampleData.data,
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
|
||||
async onEnable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async onDisable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
const payload = context.payload as unknown as typeof sampleData;
|
||||
|
||||
if (payload.event !== 'user_created') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [payload.data];
|
||||
},
|
||||
|
||||
async test(context) {
|
||||
return [sampleData.data];
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,57 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import {
|
||||
DedupeStrategy,
|
||||
Polling,
|
||||
pollingHelper,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { uscreenAuth } from '../common/auth';
|
||||
import { UscreenClient, UscreenInvoice } from '../common/client';
|
||||
|
||||
const sampleData = {
|
||||
id: '789012',
|
||||
title: 'Masterclass Bundle',
|
||||
total: '49.99 USD',
|
||||
amount: '39.99 USD',
|
||||
discount: '10.00 USD',
|
||||
offer_id: '98765',
|
||||
customer_name: 'Jane Smith',
|
||||
customer_email: 'customer@example.com',
|
||||
country_code: 'US',
|
||||
transaction_id: 'tr_1001abcd',
|
||||
ip_address: '192.168.1.101',
|
||||
origin: 'Stripe',
|
||||
coupon: 'WELCOME10',
|
||||
event: 'order_paid',
|
||||
};
|
||||
export const paidOrder = createTrigger({
|
||||
auth: uscreenAuth,
|
||||
name: 'paid_order',
|
||||
displayName: 'Paid Order',
|
||||
description:
|
||||
'Triggers when a payment is processed for subscriptions, bundles, or content.',
|
||||
props: {},
|
||||
sampleData: sampleData,
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
|
||||
async onEnable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async onDisable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
const payload = context.payload as unknown as typeof sampleData;
|
||||
|
||||
if (payload.event !== 'order_paid') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [payload];
|
||||
},
|
||||
|
||||
async test(context) {
|
||||
return [sampleData];
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { uscreenAuth } from '../common/auth';
|
||||
import { uscreenProps } from '../common/props';
|
||||
|
||||
const sampleData = {
|
||||
id: ' 123456',
|
||||
email: 'john.doe@example.com',
|
||||
changes: {
|
||||
name: 'John Doe',
|
||||
email: 'john.doe@example.com',
|
||||
subscription_status: 'active',
|
||||
lifetime_spent: '100',
|
||||
bounced_email: false,
|
||||
status: 'active',
|
||||
field_1: 'value_1',
|
||||
field_2: 'value_2',
|
||||
field_3: 'value_3',
|
||||
},
|
||||
attributes: {
|
||||
name: 'John Doe',
|
||||
email: 'john.doe@example.com',
|
||||
subscription_status: 'active',
|
||||
lifetime_spent: '100',
|
||||
bounced_email: false,
|
||||
segments: ['segment_1', 'segment_2'],
|
||||
status: 'active',
|
||||
origin: 'user.creation_source',
|
||||
},
|
||||
event: 'user_updated',
|
||||
};
|
||||
|
||||
export const userUpdated = createTrigger({
|
||||
auth: uscreenAuth,
|
||||
name: 'user_updated',
|
||||
displayName: 'User Updated',
|
||||
description:
|
||||
'Triggers when a user’s profile or information is updated.',
|
||||
props: { setupInstructions: uscreenProps.webhookInstructions() },
|
||||
sampleData: sampleData,
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
|
||||
async onEnable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async onDisable(context) {
|
||||
//Empty
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
const payload = context.payload as unknown as typeof sampleData;
|
||||
|
||||
if (payload.event !== 'user_updated') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [payload];
|
||||
},
|
||||
|
||||
async test(context) {
|
||||
return [sampleData];
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user