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,73 @@
|
||||
import {
|
||||
createAction,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import {
|
||||
HttpMethod,
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpRequest,
|
||||
propsValidation,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { z } from 'zod';
|
||||
import { saasticCommon } from '../common';
|
||||
import { saasticAuth } from '../..';
|
||||
|
||||
export const createCharge = createAction({
|
||||
auth: saasticAuth,
|
||||
name: 'create_charge',
|
||||
displayName: 'Create a Customer Charge',
|
||||
description: 'Creates a customer charge.',
|
||||
|
||||
props: {
|
||||
email: Property.LongText({
|
||||
displayName: 'Email',
|
||||
description: "The customer's email address.",
|
||||
required: true,
|
||||
}),
|
||||
amount: Property.Number({
|
||||
displayName: 'Amount',
|
||||
description: 'The amount charged in the smallest currency unit.',
|
||||
required: false,
|
||||
}),
|
||||
currency: Property.ShortText({
|
||||
displayName: 'Currency',
|
||||
description: 'The ISO currency code.',
|
||||
required: false,
|
||||
defaultValue: 'USD',
|
||||
}),
|
||||
charged_at: Property.DateTime({
|
||||
displayName: 'Charge date',
|
||||
description: 'The date the customer was charged.',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
await propsValidation.validateZod(context.propsValue, {
|
||||
email: z.string().email(),
|
||||
});
|
||||
|
||||
const request: HttpRequest = {
|
||||
method: HttpMethod.POST,
|
||||
url: `${saasticCommon.baseUrl}/charges`,
|
||||
body: {
|
||||
email: context.propsValue.email || '',
|
||||
amount: context.propsValue.amount || '',
|
||||
currency: context.propsValue.currency || '',
|
||||
charged_at: context.propsValue.charged_at || '',
|
||||
},
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: context.auth.secret_text,
|
||||
},
|
||||
queryParams: {},
|
||||
};
|
||||
|
||||
await httpClient.sendRequest(request);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
import {
|
||||
createAction,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import {
|
||||
HttpMethod,
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpRequest,
|
||||
propsValidation,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { z } from 'zod';
|
||||
import { saasticCommon } from '../common';
|
||||
import { saasticAuth } from '../..';
|
||||
|
||||
export const createCustomer = createAction({
|
||||
auth: saasticAuth,
|
||||
name: 'create_customer',
|
||||
displayName: 'Create or Update a Customer',
|
||||
description: 'Create or update a customer.',
|
||||
|
||||
props: {
|
||||
first_name: Property.LongText({
|
||||
displayName: 'First Name',
|
||||
description: "The customer's first name.",
|
||||
required: true,
|
||||
}),
|
||||
last_name: Property.LongText({
|
||||
displayName: 'Last Name',
|
||||
description: "The customer's last name.",
|
||||
required: true,
|
||||
}),
|
||||
email: Property.LongText({
|
||||
displayName: 'Email',
|
||||
description: "The customer's email address.",
|
||||
required: true,
|
||||
}),
|
||||
phone: Property.LongText({
|
||||
displayName: 'Phone',
|
||||
description: "The customer's phone number. Ex: +15555555555",
|
||||
required: false,
|
||||
}),
|
||||
signed_up_at: Property.DateTime({
|
||||
displayName: 'Signup Date',
|
||||
description: 'The date the customer signed up.',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
|
||||
async run(context) {
|
||||
await propsValidation.validateZod(context.propsValue, {
|
||||
email: z.string().email(),
|
||||
signed_up_at: z.string().datetime().optional(),
|
||||
});
|
||||
|
||||
const request: HttpRequest = {
|
||||
method: HttpMethod.POST,
|
||||
url: `${saasticCommon.baseUrl}/customers`,
|
||||
body: {
|
||||
first_name: context.propsValue.first_name || '',
|
||||
last_name: context.propsValue.last_name || '',
|
||||
email: context.propsValue.email || '',
|
||||
phone: context.propsValue.phone || '',
|
||||
signed_up_at: context.propsValue.signed_up_at || '',
|
||||
},
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: context.auth.secret_text,
|
||||
},
|
||||
queryParams: {},
|
||||
};
|
||||
await httpClient.sendRequest(request);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
export const saasticCommon = {
|
||||
baseUrl: 'https://api.saastic.com/beacon',
|
||||
};
|
||||
Reference in New Issue
Block a user