Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions packages/pieces/community/proxycurl/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": [
"../../../../.eslintrc.base.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"rules": {}
}
]
}
5 changes: 5 additions & 0 deletions packages/pieces/community/proxycurl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# pieces-proxycurl

## Building

Run `turbo run build --filter=@activepieces/piece-proxycurl` to build the library.
17 changes: 17 additions & 0 deletions packages/pieces/community/proxycurl/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@activepieces/piece-proxycurl",
"version": "0.1.0",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
"lint": "eslint 'src/**/*.ts'"
},
"dependencies": {
"@activepieces/pieces-common": "workspace:*",
"@activepieces/pieces-framework": "workspace:*",
"@activepieces/shared": "workspace:*",
"tslib": "2.6.2"
}
}
41 changes: 41 additions & 0 deletions packages/pieces/community/proxycurl/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { getPersonProfileAction } from './lib/actions/get-person-profile';
import { getCompanyProfileAction } from './lib/actions/get-company-profile';
import { searchPeopleAction } from './lib/actions/search-people';
import { lookupPersonEmailAction } from './lib/actions/lookup-person-email';
import { customApiCallAction } from './lib/actions/custom-api-call';

const markdownDescription = `
To use Proxycurl:
1. Sign in to your Proxycurl account at https://nubela.co/proxycurl.
2. Open your dashboard and copy your API key.
3. Paste the API key here.

Authentication note:
- Proxycurl's public SDK/docs show Bearer token authorization for API requests.
`;

export const proxycurlAuth = PieceAuth.SecretText({
displayName: 'Proxycurl API Key',
description: markdownDescription,
required: true,
});

