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-chatsistant
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build pieces-chatsistant` to build the library.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@activepieces/piece-chatsistant",
|
||||
"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-chatsistant",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/pieces/community/chatsistant/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/chatsistant",
|
||||
"tsConfig": "packages/pieces/community/chatsistant/tsconfig.lib.json",
|
||||
"packageJson": "packages/pieces/community/chatsistant/package.json",
|
||||
"main": "packages/pieces/community/chatsistant/src/index.ts",
|
||||
"assets": [
|
||||
"packages/pieces/community/chatsistant/*.md",
|
||||
{
|
||||
"input": "packages/pieces/community/chatsistant/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/chatsistant",
|
||||
"command": "bun install --no-save --silent"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"\nTo get your API Key:\n\n1. Go to [Chatsistant platform](https://app.chatsistant.com/)\n2. Sign up or log in to your account\n3. Click on the \"Account\" menu in the navigation bar\n4. Navigate to the \"API Keys\" section\n5. Click \"Generate new key\"\n6. Enter a description for your key and click \"Generate\"\n7. Copy and save your API key securely\n": "\nTo get your API Key:\n\n1. Go to [Chatsistant platform](https://app.chatsistant.com/)\n2. Sign up or log in to your account\n3. Click on the \"Account\" menu in the navigation bar\n4. Navigate to the \"API Keys\" section\n5. Click \"Generate new key\"\n6. Enter a description for your key and click \"Generate\"\n7. Copy and save your API key securely\n",
|
||||
"Send Message": "Send Message",
|
||||
"Custom API Call": "Custom API Call",
|
||||
"Send a message to a chatbot session": "Send a message to a chatbot session",
|
||||
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
||||
"Chatbot UUID": "Chatbot UUID",
|
||||
"Message": "Message",
|
||||
"Session UUID": "Session UUID",
|
||||
"Method": "Method",
|
||||
"Headers": "Headers",
|
||||
"Query Parameters": "Query Parameters",
|
||||
"Body": "Body",
|
||||
"Response is Binary ?": "Response is Binary ?",
|
||||
"No Error on Failure": "No Error on Failure",
|
||||
"Timeout (in seconds)": "Timeout (in seconds)",
|
||||
"The UUID of the chatbot to send the message to": "The UUID of the chatbot to send the message to",
|
||||
"The message to send to the chatbot": "The message to send to the chatbot",
|
||||
"The UUID of the session to send the message to": "The UUID of the session to send the message to",
|
||||
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
||||
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
|
||||
"GET": "GET",
|
||||
"POST": "POST",
|
||||
"PATCH": "PATCH",
|
||||
"PUT": "PUT",
|
||||
"DELETE": "DELETE",
|
||||
"HEAD": "HEAD",
|
||||
"form submission": "form submission",
|
||||
"Triggered when a form is submitted": "Triggered when a form is submitted",
|
||||
"Markdown": "Markdown",
|
||||
"## Chatsistant Webhook Setup\n To use this trigger, you need to manually set up a webhook in your Chatsistant account:\n\n 1. Login to your Chatsistant account.\n 2. Navigate to **Customizations** tab on the left navigation menu.\n 3. Scroll down to **Webhook** and click to expand it.\n 4. Select the **Form Submission** event and specify the following URL:\n ```text\n {{webhookUrl}}\n ```\n 5. Click Save to register the": "## Chatsistant Webhook Setup\n To use this trigger, you need to manually set up a webhook in your Chatsistant account:\n\n 1. Login to your Chatsistant account.\n 2. Navigate to **Customizations** tab on the left navigation menu.\n 3. Scroll down to **Webhook** and click to expand it.\n 4. Select the **Form Submission** event and specify the following URL:\n ```text\n {{webhookUrl}}\n ```\n 5. Click Save to register the webhook.\n "
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { createPiece } from '@activepieces/pieces-framework';
|
||||
import { sendMessage } from './lib/actions/send-message';
|
||||
import { formSubmission } from './lib/triggers/form-submission';
|
||||
import { chatsistantAuth } from './lib/common/auth';
|
||||
import { createCustomApiCallAction } from '@activepieces/pieces-common';
|
||||
|
||||
export const chatsistant = createPiece({
|
||||
displayName: 'Chatsistant',
|
||||
auth: chatsistantAuth,
|
||||
minimumSupportedRelease: '0.36.1',
|
||||
logoUrl: 'https://cdn.activepieces.com/pieces/chatsistant.png',
|
||||
authors: ['sanket-a11y'],
|
||||
actions: [
|
||||
sendMessage,
|
||||
createCustomApiCallAction({
|
||||
baseUrl: () => 'https://app.chatsistant.com/api/v1',
|
||||
auth: chatsistantAuth,
|
||||
authMapping: async (auth) => {
|
||||
return {
|
||||
Authorization: `Bearer ${auth}`,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
triggers: [formSubmission],
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
import { createAction, Property } from '@activepieces/pieces-framework';
|
||||
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
||||
import { chatsistantAuth } from '../common/auth';
|
||||
import { makeRequest } from '../common/client';
|
||||
|
||||
export const sendMessage = createAction({
|
||||
auth: chatsistantAuth,
|
||||
name: 'sendMessage',
|
||||
displayName: 'Send Message',
|
||||
description: 'Send a message to a chatbot session',
|
||||
props: {
|
||||
chatbot_uuid: Property.ShortText({
|
||||
displayName: 'Chatbot UUID',
|
||||
description: 'The UUID of the chatbot to send the message to',
|
||||
required: true,
|
||||
}),
|
||||
query: Property.LongText({
|
||||
displayName: 'Message',
|
||||
description: 'The message to send to the chatbot',
|
||||
required: true,
|
||||
}),
|
||||
session_uuid: Property.ShortText({
|
||||
displayName: 'Session UUID',
|
||||
description: 'The UUID of the session to send the message to',
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
async run({ auth, propsValue }) {
|
||||
const { chatbot_uuid, session_uuid, query } = propsValue;
|
||||
|
||||
if (!session_uuid) {
|
||||
const response = await makeRequest(
|
||||
auth.secret_text,
|
||||
HttpMethod.POST,
|
||||
`/chatbot/${chatbot_uuid}/session/create`,
|
||||
{}
|
||||
);
|
||||
const session_id = response.uuid;
|
||||
const messageResponse = await makeRequest(
|
||||
auth.secret_text,
|
||||
HttpMethod.POST,
|
||||
`/session/${session_id}/message/stream`,
|
||||
{
|
||||
query,
|
||||
}
|
||||
);
|
||||
return messageResponse;
|
||||
} else {
|
||||
const response = await makeRequest(
|
||||
auth.secret_text,
|
||||
HttpMethod.POST,
|
||||
`/session/${session_uuid}/message/stream`,
|
||||
{
|
||||
query,
|
||||
}
|
||||
);
|
||||
|
||||
return response;
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
import { makeRequest } from './client';
|
||||
|
||||
export const chatsistantAuth = PieceAuth.SecretText({
|
||||
displayName: 'Chatsistant API Key',
|
||||
description: `
|
||||
To get your API Key:
|
||||
|
||||
1. Go to [Chatsistant platform](https://app.chatsistant.com/)
|
||||
2. Sign up or log in to your account
|
||||
3. Click on the "Account" menu in the navigation bar
|
||||
4. Navigate to the "API Keys" section
|
||||
5. Click "Generate new key"
|
||||
6. Enter a description for your key and click "Generate"
|
||||
7. Copy and save your API key securely
|
||||
`,
|
||||
required: true,
|
||||
validate: async ({ auth }) => {
|
||||
if (auth) {
|
||||
try {
|
||||
await makeRequest(auth, HttpMethod.GET, '/chatbots', {});
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid Api Key',
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid Api Key',
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
|
||||
|
||||
export const BASE_URL = `https://app.chatsistant.com/api/v1`;
|
||||
|
||||
export async function makeRequest(
|
||||
api_key: string,
|
||||
method: HttpMethod,
|
||||
path: string,
|
||||
body?: unknown
|
||||
) {
|
||||
try {
|
||||
const response = await httpClient.sendRequest({
|
||||
method,
|
||||
url: `${BASE_URL}${path}`,
|
||||
headers: {
|
||||
Authorization: `Bearer ${api_key}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body,
|
||||
});
|
||||
return response.body;
|
||||
} catch (error: any) {
|
||||
throw new Error(`Unexpected error: ${error.message || String(error)}`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import {
|
||||
createTrigger,
|
||||
TriggerStrategy,
|
||||
Property,
|
||||
} from '@activepieces/pieces-framework';
|
||||
import { chatsistantAuth } from '../common/auth';
|
||||
|
||||
export const formSubmission = createTrigger({
|
||||
auth: chatsistantAuth,
|
||||
name: 'formSubmission',
|
||||
displayName: 'form submission',
|
||||
description: 'Triggered when a form is submitted',
|
||||
props: {
|
||||
markdown: Property.MarkDown({
|
||||
value: `## Chatsistant Webhook Setup
|
||||
To use this trigger, you need to manually set up a webhook in your Chatsistant account:
|
||||
|
||||
1. Login to your Chatsistant account.
|
||||
2. Navigate to **Customizations** tab on the left navigation menu.
|
||||
3. Scroll down to **Webhook** and click to expand it.
|
||||
4. Select the **Form Submission** event and specify the following URL:
|
||||
\`\`\`text
|
||||
{{webhookUrl}}
|
||||
\`\`\`
|
||||
5. Click Save to register the webhook.
|
||||
`,
|
||||
}),
|
||||
},
|
||||
sampleData: {
|
||||
Email: 'test@gmail.com',
|
||||
name: 'Test User',
|
||||
session_uuid: 'cf014deb3b3b438d935f1ee7042ff66f',
|
||||
},
|
||||
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