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-youcanbookme
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-youcanbookme` to build the library.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@activepieces/piece-youcanbookme",
|
||||
"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-youcanbookme",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/youcanbookme/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/youcanbookme",
|
||||
"tsConfig": "packages/pieces/community/youcanbookme/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/youcanbookme/package.json",
|
||||
"main": "packages/pieces/community/youcanbookme/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/youcanbookme/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/youcanbookme/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/youcanbookme",
|
||||
"command": "bun install --no-save --silent"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
|
||||
import { newBooking } from './lib/triggers/new-booking';
|
||||
import { PieceCategory } from '@activepieces/shared';
|
||||
import { createprofile } from './lib/actions/create-profile';
|
||||
import { retrieveBookingById } from './lib/actions/retrieve-booking-by-id';
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
import { youcanbookmeAuth } from './lib/common/auth';
|
||||
|
||||
export const youcanbookme = createPiece({
|
||||
displayName: 'YouCanBookMe',
|
||||
auth: youcanbookmeAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/youcanbookme.png',
|
||||
categories: [PieceCategory.SALES_AND_CRM],
|
||||
description:
|
||||
'YouCanBookMe is an online scheduling tool that helps you manage appointments and bookings efficiently.',
|
||||
authors: ['sanket-a11y'],
|
||||
actions: [
|
||||
createprofile,
|
||||
retrieveBookingById,
|
||||
createCustomApiCallAction({
|
||||
auth: youcanbookmeAuth,
|
||||
baseUrl: () => 'https://api.youcanbook.me/v1',
|
||||
authMapping: async (auth) => ({
|
||||
Authorization: `Bearer ${auth.secret_text}`,
|
||||
}),
|
||||
}),
|
||||
],
|
||||
triggers: [newBooking],
|
||||
});
|
||||
@@ -0,0 +1,87 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { youcanbookmeAuth } from '../common/auth';
|
||||
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
|
||||
export const createprofile = createAction({
|
||||
auth: youcanbookmeAuth,
|
||||
name: 'create-profile',
|
||||
displayName: 'Create Profile',
|
||||
description: 'Create a new profile in YouCanBookMe',
|
||||
props: {
|
||||
accountId: Property.ShortText({
|
||||
displayName: 'Account ID',
|
||||
required: true,
|
||||
}),
|
||||
title: Property.ShortText({
|
||||
displayName: 'Profile Title',
|
||||
description: 'The title of the profile',
|
||||
required: true,
|
||||
}),
|
||||
description: Property.LongText({
|
||||
displayName: 'Description',
|
||||
description: 'A description of the profile',
|
||||
required: false,
|
||||
}),
|
||||
subdomain: Property.ShortText({
|
||||
displayName: 'Subdomain',
|
||||
description: 'The subdomain for the profile',
|
||||
required: false,
|
||||
}),
|
||||
timeZone: Property.ShortText({
|
||||
displayName: 'Time Zone',
|
||||
description: 'The time zone for the profile (e.g., America/New_York)',
|
||||
required: false,
|
||||
}),
|
||||
locale: Property.ShortText({
|
||||
displayName: 'Locale',
|
||||
description: 'The locale for the profile (e.g., en-US)',
|
||||
required: false,
|
||||
}),
|
||||
logo: Property.ShortText({
|
||||
displayName: 'Logo URL',
|
||||
description: 'URL to the profile logo',
|
||||
required: false,
|
||||
}),
|
||||
accessCode: Property.ShortText({
|
||||
displayName: 'Access Code',
|
||||
description: 'An access code for the profile',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
async run({ propsValue, auth }) {
|
||||
const {
|
||||
accountId,
|
||||
title,
|
||||
description,
|
||||
subdomain,
|
||||
timeZone,
|
||||
locale,
|
||||
logo,
|
||||
accessCode,
|
||||
} = propsValue;
|
||||
|
||||
const body: any = {
|
||||
accountId,
|
||||
title,
|
||||
};
|
||||
|
||||
if (description) body.description = description;
|
||||
if (subdomain) body.subdomain = subdomain;
|
||||
if (timeZone) body.timeZone = timeZone;
|
||||
if (locale) body.locale = locale;
|
||||
if (logo) body.logo = logo;
|
||||
if (accessCode) body.accessCode = accessCode;
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.POST,
|
||||
url: 'https://api.youcanbook.me/v1/profiles',
|
||||
headers: {
|
||||
Authorization: `Bearer ${auth}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body,
|
||||
});
|
||||
|
||||
return response.body;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { youcanbookmeAuth } from '../common/auth';
|
||||
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
|
||||
export const retrieveBookingById = createAction({
|
||||
auth: youcanbookmeAuth,
|
||||
name: 'retrieveBookingById',
|
||||
displayName: 'Retrieve Booking by ID',
|
||||
description: 'Retrieve a booking by its ID from YouCanBookMe',
|
||||
props: {
|
||||
bookingId: Property.ShortText({
|
||||
displayName: 'Booking ID',
|
||||
description: 'The ID of the booking to retrieve',
|
||||
required: true,
|
||||
}),
|
||||
displayTimeZone: Property.ShortText({
|
||||
displayName: 'Display Time Zone',
|
||||
description: 'The time zone to display times in (e.g., America/New_York)',
|
||||
required: false,
|
||||
}),
|
||||
fields: Property.ShortText({
|
||||
displayName: 'Fields',
|
||||
description:
|
||||
'Comma-separated list of fields to return. Default: id,title,accountId,profileId,createdAt,startsAt,endsAt,location,tentative,timeZone,cancelled,numberOfSlots',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
async run({ propsValue, auth }) {
|
||||
const { bookingId, displayTimeZone, fields } = propsValue;
|
||||
|
||||
const queryParams: any = {};
|
||||
if (displayTimeZone) {
|
||||
queryParams.displayTimeZone = displayTimeZone;
|
||||
}
|
||||
if (fields) {
|
||||
queryParams.fields = fields;
|
||||
}
|
||||
|
||||
const response = await httpClient.sendRequest({
|
||||
method: HttpMethod.GET,
|
||||
url: `https://api.youcanbook.me/v1/bookings/${bookingId}`,
|
||||
headers: {
|
||||
Authorization: `Bearer ${auth}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
queryParams,
|
||||
});
|
||||
|
||||
return response.body;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
|
||||
export const youcanbookmeAuth = PieceAuth.SecretText({
|
||||
displayName: 'YouCanBookMe API Key',
|
||||
description: `
|
||||
Go to [app.youcanbookme.com](https://app.youcanbook.me/#/account/security/)
|
||||
`,
|
||||
required: true,
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
import {
|
||||
createTrigger,
|
||||
TriggerStrategy,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { youcanbookmeAuth } from '../common/auth';
|
||||
export const newBooking = createTrigger({
|
||||
auth: youcanbookmeAuth,
|
||||
name: 'newBooking',
|
||||
displayName: 'New Booking',
|
||||
description: 'Trigger when a new booking is made',
|
||||
props: {
|
||||
webhook_setup: Property.MarkDown({
|
||||
value: `
|
||||
## Setting up a Webhook
|
||||
|
||||
1. Select the booking page you want to add a webhook to and click **Edit Settings**
|
||||
2. Select **Additional options** from the left menu
|
||||
3. Click **Notifications** under the sub-menu
|
||||
4. Click into the notification you wish to have the webhook fire (After new booking made, rescheduled, cancelled, reminder, after appointment ends, etc)
|
||||
5. Click the **+** to add a new notification
|
||||
6. Click **Webhook**
|
||||
7. Enter the URL provided by Activepieces (copy from the input field below)
|
||||
\`\`\`text
|
||||
{{webhookUrl}}
|
||||
\`\`\`
|
||||
8. Choose method:
|
||||
- **POST**
|
||||
9. Add payload (optional)
|
||||
10. Click **Save changes**
|
||||
`,
|
||||
}),
|
||||
},
|
||||
sampleData: {
|
||||
startsAt: '2025-12-17',
|
||||
endsAt: '08:30',
|
||||
timeZone: 'UTC',
|
||||
firstName: 'sa',
|
||||
email: 'test@test.com',
|
||||
},
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
async onEnable(context) {
|
||||
// implement webhook creation logic
|
||||
},
|
||||
async onDisable(context) {
|
||||
// implement webhook deletion logic
|
||||
},
|
||||
async run(context) {
|
||||
return [context.payload.body];
|
||||
},
|
||||
});
|
||||
@@ -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