export const proxycurl = createPiece({
displayName: 'Proxycurl',
description: 'Enrich LinkedIn people and company profiles with Proxycurl.',
auth: proxycurlAuth,
minimumSupportedRelease: '0.36.1',
logoUrl: 'https://cdn.activepieces.com/pieces/proxycurl.png',
categories: [PieceCategory.SALES_AND_CRM],
authors: ['Harmatta'],
actions: [
getPersonProfileAction,
getCompanyProfileAction,
searchPeopleAction,
lookupPersonEmailAction,
customApiCallAction,
],
triggers: [],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { proxycurlAuth } from '../../index';
import { BASE_URL } from '../common/client';

export const customApiCallAction = createCustomApiCallAction({
auth: proxycurlAuth,
name: 'custom_api_call',
displayName: 'Custom API Call',
description: 'Make a custom API call to any Proxycurl endpoint.',
baseUrl: () => BASE_URL,
authMapping: async (auth) => ({
Authorization: `Bearer ${auth.secret_text}`,
Accept: 'application/json',
}),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { proxycurlAuth } from '../../index';
import { proxycurlApiCall } from '../common/client';

export const getCompanyProfileAction = createAction({
name: 'get_company_profile',
displayName: 'Get Company Profile',
description: 'Fetch a LinkedIn company profile from Proxycurl.',
auth: proxycurlAuth,
props: {
url: Property.ShortText({
displayName: 'LinkedIn Company URL',
description: 'LinkedIn company URL, for example https://www.linkedin.com/company/apple/',
required: true,
}),
},
async run(context) {
return proxycurlApiCall({
apiKey: context.auth.secret_text,
method: HttpMethod.GET,
resourceUri: '/linkedin/company',
query: {
url: context.propsValue.url,
},
});
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { proxycurlAuth } from '../../index';
import { proxycurlApiCall } from '../common/client';

export const getPersonProfileAction = createAction({
name: 'get_person_profile',
displayName: 'Get Person Profile',
description: 'Fetch a LinkedIn person profile from Proxycurl.',
auth: proxycurlAuth,
props: {
linkedin_profile_url: Property.ShortText({
displayName: 'LinkedIn Profile URL',
description: 'Public LinkedIn profile URL, for example https://www.linkedin.com/in/williamhgates',
required: true,
}),
},
async run(context) {
return proxycurlApiCall({
apiKey: context.auth.secret_text,
method: HttpMethod.GET,
resourceUri: '/v2/linkedin',
query: {
url: context.propsValue.linkedin_profile_url,
},
});
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { proxycurlAuth } from '../../index';
import { proxycurlApiCall } from '../common/client';

export const lookupPersonEmailAction = createAction({
name: 'lookup_person_email',
displayName: 'Lookup Person Email',
description: 'Lookup the work email address for a LinkedIn person profile.',
auth: proxycurlAuth,
props: {
linkedin_profile_url: Property.ShortText({
displayName: 'LinkedIn Profile URL',
description: 'Public LinkedIn profile URL to enrich.',
required: true,
}),
callback_url: Property.ShortText({
displayName: 'Callback URL',
description: 'Optional webhook URL for async completion callbacks from Proxycurl.',
required: false,
}),
},
async run(context) {
return proxycurlApiCall({
apiKey: context.auth.secret_text,
method: HttpMethod.GET,
resourceUri: '/linkedin/profile/email',
query: {
linkedin_profile_url: context.propsValue.linkedin_profile_url,
callback_url: context.propsValue.callback_url,
},
});
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { proxycurlAuth } from '../../index';
import { proxycurlApiCall } from '../common/client';

export const searchPeopleAction = createAction({
name: 'search_people',
displayName: 'Search People',
description: 'Search for people in Proxycurl using lightweight keyword filters.',
auth: proxycurlAuth,
props: {
country: Property.ShortText({
displayName: 'Country',
description: 'Optional country filter, for example us, gb, or sg.',
required: false,
}),
headline: Property.ShortText({
displayName: 'Headline Keywords',
description: 'Optional keywords expected in the person headline.',
required: false,
}),
summary_keywords: Property.ShortText({
displayName: 'Summary Keywords',
description: 'Optional keywords expected in the summary/about section.',
required: false,
}),
},
async run(context) {
const { country, headline, summary_keywords } = context.propsValue;

if (!country && !headline && !summary_keywords) {
throw new Error(
'At least one search filter must be provided: Country, Headline Keywords, or Summary Keywords.'
);
}

return proxycurlApiCall({
apiKey: context.auth.secret_text,
method: HttpMethod.GET,
resourceUri: '/v2/search/person',
query: {
country,
headline,
summary_keywords,
},
});
},
});
93 changes: 93 additions & 0 deletions packages/pieces/community/proxycurl/src/lib/common/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import {
AuthenticationType,
httpClient,
HttpMethod,
HttpRequest,
QueryParams,
} from '@activepieces/pieces-common';

export const BASE_URL = 'https://nubela.co/proxycurl/api';

type QueryValue = string | number | boolean | undefined | null;

export type ProxycurlApiCallParams = {
apiKey: string;
method: HttpMethod;
resourceUri: string;
query?: Record<string, QueryValue>;
body?: unknown;
};

export async function proxycurlApiCall<T>({
apiKey,
method,
resourceUri,
query,
body,
}: ProxycurlApiCallParams): Promise<T> {
const queryParams: QueryParams = {};

if (query) {
for (const [key, value] of Object.entries(query)) {
if (value !== undefined && value !== null && value !== '') {
queryParams[key] = String(value);
}
}
}

const request: HttpRequest = {
method,
url: `${BASE_URL}${resourceUri}`,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: apiKey,
},
headers: {
Accept: 'application/json',
},
queryParams,
body,
};

try {
const response = await httpClient.sendRequest<T>(request);

if (response.status >= 400) {
const bodyMessage =
typeof response.body === 'string'
? response.body
: JSON.stringify(response.body);
throw new Error(
`Proxycurl API error ${response.status}: ${bodyMessage}`
);
}

return response.body;
} catch (error: unknown) {
const proxycurlError = error as {
response?: { status?: number; body?: unknown };
statusCode?: number;
status?: number;
body?: unknown;
message?: string;
};

const statusCode =
proxycurlError.response?.status ??
proxycurlError.statusCode ??
proxycurlError.status;
const errorBody = proxycurlError.response?.body ?? proxycurlError.body;

if (statusCode) {
const bodyMessage =
typeof errorBody === 'string' ? errorBody : JSON.stringify(errorBody);
throw new Error(
`Proxycurl API error ${statusCode}: ${bodyMessage || proxycurlError.message || 'Unknown error'}`
);
}

throw new Error(
`Proxycurl request failed: ${proxycurlError.message || 'Unknown error'}`
);
}
}
19 changes: 19 additions & 0 deletions packages/pieces/community/proxycurl/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
Loading
Loading