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,101 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { linearAuth } from '../..';
|
||||
import { makeClient } from '../common/client';
|
||||
import { props } from '../common/props';
|
||||
|
||||
export const linearNewIssue = createTrigger({
|
||||
auth: linearAuth,
|
||||
name: 'new_issue',
|
||||
displayName: 'New Issue',
|
||||
description: 'Triggers when Linear receives a new issue',
|
||||
props: {
|
||||
team_id: props.team_id(),
|
||||
},
|
||||
sampleData: {
|
||||
// Sample data structure based on Linear's webhook payload for issues
|
||||
action: 'create',
|
||||
data: {
|
||||
id: 'issue_1',
|
||||
identifier: '1',
|
||||
title: 'Test issue',
|
||||
description: 'This is a test issue',
|
||||
priority: 'priority_1',
|
||||
priorityLabel: 'High',
|
||||
state: 'state_1',
|
||||
stateLabel: 'In Progress',
|
||||
team: {
|
||||
id: 'team_1',
|
||||
name: 'Test team',
|
||||
key: 'test-team',
|
||||
description: 'This is a test team',
|
||||
archived: false,
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
creator: {
|
||||
id: 'user_1',
|
||||
name: 'Test user',
|
||||
email: 'test@gmail.com',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
assignee: {
|
||||
id: 'user_1',
|
||||
name: 'Test user',
|
||||
email: 'test@gmail.com',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
labels: [
|
||||
{
|
||||
id: 'label_1',
|
||||
name: 'Test label',
|
||||
color: '#000000',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
],
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
},
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
async onEnable(context) {
|
||||
const client = makeClient(context.auth);
|
||||
const webhook = await client.createWebhook({
|
||||
label: 'ActivePieces New Issue',
|
||||
url: context.webhookUrl,
|
||||
teamId: context.propsValue['team_id'],
|
||||
resourceTypes: ['Issue'],
|
||||
});
|
||||
if (webhook.success && webhook.webhook) {
|
||||
await context.store?.put<WebhookInformation>('_new_issue_trigger', {
|
||||
webhookId: (await webhook.webhook).id,
|
||||
});
|
||||
} else {
|
||||
console.error('Failed to create the webhook');
|
||||
}
|
||||
},
|
||||
async onDisable(context) {
|
||||
const client = makeClient(context.auth);
|
||||
const response = await context.store?.get<WebhookInformation>(
|
||||
'_new_issue_trigger'
|
||||
);
|
||||
if (response && response.webhookId) {
|
||||
await client.deleteWebhook(response.webhookId);
|
||||
}
|
||||
},
|
||||
async run(context) {
|
||||
const body = context.payload.body as { action: string; data: unknown };
|
||||
if (body.action === 'create') {
|
||||
return [body.data];
|
||||
}
|
||||
return [];
|
||||
},
|
||||
});
|
||||
|
||||
interface WebhookInformation {
|
||||
webhookId: string;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { linearAuth } from '../..';
|
||||
import { makeClient } from '../common/client';
|
||||
import { props } from '../common/props';
|
||||
|
||||
export const linearRemovedIssue = createTrigger({
|
||||
auth: linearAuth,
|
||||
name: 'removed_issue',
|
||||
displayName: 'Removed Issue',
|
||||
description: 'Triggers when an existing Linear issue is removed',
|
||||
props: {
|
||||
team_id: props.team_id()
|
||||
},
|
||||
sampleData: {
|
||||
// Sample data structure based on Linear's webhook payload for issues
|
||||
action: 'remove',
|
||||
data: {
|
||||
id: 'issue_1',
|
||||
identifier: '1',
|
||||
title: 'Test issue',
|
||||
description: 'This is a test issue',
|
||||
priority: 'priority_1',
|
||||
priorityLabel: 'High',
|
||||
state: 'state_1',
|
||||
stateLabel: 'In Progress',
|
||||
team: {
|
||||
id: 'team_1',
|
||||
name: 'Test team',
|
||||
key: 'test-team',
|
||||
description: 'This is a test team',
|
||||
archived: false,
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
creator: {
|
||||
id: 'user_1',
|
||||
name: 'Test user',
|
||||
email: 'test@gmail.com',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
assignee: {
|
||||
id: 'user_1',
|
||||
name: 'Test user',
|
||||
email: 'test@gmail.com',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
labels: [
|
||||
{
|
||||
id: 'label_1',
|
||||
name: 'Test label',
|
||||
color: '#000000',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
],
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z',
|
||||
},
|
||||
},
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
async onEnable(context) {
|
||||
const client = makeClient(context.auth);
|
||||
const webhook = await client.createWebhook({
|
||||
label: 'ActivePieces Updated Issue',
|
||||
url: context.webhookUrl,
|
||||
teamId: context.propsValue['team_id'],
|
||||
resourceTypes: ['Issue']
|
||||
});
|
||||
if (webhook.success && webhook.webhook) {
|
||||
await context.store?.put<WebhookInformation>('_removed_issue_trigger', {
|
||||
webhookId: (await webhook.webhook).id
|
||||
});
|
||||
} else {
|
||||
console.error('Failed to create the webhook');
|
||||
}
|
||||
},
|
||||
async onDisable(context) {
|
||||
const client = makeClient(context.auth);
|
||||
const response = await context.store?.get<WebhookInformation>(
|
||||
'_removed_issue_trigger'
|
||||
);
|
||||
if (response && response.webhookId) {
|
||||
await client.deleteWebhook(response.webhookId);
|
||||
}
|
||||
},
|
||||
async run(context) {
|
||||
const body = context.payload.body as { action: string; data: unknown};
|
||||
if (body.action === 'remove') {
|
||||
return [body.data];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
interface WebhookInformation {
|
||||
webhookId: string;
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
||||
import { linearAuth } from '../..';
|
||||
import { makeClient } from '../common/client';
|
||||
import { props } from '../common/props';
|
||||
|
||||
export const linearUpdatedIssue = createTrigger({
|
||||
auth: linearAuth,
|
||||
name: 'updated_issue',
|
||||
displayName: 'Updated Issue',
|
||||
description: 'Triggers when an existing Linear issue is updated',
|
||||
props: {
|
||||
team_id: props.team_id(false)
|
||||
},
|
||||
sampleData: {
|
||||
// Sample data structure based on Linear's webhook payload for issues
|
||||
action: 'update',
|
||||
data: {
|
||||
id: 'issue_1',
|
||||
identifier: '1',
|
||||
title: 'Test issue updated',
|
||||
description: 'This is a test issue (updated)',
|
||||
priority: 'priority_1',
|
||||
priorityLabel: 'High',
|
||||
state: 'state_2',
|
||||
stateLabel: 'In Review',
|
||||
team: {
|
||||
id: 'team_2',
|
||||
name: 'Test team',
|
||||
key: 'test-team',
|
||||
description: 'This is another test team',
|
||||
archived: false,
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-06T12:00:00.000Z'
|
||||
},
|
||||
creator: {
|
||||
id: 'user_1',
|
||||
name: 'Test user',
|
||||
email: 'test@gmail.com',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-06T12:00:00.000Z'
|
||||
},
|
||||
assignee: {
|
||||
id: 'user_1',
|
||||
name: 'Test user',
|
||||
email: 'test@gmail.com',
|
||||
avatarUrl: 'https://avatars.githubusercontent.com/u/1?v=4',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z'
|
||||
},
|
||||
labels: [
|
||||
{
|
||||
id: 'label_1',
|
||||
name: 'Test label',
|
||||
color: '#000000',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-05T12:00:00.000Z'
|
||||
},
|
||||
{
|
||||
id: 'label_1',
|
||||
name: 'Test label 2',
|
||||
color: '#000000',
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-06T12:00:00.000Z'
|
||||
}
|
||||
],
|
||||
createdAt: '2023-09-05T12:00:00.000Z',
|
||||
updatedAt: '2023-09-06T12:00:00.000Z'
|
||||
},
|
||||
updatedFrom: {
|
||||
'updatedAt': '2023-09-06T12:00:00.000Z',
|
||||
'sortOrder': -14.61,
|
||||
'startedAt': null,
|
||||
'stateId': 'state_1'
|
||||
}
|
||||
},
|
||||
type: TriggerStrategy.WEBHOOK,
|
||||
async onEnable(context) {
|
||||
const client = makeClient(context.auth);
|
||||
|
||||
// Create webhook configuration
|
||||
const webhookConfig: any = {
|
||||
label: 'ActivePieces Updated Issue',
|
||||
url: context.webhookUrl,
|
||||
allPublicTeams: true,
|
||||
resourceTypes: ['Issue']
|
||||
};
|
||||
|
||||
// Only add teamId if it's provided
|
||||
if (context.propsValue['team_id']) {
|
||||
webhookConfig.teamId = context.propsValue['team_id'];
|
||||
}
|
||||
|
||||
const webhook = await client.createWebhook(webhookConfig);
|
||||
|
||||
if (webhook.success && webhook.webhook) {
|
||||
await context.store?.put<WebhookInformation>('_updated_issue_trigger', {
|
||||
webhookId: (await webhook.webhook).id
|
||||
});
|
||||
} else {
|
||||
console.error('Failed to create the webhook');
|
||||
}
|
||||
},
|
||||
async onDisable(context) {
|
||||
const client = makeClient(context.auth);
|
||||
const response = await context.store?.get<WebhookInformation>(
|
||||
'_updated_issue_trigger'
|
||||
);
|
||||
if (response && response.webhookId) {
|
||||
await client.deleteWebhook(response.webhookId);
|
||||
}
|
||||
},
|
||||
async run(context) {
|
||||
const body = context.payload.body as { action: string; data: unknown};
|
||||
if (body.action === 'update') {
|
||||
return [body.data];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
interface WebhookInformation {
|
||||
webhookId: string;
|
||||
}
|
||||
Reference in New Issue
Block a user