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,33 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../../../.eslintrc.base.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.ts",
|
||||
"*.tsx"
|
||||
],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.jsx"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# pieces-youform
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-youform` to build the library.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@activepieces/piece-youform",
|
||||
"version": "0.0.1",
|
||||
"type": "commonjs",
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/index.d.ts",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "pieces-youform",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/youform/src",
|
||||
"projectType": "library",
|
||||
"release": {
|
||||
"version": {
|
||||
"manifestRootsToUpdate": [
|
||||
"dist/{projectRoot}"
|
||||
],
|
||||
"currentVersionResolver": "git-tag",
|
||||
"fallbackCurrentVersionResolver": "disk"
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"options": {
|
||||
"outputPath": "dist/packages/pieces/community/youform",
|
||||
"tsConfig": "packages/pieces/community/youform/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/youform/package.json",
|
||||
"main": "packages/pieces/community/youform/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/youform/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/youform/src/i18n",
|
||||
"output": "./src/i18n",
|
||||
"glob": "**/!(i18n.json)"
|
||||
}
|
||||
],
|
||||
"buildableProjectDepsInPackageJsonType": "dependencies",
|
||||
"updateBuildableProjectDepsInPackageJson": true
|
||||
},
|
||||
"dependsOn": [
|
||||
"prebuild",
|
||||
"^build"
|
||||
]
|
||||
},
|
||||
"nx-release-publish": {
|
||||
"options": {
|
||||
"packageRoot": "dist/{projectRoot}"
|
||||
}
|
||||
},
|
||||
"prebuild": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"cwd": "packages/pieces/community/youform",
|
||||
"command": "bun install --no-save --silent"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"You can obtain API token from [Account Settings](https://app.youform.com/account).": "You can obtain API token from [Account Settings](https://app.youform.com/account).",
|
||||
"New Submission": "New Submission",
|
||||
"Triggers When a new submission is recieved.": "Triggers When a new submission is recieved.",
|
||||
"Form": "Form"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { createPiece } from '@activepieces/pieces-framework';
|
||||
import { youformAuth } from './lib/common/auth';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { newSubmissionTrigger } from './lib/triggers/new-form-submission';
|
||||
|
||||
export const youform = createPiece({
|
||||
displayName: 'Youform',
|
||||
auth: youformAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/youform.png',
|
||||
authors: ['kishanprmr'],
|
||||
categories: [PieceCategory.FORMS_AND_SURVEYS],
|
||||
actions: [],
|
||||
triggers: [newSubmissionTrigger],
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
import {
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { BASE_URL } from './constants';
|
||||
|
||||
export const youformAuth = PieceAuth.SecretText({
|
||||
displayName: 'API Token',
|
||||
description: `You can obtain API token from [Account Settings](https://app.youform.com/account).`,
|
||||
required: true,
|
||||
validate: async ({ auth }) => {
|
||||
try {
|
||||
await httpClient.sendRequest({
|
||||
method: HttpMethod.GET,
|
||||
url: BASE_URL + '/me',
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth,
|
||||
},
|
||||
});
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API Token',
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
export const BASE_URL = 'https://app.youform.com/api'
|
||||
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { Property } from '@activepieces/pieces-framework';
|
||||
import { BASE_URL } from './constants';
|
||||
import { ListFormsResponse } from './types';
|
||||
import { youformAuth } from './auth';
|
||||
|
||||
export const formIdDropdown = Property.Dropdown({
|
||||
auth: youformAuth,
|
||||
displayName: 'Form',
|
||||
refreshers: [],
|
||||
required: true,
|
||||
options: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
placeholder: 'Please connect your account first.',
|
||||
options: [],
|
||||
disabled: false,
|
||||
};
|
||||
}
|
||||
|
||||
const response = await httpClient.sendRequest<ListFormsResponse>({
|
||||
method: HttpMethod.GET,
|
||||
url: BASE_URL + '/forms',
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: auth.secret_text,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: response.body.data.data.map((form) => ({
|
||||
label: form.name,
|
||||
value: form.slug,
|
||||
})),
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
export type ListFormsResponse = {
|
||||
data:{
|
||||
data: {
|
||||
id: number;
|
||||
name: string;
|
||||
slug:string
|
||||
}[];}
|
||||
};
|
||||
|
||||
|
||||
export type CreateWebhookResponse = {
|
||||
data:{
|
||||
id:number
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { youformAuth } from '../common/auth';
|
||||
import { formIdDropdown } from '../common/props';
|
||||
import {
|
||||
AuthenticationType,
|
||||
httpClient,
|
||||
HttpMethod,
|
||||
} from '@activepieces/pieces-common';
|
||||
import { BASE_URL } from '../common/constants';
|
||||
import { CreateWebhookResponse } from '../common/types';
|
||||
import { isNil } from '@activepieces/shared';
|
||||
|
||||
const TRIGGER_KEY = 'youform-new-submission-trigger';
|
||||
|
||||
export const newSubmissionTrigger = createTrigger({
|
||||
name: 'new-submission',
|
||||
auth: youformAuth,
|
||||
displayName: 'New Submission',
|
||||
description: 'Triggers When a new submission is recieved.',
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
props: {
|
||||
formId: formIdDropdown,
|
||||
},
|
||||
async onEnable(context) {
|
||||
const { formId } = context.propsValue;
|
||||
|
||||
const response = await httpClient.sendRequest<CreateWebhookResponse>({
|
||||
method: HttpMethod.POST,
|
||||
url: BASE_URL + '/webhooks',
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: context.auth.secret_text,
|
||||
},
|
||||
body:{},
|
||||
queryParams: {
|
||||
form_id: formId.toString(),
|
||||
webhook_url: context.webhookUrl,
|
||||
},
|
||||
});
|
||||
|
||||
const webhookId = response.body.data.id;
|
||||
|
||||
await context.store.put<number>(TRIGGER_KEY, webhookId);
|
||||
},
|
||||
async onDisable(context) {
|
||||
const webhookId = await context.store.get<number>(TRIGGER_KEY);
|
||||
|
||||
if (!isNil(webhookId)) {
|
||||
await httpClient.sendRequest<CreateWebhookResponse>({
|
||||
method: HttpMethod.DELETE,
|
||||
url: BASE_URL + `/webhooks/${webhookId}`,
|
||||
authentication: {
|
||||
type: AuthenticationType.BEARER_TOKEN,
|
||||
token: context.auth.secret_text,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
async run(context) {
|
||||
return [context.payload.body];
|
||||
},
|
||||
async test(context) {
|
||||
return [context.payload.body];
|
||||
},
|
||||
sampleData: undefined,
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"importHelpers": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noPropertyAccessFromIndexSignature": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user