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
14 changes: 13 additions & 1 deletion bun.lock

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

2 changes: 1 addition & 1 deletion packages/pieces/community/baserow/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-baserow",
"version": "0.9.0",
"version": "0.9.1",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
Expand Down
242 changes: 138 additions & 104 deletions packages/pieces/community/baserow/src/i18n/fr.json

Large diffs are not rendered by default.

201 changes: 115 additions & 86 deletions packages/pieces/community/baserow/src/i18n/translation.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/pieces/community/baserow/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ export const baserow = createPiece({
authors: ["kishanprmr", "MoShizzle", "abuaboud", 'bst1n', 'sanket-a11y', 'onyedikachi-david'],
actions: [
createRowAction,
deleteRowAction,
getRowAction,
listRowsAction,
updateRowAction,
findRowAction,
updateRowAction,
upsertRowAction,
deleteRowAction,
cleanRowAction,
aggregateFieldAction,
batchCreateRowsAction,
batchUpdateRowsAction,
batchDeleteRowsAction,
upsertRowAction,
aggregateFieldAction,
uploadFileAction,
createCustomApiCallAction({
baseUrl: (auth) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const rowEventTrigger = createTrigger({
auth: baserowAuth,
displayName: 'Any Row Change',
description:
'Triggers when a row is created, updated, or deleted in a Baserow table. To react to only one event type, use the dedicated Row Created, Row Updated, or Row Deleted triggers.',
'Triggers when a row is created, updated, or deleted in a Baserow table. To react to only one event type, use the dedicated New Row, Updated Row, or Deleted Row triggers.',
type: TriggerStrategy.WEBHOOK,
props: {
table_id: baserowCommon.tableId(),
Expand Down
7 changes: 7 additions & 0 deletions packages/pieces/community/connectuc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pieces-connectuc

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build pieces-connectuc` to build the library.
16 changes: 16 additions & 0 deletions packages/pieces/community/connectuc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@activepieces/piece-connectuc",
"version": "0.0.2",
"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"
}
}
66 changes: 66 additions & 0 deletions packages/pieces/community/connectuc/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "pieces-connectuc",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/pieces/community/connectuc/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/connectuc",
"tsConfig": "packages/pieces/community/connectuc/tsconfig.lib.json",
"packageJson": "packages/pieces/community/connectuc/package.json",
"main": "packages/pieces/community/connectuc/src/index.ts",
"assets": [
"packages/pieces/community/connectuc/*.md",
{
"input": "packages/pieces/community/connectuc/src/i18n",
"output": "./src/i18n",
"glob": "**/!(i18n.json)"
}
],
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true,
"clean": false
},
"dependsOn": [
"prebuild",
"^build"
]
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
}
},
"prebuild": {
"dependsOn": [
"^build"
],
"executor": "nx:run-commands",
"options": {
"cwd": "packages/pieces/community/connectuc",
"command": "bun install --no-save --silent"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
]
}
}
}
67 changes: 67 additions & 0 deletions packages/pieces/community/connectuc/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { createPiece, PieceAuth, OAuth2PropertyValue } from "@activepieces/pieces-framework";
import { httpClient, HttpMethod, AuthenticationType } from "@activepieces/pieces-common";
import { newRecording } from "./lib/triggers/new-recording";
import { newCallTranscription } from "./lib/triggers/new-call-transcription";
import { newCallSummary } from "./lib/triggers/new-call-summary";
import { newCdr } from "./lib/triggers/new-cdr";
import { newIncomingCall } from "./lib/triggers/new-incoming-call";
import { newOutgoingCall } from "./lib/triggers/new-outgoing-call";
import { newVoicemail } from "./lib/triggers/new-voicemail";
import { newSms } from "./lib/triggers/new-sms";
import { createContactAction } from "./lib/actions/create-contact";
import { doNotDisturbAction } from "./lib/actions/do-not-disturb";
import { findCdrAction } from "./lib/actions/find-cdr";
import { initiateCallAction } from "./lib/actions/initiate-call";
import { sendSmsAction } from "./lib/actions/send-sms";
import { updateCdrAction } from "./lib/actions/update-cdr";

export const connectucAuth = PieceAuth.OAuth2({
authUrl: "https://auth.uc-technologies.com/oauth2/authorize",
tokenUrl: "https://auth.uc-technologies.com/oauth2/token",
required: true,
scope: ['offline_access'],
validate: async ({ auth }) => {
try {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: "https://auth.uc-technologies.com/oauth2/userinfo",
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: (auth as OAuth2PropertyValue).access_token,
},
});

if (response.status === 200) {
return { valid: true };
}

return {
valid: false,
error: "Failed to validate ConnectUC credentials"
};
} catch (error: unknown) {
const err = error as { response?: { status?: number }; message?: string };
if (err.response?.status === 401) {
return {
valid: false,
error: "Invalid or expired access token. Please reconnect your ConnectUC account."
};
}

return {
valid: false,
error: `Connection validation failed: ${err.message ?? "Unknown error occurred"}`
};
}
},
});

export const connectuc = createPiece({
displayName: "ConnectUC",
auth: connectucAuth,
minimumSupportedRelease: '0.36.1',
logoUrl: "https://cdn.activepieces.com/pieces/connectuc.png",
authors: ['dranes'],
actions: [createContactAction, doNotDisturbAction, findCdrAction, initiateCallAction, sendSmsAction, updateCdrAction],
triggers: [newRecording, newCallTranscription, newCallSummary, newCdr, newIncomingCall, newOutgoingCall, newVoicemail, newSms],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { connectucAuth } from '../../index';
import { connectucApiCall } from '../common/api-helpers';
import { domainProp, subscriberUuidProp } from '../common/props';
import { HttpMethod } from '@activepieces/pieces-common';

export const createContactAction = createAction({
auth: connectucAuth,
name: 'create-contact',
displayName: 'Create Contact',
description: 'Create a new contact in ConnectUC',
props: {
domain: domainProp(),
user: subscriberUuidProp(),
first_name: Property.ShortText({
displayName: 'First Name',
description: 'The first name of the contact',
required: true,
}),
last_name: Property.ShortText({
displayName: 'Last Name',
description: 'The last name of the contact',
required: true,
}),
email: Property.ShortText({
displayName: 'Email',
description: 'The email address of the contact',
required: false,
}),
phones: Property.Array({
displayName: 'Phones',
description: 'The phone numbers of the contact',
required: true,
}),
company: Property.ShortText({
displayName: 'Company',
description: 'The company of the contact',
required: false,
}),
tags: Property.Array({
displayName: 'Tags',
description: 'The tags of the contact',
required: false,
}),
},
async run(context) {
const { user, first_name, last_name, email, phones, company, tags } = context.propsValue;

const tels = phones.map((phone) => ({ number: String(phone), type: 'work' }));
const formattedTags = tags ? tags.map((tag) => ({ name: String(tag) })) : [];

const body: Record<string, unknown> = {
first_name: first_name,
last_name: last_name,
emails: email ? [{ value: email, type: 'work' }] : [],
tels: tels,
company: company || '',
tags: formattedTags,
};

try {
const response = await connectucApiCall({
accessToken: context.auth.access_token,
endpoint: `/users/${user}/contacts`,
method: HttpMethod.POST,
body,
});

return response;
} catch (error: unknown) {
const message = error instanceof Error ? error.message : 'Unknown error occurred';
throw new Error(`Failed to create contact: ${message}`);
}
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { connectucAuth } from '../../index';
import { connectucApiCall } from '../common/api-helpers';
import { domainProp, subscriberUuidProp } from '../common/props';
import { HttpMethod } from '@activepieces/pieces-common';

export const doNotDisturbAction = createAction({
auth: connectucAuth,
name: 'do-not-disturb',
displayName: 'Set Do Not Disturb',
description: 'Enable or disable Do Not Disturb status for a user in ConnectUC',
props: {
domain: domainProp(),
user: subscriberUuidProp(),
dnd: Property.Checkbox({
displayName: 'Do Not Disturb',
description: 'Enable or disable Do Not Disturb status',
required: true,
}),
},
async run(context) {
const { user, dnd } = context.propsValue;

const body: Record<string, unknown> = {
dnd: dnd,
};

try {
const response = await connectucApiCall({
accessToken: context.auth.access_token,
endpoint: `/users/${user}/dnd/update`,
method: HttpMethod.POST,
body,
});

return response;
} catch (error: unknown) {
const message = error instanceof Error ? error.message : 'Unknown error occurred';
throw new Error(`Failed to set Do Not Disturb status: ${message}`);
}
},
});
36 changes: 36 additions & 0 deletions packages/pieces/community/connectuc/src/lib/actions/find-cdr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { connectucAuth } from '../../index';
import { connectucApiCall, getUserId } from '../common/api-helpers';
import { HttpMethod } from '@activepieces/pieces-common';

export const findCdrAction = createAction({
auth: connectucAuth,
name: 'find-cdr',
displayName: 'Find CDR',
description: 'Find a Call Detail Record (CDR) by original call ID',
props: {
origCallid: Property.ShortText({
displayName: 'Original Call ID',
description: 'The original call ID (origCallid) to search for',
required: true,
}),
},
async run(context) {
const { origCallid } = context.propsValue;

try {
const userId = await getUserId(context.auth.access_token);

const response = await connectucApiCall({
accessToken: context.auth.access_token,
endpoint: `/users/${userId}/cdrs/${origCallid}`,
method: HttpMethod.GET,
});

return response;
} catch (error: unknown) {
const message = error instanceof Error ? error.message : 'Unknown error occurred';
throw new Error(`Failed to find CDR: ${message}`);
}
},
});
Loading
Loading