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,38 @@
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { PieceAuth } from '@activepieces/pieces-framework';
|
||||
import { makeRequest } from './client';
|
||||
import { AppConnectionType } from '@activepieces/shared';
|
||||
|
||||
export const guideliteAuth = PieceAuth.SecretText({
|
||||
displayName: 'Guidelite API Key',
|
||||
description: `
|
||||
To get your API key:
|
||||
1. Sign in to your GuideLite dashboard
|
||||
2. Click on your account in the left panel
|
||||
3. Select "Profile" from the dropdown menu
|
||||
4. Navigate to the API Keys tab and click "Generate API Key"
|
||||
5. Copy your unique API key (you won't be able to view it again unless you delete and create a new one)
|
||||
|
||||
For more information, visit: https://docs.guidelite.ai/reference/quickstart
|
||||
`,
|
||||
required: true,
|
||||
validate: async ({ auth }) => {
|
||||
if (auth) {
|
||||
try {
|
||||
await makeRequest({secret_text: auth, type: AppConnectionType.SECRET_TEXT}, HttpMethod.GET, '/assistant/list');
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API Key',
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
valid: false,
|
||||
error: 'Invalid API Key',
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
|
||||
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
||||
import { guideliteAuth } from '../common/auth';
|
||||
|
||||
export const BASE_URL = `https://api.guidelite.ai/external-api/v1`;
|
||||
|
||||
export async function makeRequest(
|
||||
{secret_text}: AppConnectionValueForAuthProperty<typeof guideliteAuth>,
|
||||
method: HttpMethod,
|
||||
path: string,
|
||||
body?: unknown
|
||||
) {
|
||||
try {
|
||||
const response = await httpClient.sendRequest({
|
||||
method,
|
||||
url: `${BASE_URL}${path}`,
|
||||
headers: {
|
||||
authorization: `Bearer ${secret_text}`,
|
||||
'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 { Property } from '@activepieces/pieces-framework';
|
||||
import { makeRequest } from './client';
|
||||
import { HttpMethod } from '@activepieces/pieces-common';
|
||||
import { guideliteAuth } from './auth';
|
||||
|
||||
export const assistantIdDropdown = Property.Dropdown({
|
||||
displayName: 'Assistant',
|
||||
description: 'Please select assistant',
|
||||
refreshers: [],
|
||||
auth: guideliteAuth,
|
||||
required: true,
|
||||
options: async ({ auth }) => {
|
||||
if (!auth) {
|
||||
return {
|
||||
disabled: true,
|
||||
placeholder: 'Please connect your Guidelite account first.',
|
||||
options: [],
|
||||
};
|
||||
}
|
||||
try {
|
||||
const response = await makeRequest(
|
||||
auth,
|
||||
HttpMethod.GET,
|
||||
'/assistant/list'
|
||||
);
|
||||
|
||||
return {
|
||||
disabled: false,
|
||||
options: response.map((model: any) => {
|
||||
return {
|
||||
label: model.assistantName,
|
||||
value: model.assistantId,
|
||||
};
|
||||
}),
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
disabled: true,
|
||||
options: [],
|
||||
placeholder: "Couldn't load assistants, API key is invalid",
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user