Skip to content

The open alternative to Salesforce, designed for AI.

Declare call recorder billing: usage label and marketplace pricing (#26173)

nitin126e3a88f3a2
diff --git a/packages/twenty-apps/public/call-recorder/src/__tests__/application-config.test.ts b/packages/twenty-apps/public/call-recorder/src/__tests__/application-config.test.ts
index 2c69adfd354..be2afd6e974 100644
--- a/packages/twenty-apps/public/call-recorder/src/__tests__/application-config.test.ts
+++ b/packages/twenty-apps/public/call-recorder/src/__tests__/application-config.test.ts
@@ -6,6 +6,10 @@ import { CALL_RECORDER_TRANSCRIPT_PROVIDER_ENV_VAR_NAME } from 'src/logic-functi
import { RECALL_ASYNC_TRANSCRIPT_PROVIDERS } from 'src/logic-functions/constants/recall-async-transcript-providers';
describe('application config', () => {
+ it('passes the SDK manifest validation', () => {
+ expect(applicationConfig.errors).toEqual([]);
+ });
+
it('lays out every application variable in the settings component', () => {
expect([...CALL_RECORDER_MAPPED_VARIABLE_KEYS].sort()).toEqual(
Object.keys(applicationConfig.config.applicationVariables ?? {}).sort(),
diff --git a/packages/twenty-apps/public/call-recorder/src/application-config.ts b/packages/twenty-apps/public/call-recorder/src/application-config.ts
index 4eec5f2dcaa..60d4d842a74 100644
--- a/packages/twenty-apps/public/call-recorder/src/application-config.ts
+++ b/packages/twenty-apps/public/call-recorder/src/application-config.ts
@@ -2,6 +2,7 @@ import { defineApplication, FieldType } from 'twenty-sdk/define';
import { APP_DESCRIPTION } from 'src/constants/app-description';
import { APP_DISPLAY_NAME } from 'src/constants/app-display-name';
+import { CALL_RECORDING_BILLABLE_OPERATION_NAME } from 'src/constants/call-recording-billable-operation-name';
import { CALL_RECORDER_TRANSCRIPT_PROVIDER_OPTIONS } from 'src/constants/call-recorder-transcript-provider-options';
import {
APPLICATION_UNIVERSAL_IDENTIFIER,
@@ -60,6 +61,16 @@ export default defineApplication({
category: 'Productivity',
author: 'Twenty',
galleryImages: ['public/gallery/call-recorder-cover.png'],
+ billing: {
+ description:
+ '$1.00 per recorded hour, prorated by duration. Billed to your Twenty credits.',
+ operations: {
+ [CALL_RECORDING_BILLABLE_OPERATION_NAME]: {
+ operationType: 'CALL_RECORDING',
+ label: 'Call recording',
+ },
+ },
+ },
applicationVariables: {
[CALL_RECORDER_CALENDAR_BOT_SCHEDULING_ENABLED_ENV_VAR_NAME]: {
universalIdentifier:
diff --git a/packages/twenty-apps/public/call-recorder/src/constants/call-recording-billable-operation-name.ts b/packages/twenty-apps/public/call-recorder/src/constants/call-recording-billable-operation-name.ts
new file mode 100644
index 00000000000..787fe4ed799
--- /dev/null
+++ b/packages/twenty-apps/public/call-recorder/src/constants/call-recording-billable-operation-name.ts
@@ -0,0 +1,2 @@
+// A charge naming an operation the manifest does not declare is rejected, and chargeCredits swallows the rejection.
+export const CALL_RECORDING_BILLABLE_OPERATION_NAME = 'recordCall';
diff --git a/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/__tests__/charge-completed-call-recording.test.ts b/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/__tests__/charge-completed-call-recording.test.ts
index f1e9077ed87..b41414f4fb0 100644
--- a/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/__tests__/charge-completed-call-recording.test.ts
+++ b/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/__tests__/charge-completed-call-recording.test.ts
@@ -1,5 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
+import applicationConfig from 'src/application-config';
import { chargeCompletedCallRecording } from 'src/logic-functions/flows/charge-completed-call-recording.util';
const chargeCreditsMock = vi.hoisted(() => vi.fn());
@@ -23,10 +24,26 @@ describe('chargeCompletedCallRecording', () => {
});
expect(chargeCreditsMock).toHaveBeenCalledWith({
+ operation: 'recordCall',
creditsUsedMicro: 500_000,
quantity: 30,
+ });
+ });
+
+ it('charges an operation the application declares as call recording', async () => {
+ await chargeCompletedCallRecording({
+ callRecordingId: 'call-recording-1',
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T09:30:00.000Z',
+ });
+
+ expect(chargeCreditsMock).toHaveBeenCalledTimes(1);
+
+ const [{ operation }] = chargeCreditsMock.mock.calls[0];
+
+ expect(applicationConfig.config.billing?.operations?.[operation]).toEqual({
operationType: 'CALL_RECORDING',
- resourceContext: 'recall',
+ label: 'Call recording',
});
});
diff --git a/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts b/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts
index 32529c07bd9..46802a9b927 100644
--- a/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts
+++ b/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts
@@ -44,10 +44,9 @@ describe('completeAndChargeCallRecording', () => {
});
expect(chargeCreditsMock).toHaveBeenCalledTimes(1);
expect(chargeCreditsMock).toHaveBeenCalledWith({
+ operation: 'recordCall',
creditsUsedMicro: 1_000_000,
quantity: 60,
- operationType: 'CALL_RECORDING',
- resourceContext: 'recall',
});
});
diff --git a/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/charge-completed-call-recording.util.ts b/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/charge-completed-call-recording.util.ts
index b24020db272..fadd875dc90 100644
--- a/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/charge-completed-call-recording.util.ts
+++ b/packages/twenty-apps/public/call-recorder/src/logic-functions/flows/charge-completed-call-recording.util.ts
@@ -1,6 +1,7 @@
import { isUndefined } from '@sniptt/guards';
import { chargeCredits } from 'twenty-sdk/billing';
+import { CALL_RECORDING_BILLABLE_OPERATION_NAME } from 'src/constants/call-recording-billable-operation-name';
import { computeCallRecordingCharge } from 'src/logic-functions/domain/compute-call-recording-charge.util';
export const chargeCompletedCallRecording = async ({
@@ -23,9 +24,8 @@ export const chargeCompletedCallRecording = async ({
}
await chargeCredits({
+ operation: CALL_RECORDING_BILLABLE_OPERATION_NAME,
creditsUsedMicro: charge.creditsUsedMicro,
quantity: charge.quantityMinutes,
- operationType: 'CALL_RECORDING',
- resourceContext: 'recall',
});
};