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:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,33 @@
{
"extends": [
"../../../../.eslintrc.base.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}

View File

@@ -0,0 +1,7 @@
# pieces-linkup
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build pieces-linkup` to build the library.

View File

@@ -0,0 +1,10 @@
{
"name": "@activepieces/piece-linkup",
"version": "0.0.1",
"type": "commonjs",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"dependencies": {
"tslib": "^2.3.0"
}
}

View File

@@ -0,0 +1,65 @@
{
"name": "pieces-linkup",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/linkup/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/linkup",
"tsConfig": "packages/pieces/community/linkup/tsconfig.lib.json",
"packageJson": "packages/pieces/community/linkup/package.json",
"main": "packages/pieces/community/linkup/src/index.ts",
"assets": [
"packages/pieces/community/linkup/*.md",
{
"input": "packages/pieces/community/linkup/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/linkup",
"command": "bun install --no-save --silent"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
}
}
}

View File

@@ -0,0 +1,45 @@
{
"Linkup is a web search engine for AI apps. Connect your AI application to the internet and get grounding data to enrich your AI's output.": "Linkup is a web search engine for AI apps. Connect your AI application to the internet and get grounding data to enrich your AI's output.",
"\nTo get your API Key:\n\n1. Go to your Linkup account dashboard\n2. Navigate to API settings\n3. Copy your API key\n4. Paste it here\n": "\nTo get your API Key:\n\n1. Go to your Linkup account dashboard\n2. Navigate to API settings\n3. Copy your API key\n4. Paste it here\n",
"Search the Web": "Search the Web",
"Fetch Webpage": "Fetch Webpage",
"Search the web for relevant content based on a natural language query. Perfect for grounding LLM responses with factual data.": "Search the web for relevant content based on a natural language query. Perfect for grounding LLM responses with factual data.",
"Fetch a webpage and convert it to markdown format. Optionally render JavaScript, include raw HTML, or extract images.": "Fetch a webpage and convert it to markdown format. Optionally render JavaScript, include raw HTML, or extract images.",
"Query": "Query",
"Search Depth": "Search Depth",
"Output Type": "Output Type",
"Structured Output Schema": "Structured Output Schema",
"Include Sources": "Include Sources",
"Include Images": "Include Images",
"From Date": "From Date",
"To Date": "To Date",
"Include Domains": "Include Domains",
"Exclude Domains": "Exclude Domains",
"Include Inline Citations": "Include Inline Citations",
"Max Results": "Max Results",
"URL": "URL",
"Render JavaScript": "Render JavaScript",
"Include Raw HTML": "Include Raw HTML",
"Extract Images": "Extract Images",
"The natural language question or query to search for": "The natural language question or query to search for",
"Standard returns results faster; deep takes longer but yields more comprehensive results": "Standard returns results faster; deep takes longer but yields more comprehensive results",
"Format of the response. Use structured for custom JSON format.": "Format of the response. Use structured for custom JSON format.",
"JSON schema (as a string) for the desired response format. Required only when Output Type is \"structured\".": "JSON schema (as a string) for the desired response format. Required only when Output Type is \"structured\".",
"Include sources in the response. Only relevant when Output Type is \"structured\".": "Include sources in the response. Only relevant when Output Type is \"structured\".",
"Include images in search results": "Include images in search results",
"Start date for search results in ISO 8601 format (YYYY-MM-DD), e.g., 2025-01-01": "Start date for search results in ISO 8601 format (YYYY-MM-DD), e.g., 2025-01-01",
"End date for search results in ISO 8601 format (YYYY-MM-DD), e.g., 2025-01-01": "End date for search results in ISO 8601 format (YYYY-MM-DD), e.g., 2025-01-01",
"Domains to search within (up to 100 domains). Leave empty to search all domains.": "Domains to search within (up to 100 domains). Leave empty to search all domains.",
"Domains to exclude from search results": "Domains to exclude from search results",
"Include inline citations in the answer. Only relevant when Output Type is \"sourcedAnswer\".": "Include inline citations in the answer. Only relevant when Output Type is \"sourcedAnswer\".",
"Maximum number of results to return": "Maximum number of results to return",
"The URL of the webpage to fetch": "The URL of the webpage to fetch",
"Render JavaScript on the webpage before fetching": "Render JavaScript on the webpage before fetching",
"Include the raw HTML in the response": "Include the raw HTML in the response",
"Extract images from the webpage": "Extract images from the webpage",
"Standard": "Standard",
"Deep": "Deep",
"Search Results": "Search Results",
"Sourced Answer": "Sourced Answer",
"Structured": "Structured"
}

View File

@@ -0,0 +1,17 @@
import { createPiece } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { linkupAuth } from './lib/common/auth';
import { search } from './lib/actions/search';
import { fetch } from './lib/actions/fetch';
export const linkup = createPiece({
displayName: 'Linkup',
description: 'Linkup is a web search engine for AI apps. Connect your AI application to the internet and get grounding data to enrich your AI\'s output.',
auth: linkupAuth,
minimumSupportedRelease: '0.36.1',
logoUrl: 'https://cdn.activepieces.com/pieces/linkup.png',
categories: [PieceCategory.DEVELOPER_TOOLS],
authors: ["onyedikachi-david"],
actions: [search, fetch],
triggers: [],
});

View File

@@ -0,0 +1,63 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { linkupAuth } from '../common/auth';
import { linkupApiCall } from '../common/client';
export const fetch = createAction({
auth: linkupAuth,
name: 'fetch',
displayName: 'Fetch Webpage',
description: 'Fetch a webpage and convert it to markdown format. Optionally render JavaScript, include raw HTML, or extract images.',
props: {
url: Property.ShortText({
displayName: 'URL',
description: 'The URL of the webpage to fetch',
required: true,
}),
renderJs: Property.Checkbox({
displayName: 'Render JavaScript',
description: 'Render JavaScript on the webpage before fetching',
required: false,
defaultValue: false,
}),
includeRawHtml: Property.Checkbox({
displayName: 'Include Raw HTML',
description: 'Include the raw HTML in the response',
required: false,
defaultValue: false,
}),
extractImages: Property.Checkbox({
displayName: 'Extract Images',
description: 'Extract images from the webpage',
required: false,
defaultValue: false,
}),
},
async run(context) {
const { url, renderJs, includeRawHtml, extractImages } = context.propsValue;
const body: Record<string, any> = {
url,
};
if (renderJs !== undefined) {
body['renderJs'] = renderJs;
}
if (includeRawHtml !== undefined) {
body['includeRawHtml'] = includeRawHtml;
}
if (extractImages !== undefined) {
body['extractImages'] = extractImages;
}
return await linkupApiCall({
method: HttpMethod.POST,
path: '/v1/fetch',
body,
auth: context.auth,
});
},
});

View File

@@ -0,0 +1,161 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { linkupAuth } from '../common/auth';
import { linkupApiCall } from '../common/client';
export const search = createAction({
auth: linkupAuth,
name: 'search',
displayName: 'Search the Web',
description: 'Search the web for relevant content based on a natural language query. Perfect for grounding LLM responses with factual data.',
props: {
q: Property.ShortText({
displayName: 'Query',
description: 'The natural language question or query to search for',
required: true,
}),
depth: Property.StaticDropdown({
displayName: 'Search Depth',
description: 'Standard returns results faster; deep takes longer but yields more comprehensive results',
required: true,
defaultValue: 'standard',
options: {
options: [
{ label: 'Standard', value: 'standard' },
{ label: 'Deep', value: 'deep' },
],
},
}),
outputType: Property.StaticDropdown({
displayName: 'Output Type',
description: 'Format of the response. Use structured for custom JSON format.',
required: true,
defaultValue: 'searchResults',
options: {
options: [
{ label: 'Search Results', value: 'searchResults' },
{ label: 'Sourced Answer', value: 'sourcedAnswer' },
{ label: 'Structured', value: 'structured' },
],
},
}),
structuredOutputSchema: Property.LongText({
displayName: 'Structured Output Schema',
description: 'JSON schema (as a string) for the desired response format. Required only when Output Type is "structured".',
required: false,
}),
includeSources: Property.Checkbox({
displayName: 'Include Sources',
description: 'Include sources in the response. Only relevant when Output Type is "structured".',
required: false,
defaultValue: false,
}),
includeImages: Property.Checkbox({
displayName: 'Include Images',
description: 'Include images in search results',
required: false,
defaultValue: false,
}),
fromDate: Property.ShortText({
displayName: 'From Date',
description: 'Start date for search results in ISO 8601 format (YYYY-MM-DD), e.g., 2025-01-01',
required: false,
}),
toDate: Property.ShortText({
displayName: 'To Date',
description: 'End date for search results in ISO 8601 format (YYYY-MM-DD), e.g., 2025-01-01',
required: false,
}),
includeDomains: Property.Array({
displayName: 'Include Domains',
description: 'Domains to search within (up to 100 domains). Leave empty to search all domains.',
required: false,
}),
excludeDomains: Property.Array({
displayName: 'Exclude Domains',
description: 'Domains to exclude from search results',
required: false,
}),
includeInlineCitations: Property.Checkbox({
displayName: 'Include Inline Citations',
description: 'Include inline citations in the answer. Only relevant when Output Type is "sourcedAnswer".',
required: false,
defaultValue: false,
}),
maxResults: Property.Number({
displayName: 'Max Results',
description: 'Maximum number of results to return',
required: false,
}),
},
async run(context) {
const {
q,
depth,
outputType,
structuredOutputSchema,
includeSources,
includeImages,
fromDate,
toDate,
includeDomains,
excludeDomains,
includeInlineCitations,
maxResults,
} = context.propsValue;
if (outputType === 'structured' && !structuredOutputSchema) {
throw new Error('Structured Output Schema is required when Output Type is "structured"');
}
const body: Record<string, any> = {
q,
depth,
outputType,
};
if (outputType === 'structured' && structuredOutputSchema) {
body['structuredOutputSchema'] = structuredOutputSchema;
}
if (outputType === 'structured' && includeSources !== undefined) {
body['includeSources'] = includeSources;
}
if (outputType === 'sourcedAnswer' && includeInlineCitations !== undefined) {
body['includeInlineCitations'] = includeInlineCitations;
}
if (includeImages !== undefined) {
body['includeImages'] = includeImages;
}
if (fromDate) {
body['fromDate'] = fromDate;
}
if (toDate) {
body['toDate'] = toDate;
}
if (includeDomains && includeDomains.length > 0) {
body['includeDomains'] = includeDomains;
}
if (excludeDomains && excludeDomains.length > 0) {
body['excludeDomains'] = excludeDomains;
}
if (maxResults !== undefined && maxResults !== null) {
body['maxResults'] = maxResults;
}
return await linkupApiCall({
method: HttpMethod.POST,
path: '/v1/search',
body,
auth: context.auth,
});
},
});

View File

@@ -0,0 +1,53 @@
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { PieceAuth } from '@activepieces/pieces-framework';
const BASE_URL = 'https://api.linkup.so';
export const linkupAuth = PieceAuth.SecretText({
displayName: 'API Key',
description: `
To get your API Key:
1. Go to your Linkup account dashboard
2. Navigate to API settings
3. Copy your API key
4. Paste it here
`,
required: true,
validate: async ({ auth }) => {
if (!auth) {
return {
valid: false,
error: 'API key is required',
};
}
try {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${BASE_URL}/v1/credits/balance`,
headers: {
Authorization: `Bearer ${auth}`,
'Content-Type': 'application/json',
},
});
if (response.status === 200) {
return {
valid: true,
};
}
return {
valid: false,
error: 'Invalid API key',
};
} catch (error: any) {
return {
valid: false,
error: 'Invalid API key. Please check your API key and try again.',
};
}
},
});

