Files
smoothschedule/activepieces-fork/packages/pieces/community/close/src/index.ts
poduck 3aa7199503 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>
2025-12-18 22:59:37 -05:00

63 lines
1.9 KiB
TypeScript

import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
import {
createCustomApiCallAction,
HttpMethod,
} from '@activepieces/pieces-common';
import { createLead } from './lib/actions/create-lead';
import { findLead } from './lib/actions/find-lead';
import { newLeadAdded } from './lib/triggers/new-lead-added';
import { createOpportunity } from './lib/actions/create-opportunity';
import { createContact } from './lib/actions/create-contact';
import { newContactAdded } from './lib/triggers/new-contact-added';
import { findContact } from './lib/actions/find-contact';
import { CLOSE_API_URL, closeApiCall } from './lib/common/client';
import { newOpportunityAdded } from './lib/triggers/new-opportunity';
export const closeAuth = PieceAuth.SecretText({
displayName: 'API Key',
description: 'Your Close CRM API key for authentication.',
required: true,
validate: async ({ auth }) => {
try {
await closeApiCall({
accessToken: auth,
method: HttpMethod.GET,
resourceUri: '/me/',
});
return { valid: true };
} catch {
return {
valid: false,
error: 'Invalid API key.',
};
}
},
});
export const close = createPiece({
displayName: 'Close',
description: 'Sales automation and CRM integration for Close',
auth: closeAuth,
minimumSupportedRelease: '0.36.1',
logoUrl: 'https://cdn.activepieces.com/pieces/close.png',
authors: ['Ani-4x', 'kishanprmr'],
actions: [
createLead,
createContact,
findLead,
createOpportunity,
findContact,
createCustomApiCallAction({
baseUrl: () => CLOSE_API_URL,
auth: closeAuth,
authMapping: async (auth) => {
return {
Authorization: `Basic ${Buffer.from(`${auth}:`).toString('base64')}`,
};
},
}),
],
triggers: [newLeadAdded, newContactAdded, newOpportunityAdded],
});