View File

@@ -0,0 +1,68 @@
import { HttpMethod, httpClient, HttpMessageBody, QueryParams } from '@activepieces/pieces-common';
import { AppConnectionValueForAuthProperty, PiecePropValueSchema } from '@activepieces/pieces-framework';
import { linkupAuth } from './auth';
const BASE_URL = 'https://api.linkup.so';
export type LinkupApiCallParams = {
method: HttpMethod;
path: string;
queryParams?: Record<string, string | number | string[] | undefined>;
body?: any;
auth: AppConnectionValueForAuthProperty<typeof linkupAuth>;
};
export async function linkupApiCall<T extends HttpMessageBody>({
method,
path,
queryParams,
body,
auth,
}: LinkupApiCallParams): Promise<T> {
const url = `${BASE_URL}${path}`;
const headers: Record<string, string> = {
Authorization: `Bearer ${auth.secret_text}`,
'Content-Type': 'application/json',
};
const qs: QueryParams = {};
if (queryParams) {
for (const [key, value] of Object.entries(queryParams)) {
if (value !== null && value !== undefined) {
qs[key] = String(value);
}
}
}
try {
const response = await httpClient.sendRequest<T>({
method,
url,
headers,
queryParams: qs,
body,
});
return response.body;
} catch (error: any) {
const statusCode = error.response?.status || error.status;
const errorBody = error.response?.body || error.body;
if (statusCode === 401 || statusCode === 403) {
throw new Error('Authentication failed. Please check your API key.');
}
if (statusCode === 429) {
throw new Error('Rate limit exceeded. Please wait a moment and try again.');
}
if (statusCode >= 400 && statusCode < 500) {
const errorMessage = errorBody?.message || errorBody?.error || error.message || 'Request failed';
throw new Error(`Request failed: ${errorMessage}`);
}
throw error;
}
}

View File

@@ -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"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"]
}