@agnocon/piece-bolna 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.MIT-AP ADDED
@@ -0,0 +1,24 @@
1
+ MIT License
2
+
3
+ Copyright (c) Activepieces AB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ Derived helpers in this folder are adapted from Activepieces (MIT) for use
24
+ inside CX without depending on @activepieces/* packages at runtime.
@@ -0,0 +1,2 @@
1
+ export declare const bolna: import("@agnocon/pieces-framework").Piece<import("@agnocon/pieces-framework").SecretTextProperty<true>>;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,KAAK,yGAiBhB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bolna = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bolna/src/index.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const auth_1 = require("./lib/common/auth");
9
+ const make_phone_call_1 = require("./lib/actions/make-phone-call");
10
+ const call_completion_report_1 = require("./lib/triggers/call-completion-report");
11
+ const pieces_common_1 = require("@agnocon/pieces-common");
12
+ exports.bolna = (0, pieces_framework_1.createPiece)({
13
+ displayName: 'Bolna AI',
14
+ auth: auth_1.bolnaaiAuth,
15
+ minimumSupportedRelease: '0.36.1',
16
+ logoUrl: 'https://cdn.activepieces.com/pieces/bolna.png',
17
+ authors: ['sanket-a11y'],
18
+ actions: [
19
+ make_phone_call_1.makePhoneCall,
20
+ (0, pieces_common_1.createCustomApiCallAction)({
21
+ auth: auth_1.bolnaaiAuth,
22
+ baseUrl: () => 'https://api.bolna.ai',
23
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
24
+ return ({
25
+ Authorization: `Bearer ${auth.secret_text}`,
26
+ });
27
+ }),
28
+ }),
29
+ ],
30
+ triggers: [call_completion_report_1.callCompletionReport],
31
+ });
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,iFAAiF;AACjF,qEAAqE;AACrE,gEAAmE;AACnE,4CAAgD;AAChD,mEAA8D;AAC9D,kFAA6E;AAC7E,0DAAmE;AAEtD,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,kBAAW;IACjB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,+BAAa;QACb,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,kBAAW;YACjB,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB;YACrC,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,6CAAoB,CAAC;CACjC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const makePhoneCall: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
2
+ agentId: import("@agnocon/pieces-framework").DropdownProperty<unknown, true, import("@agnocon/pieces-framework").SecretTextProperty<true>>;
3
+ recipientPhoneNumber: import("@agnocon/pieces-framework").ShortTextProperty<true>;
4
+ fromPhoneNumber: import("@agnocon/pieces-framework").ShortTextProperty<false>;
5
+ scheduledAt: import("@agnocon/pieces-framework").ShortTextProperty<false>;
6
+ userData: import("@agnocon/pieces-framework").JsonProperty<false>;
7
+ }>;
8
+ //# sourceMappingURL=make-phone-call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-phone-call.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/make-phone-call.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa;;;;;;EA6DxB,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePhoneCall = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bolna/src/lib/actions/make-phone-call.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const auth_1 = require("../common/auth");
9
+ const client_1 = require("../common/client");
10
+ const pieces_common_1 = require("@agnocon/pieces-common");
11
+ const props_1 = require("../common/props");
12
+ exports.makePhoneCall = (0, pieces_framework_1.createAction)({
13
+ auth: auth_1.bolnaaiAuth,
14
+ name: 'makePhoneCall',
15
+ displayName: 'Make Phone Call',
16
+ description: 'Initiate an outbound phone call from a Bolna Voice AI agent to a recipient.',
17
+ audience: 'both',
18
+ aiMetadata: {
19
+ description: 'Place an outbound voice call to a recipient using a Bolna AI agent. Requires an agent ID and a recipient phone number in E.164 format; optionally set a from-number, schedule the call for a future ISO 8601 time (omit to dial immediately), and pass dynamic user variables referenced in the agent prompt. Each call is not idempotent — repeating it places another call.',
20
+ idempotent: false,
21
+ },
22
+ props: {
23
+ agentId: props_1.agentId,
24
+ recipientPhoneNumber: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Recipient Phone Number',
26
+ description: 'Phone number of the recipient with country code (E.164 format, e.g., +10123456789)',
27
+ required: true,
28
+ }),
29
+ fromPhoneNumber: pieces_framework_1.Property.ShortText({
30
+ displayName: 'From Phone Number',
31
+ description: 'Phone number of the sender with country code (E.164 format, e.g., +19876543007). Optional.',
32
+ required: false,
33
+ }),
34
+ scheduledAt: pieces_framework_1.Property.ShortText({
35
+ displayName: 'Scheduled At',
36
+ description: 'The scheduled date and time in ISO 8601 format with time zone (e.g., 2025-08-21T10:35:00Z). Leave empty to call immediately.',
37
+ required: false,
38
+ }),
39
+ userData: pieces_framework_1.Property.Json({
40
+ displayName: 'User Data',
41
+ description: 'Additional user dynamic variables as defined in the agent prompt (JSON object)',
42
+ required: false,
43
+ }),
44
+ },
45
+ run(context) {
46
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ const auth = context.auth.secret_text;
48
+ const payload = {
49
+ agent_id: context.propsValue.agentId,
50
+ recipient_phone_number: context.propsValue.recipientPhoneNumber,
51
+ };
52
+ if (context.propsValue.fromPhoneNumber) {
53
+ payload['from_phone_number'] = context.propsValue.fromPhoneNumber;
54
+ }
55
+ if (context.propsValue.scheduledAt) {
56
+ payload['scheduled_at'] = context.propsValue.scheduledAt;
57
+ }
58
+ if (context.propsValue.userData) {
59
+ payload['user_data'] = context.propsValue.userData;
60
+ }
61
+ const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.POST, '/call', payload);
62
+ return response;
63
+ });
64
+ },
65
+ });
66
+ //# sourceMappingURL=make-phone-call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-phone-call.js","sourceRoot":"","sources":["../../../src/lib/actions/make-phone-call.ts"],"names":[],"mappings":";;;;AAAA,uGAAuG;AACvG,qEAAqE;AACrE,gEAAmE;AACnE,yCAA6C;AAC7C,6CAA+C;AAC/C,0DAAoD;AACpD,2CAA0C;AAE7B,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EACT,6EAA6E;IAC/E,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,+WAA+W;QACjX,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QACL,OAAO,EAAE,eAAO;QAChB,oBAAoB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvC,WAAW,EAAE,wBAAwB;YACrC,WAAW,EACT,oFAAoF;YACtF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAClC,WAAW,EAAE,mBAAmB;YAChC,WAAW,EACT,4FAA4F;YAC9F,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,8HAA8H;YAChI,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACtB,WAAW,EAAE,WAAW;YACxB,WAAW,EACT,gFAAgF;YAClF,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YACtC,MAAM,OAAO,GAA4B;gBACvC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;gBACpC,sBAAsB,EAAE,OAAO,CAAC,UAAU,CAAC,oBAAoB;aAChE,CAAC;YAEF,IAAI,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;gBACvC,OAAO,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC;YACpE,CAAC;YAED,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;gBACnC,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC;YAC3D,CAAC;YAED,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;gBAChC,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;YACrD,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAAC,IAAI,EAAE,0BAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC5E,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const bolnaaiAuth: import("@agnocon/pieces-framework").SecretTextProperty<true>;
2
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,8DA8BtB,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bolnaaiAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bolna/src/lib/common/auth.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_common_1 = require("@agnocon/pieces-common");
8
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
9
+ const client_1 = require("./client");
10
+ exports.bolnaaiAuth = pieces_framework_1.PieceAuth.SecretText({
11
+ displayName: 'Bolna AI API Key',
12
+ description: `
13
+ To get your API Key:
14
+
15
+ 1. Login to the dashboard at https://platform.bolna.ai
16
+ 2. Navigate to Developers tab from the left menu bar after login
17
+ 3. Click the button Generate a new API Key to generate a key
18
+ 4. Get your API Key
19
+ `,
20
+ required: true,
21
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
22
+ if (auth) {
23
+ try {
24
+ yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, '/agent/all');
25
+ return {
26
+ valid: true,
27
+ };
28
+ }
29
+ catch (error) {
30
+ return {
31
+ valid: false,
32
+ error: 'Invalid Api Key',
33
+ };
34
+ }
35
+ }
36
+ return {
37
+ valid: false,
38
+ error: 'Invalid Api Key',
39
+ };
40
+ }),
41
+ });
42
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,2FAA2F;AAC3F,qEAAqE;AACrE,0DAAoD;AACpD,gEAAsD;AACtD,qCAAuC;AAE1B,QAAA,WAAW,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC9C,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE;;;;;;;CAOd;IACC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,IAAA,oBAAW,EAAC,IAAI,EAAE,0BAAU,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;gBACtD,OAAO;oBACL,KAAK,EAAE,IAAI;iBACZ,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,iBAAiB;iBACzB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,iBAAiB;SACzB,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { HttpMethod } from '@agnocon/pieces-common';
2
+ export declare const BASE_URL = " https://api.bolna.ai";
3
+ export declare function makeRequest(api_key: string, method: HttpMethod, path: string, body?: unknown): Promise<any>;
4
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAc,MAAM,wBAAwB,CAAC;AAEhE,eAAO,MAAM,QAAQ,0BAA0B,CAAC;AAEhD,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,gBAgBf"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BASE_URL = void 0;
4
+ exports.makeRequest = makeRequest;
5
+ const tslib_1 = require("tslib");
6
+ // Vendored from Activepieces packages/pieces/community/bolna/src/lib/common/client.ts (MIT).
7
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
8
+ const pieces_common_1 = require("@agnocon/pieces-common");
9
+ exports.BASE_URL = ` https://api.bolna.ai`;
10
+ function makeRequest(api_key, method, path, body) {
11
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ try {
13
+ const response = yield pieces_common_1.httpClient.sendRequest({
14
+ method,
15
+ url: `${exports.BASE_URL}${path}`,
16
+ headers: {
17
+ Authorization: `Bearer ${api_key}`,
18
+ 'Content-Type': 'application/json',
19
+ },
20
+ body,
21
+ });
22
+ return response.body;
23
+ }
24
+ catch (error) {
25
+ throw new Error(`Unexpected error: ${error.message || String(error)}`);
26
+ }
27
+ });
28
+ }
29
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/lib/common/client.ts"],"names":[],"mappings":";;;AAMA,kCAoBC;;AA1BD,6FAA6F;AAC7F,qEAAqE;AACrE,0DAAgE;AAEnD,QAAA,QAAQ,GAAG,uBAAuB,CAAC;AAEhD,SAAsB,WAAW,CAC/B,OAAe,EACf,MAAkB,EAClB,IAAY,EACZ,IAAc;;QAEd,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM;gBACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,IAAI,EAAE;gBACzB,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,EAAE;oBAClC,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const agentId: import("@agnocon/pieces-framework").DropdownProperty<unknown, true, import("@agnocon/pieces-framework").SecretTextProperty<true>>;
2
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/lib/common/props.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,OAAO,mIAkClB,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.agentId = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bolna/src/lib/common/props.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_common_1 = require("@agnocon/pieces-common");
8
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
9
+ const client_1 = require("./client");
10
+ const auth_1 = require("./auth");
11
+ exports.agentId = pieces_framework_1.Property.Dropdown({
12
+ displayName: 'Agent',
13
+ description: 'Select the Bolna Voice AI agent',
14
+ required: true,
15
+ refreshers: [],
16
+ auth: auth_1.bolnaaiAuth,
17
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
18
+ if (!auth) {
19
+ return {
20
+ disabled: true,
21
+ options: [],
22
+ };
23
+ }
24
+ try {
25
+ const response = yield (0, client_1.makeRequest)(auth.secret_text, pieces_common_1.HttpMethod.GET, '/agent/all');
26
+ return {
27
+ disabled: false,
28
+ options: response.map((agent) => ({
29
+ label: agent.agent_name,
30
+ value: agent.id,
31
+ })),
32
+ };
33
+ }
34
+ catch (e) {
35
+ return {
36
+ disabled: true,
37
+ options: [],
38
+ };
39
+ }
40
+ }),
41
+ });
42
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,4FAA4F;AAC5F,qEAAqE;AACrE,0DAAoD;AACpD,gEAAqD;AACrD,qCAAuC;AACvC,iCAAqC;AAExB,QAAA,OAAO,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACvC,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,iCAAiC;IAC9C,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kBAAW;IACjB,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAI,CAAC,WAAW,EAChB,0BAAU,CAAC,GAAG,EACd,YAAY,CACb,CAAC;YAEF,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;oBACrC,KAAK,EAAE,KAAK,CAAC,UAAU;oBACvB,KAAK,EAAE,KAAK,CAAC,EAAE;iBAChB,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const callCompletionReport: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
3
+ markdown: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
4
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
5
+ markdown: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
6
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
7
+ markdown: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
8
+ }> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {
9
+ markdown: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
10
+ }>;
11
+ //# sourceMappingURL=call-completion-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-completion-report.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/call-completion-report.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,oBAAoB;;;;;;;;EAwI/B,CAAC"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.callCompletionReport = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/bolna/src/lib/triggers/call-completion-report.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const auth_1 = require("../common/auth");
9
+ exports.callCompletionReport = (0, pieces_framework_1.createTrigger)({
10
+ auth: auth_1.bolnaaiAuth,
11
+ name: 'callCompletionReport',
12
+ displayName: 'Call Completion Report',
13
+ description: 'Triggers when Bolna call report it is completed',
14
+ aiMetadata: {
15
+ description: 'Fires when a Bolna AI voice call finishes and its execution report is pushed to the configured webhook, emitting only calls with a completed status. Use to act on call outcomes such as transcript, duration, cost, and recording once a conversation has ended. Requires manually configuring the Bolna agent to push execution data to the webhook URL.',
16
+ },
17
+ props: {
18
+ markdown: pieces_framework_1.Property.MarkDown({
19
+ value: `## Bolna AI Webhook Setup
20
+ To use this trigger, you need to manually set up a webhook in your Bolna AI account:
21
+
22
+ 1. Login to your Bolna AI account.
23
+ 2. Navigate to **Agent Setup** tab on the left navigation menu.
24
+ 3. Go to **Analytics** .
25
+ 4. Add to the **Push all execution data to webhook** and specify the following URL:
26
+ \`\`\`text
27
+ {{webhookUrl}}
28
+ \`\`\`
29
+ 5. Click Save Agent.
30
+ `,
31
+ }),
32
+ },
33
+ sampleData: {
34
+ id: '7e8391e5-dd-4d3b-ddd-dfe255c71848',
35
+ agent_id: '5a12b25a-dddd-4e77-90a5-9b4fd4577e44',
36
+ batch_id: null,
37
+ created_at: '2025-11-19T08:48:27.193399',
38
+ updated_at: '2025-11-19T08:49:25.219095',
39
+ scheduled_at: '2025-11-19T08:48:27.193376',
40
+ answered_by_voice_mail: null,
41
+ conversation_duration: 24.2,
42
+ total_cost: 3.54,
43
+ transcript: 'assistant: Hello from Bolna\nuser: hello\nassistant: Hello! Am I speaking with you? Is this a good time to talk? How can I assist you today?\n',
44
+ usage_breakdown: {
45
+ llmModel: { 'azure/gpt-4.1-mini': { input: 1397, output: 23 } },
46
+ llmTokens: 0,
47
+ synthesizer_model: 'eleven_turbo_v2_5',
48
+ transcriber_model: 'nova-3',
49
+ llm_usage_breakdown: {
50
+ hangup: null,
51
+ analytics: null,
52
+ extraction: null,
53
+ conversation: {
54
+ input: 1397,
55
+ model: 'azure/gpt-4.1-mini',
56
+ output: 23,
57
+ provider: 'azure',
58
+ provider_connected: false,
59
+ },
60
+ summarization: null,
61
+ },
62
+ synthesizer_provider: 'elevenlabs',
63
+ transcriber_duration: 0,
64
+ transcriber_provider: 'deepgram',
65
+ synthesizer_characters: 111,
66
+ synthesizer_usage_breakdown: {
67
+ provider_connected: false,
68
+ welcome_message_cache: true,
69
+ conversation_characters: 111,
70
+ welcome_message_characters: 0,
71
+ },
72
+ transcriber_usage_breakdown: {
73
+ provider_connected: false,
74
+ transcriber_duration: 0,
75
+ },
76
+ },
77
+ cost_breakdown: {
78
+ llm: 0.06,
79
+ network: 0.375,
80
+ platform: 2.0,
81
+ synthesizer: 1.11,
82
+ transcriber: 0.0,
83
+ llm_breakdown: {
84
+ hangup: 0,
85
+ analytics: 0,
86
+ extraction: 0,
87
+ conversation: 0.06,
88
+ summarization: 0,
89
+ },
90
+ transfer_cost: 0.0,
91
+ synthesizer_breakdown: { conversation: 1.11, welcome_message: 0 },
92
+ transcriber_breakdown: { analytics: 0, conversation: 0.0 },
93
+ },
94
+ extracted_data: null,
95
+ summary: null,
96
+ error_message: null,
97
+ status: 'completed',
98
+ agent_extraction: null,
99
+ workflow_retries: null,
100
+ rescheduled_at: null,
101
+ custom_extractions: null,
102
+ campaign_id: null,
103
+ smart_status: null,
104
+ user_number: '+9199999999',
105
+ agent_number: '+916565656565',
106
+ telephony_data: {
107
+ duration: '24',
108
+ to_number: '+9199999999',
109
+ from_number: '+916565656565',
110
+ recording_url: 'https://bolna-recordings-india.s3.ap-south-1.amazonaws.com/plivo/e3v16015b-vvvv12ef-42fd-898c-52cevvv62058v8cd.mp3',
111
+ hosted_telephony: true,
112
+ provider_call_id: 'e316c015b-12ef-4c2fd-c898c-52ce620ccc588cd',
113
+ call_type: 'outbound',
114
+ provider: 'plivo',
115
+ hangup_by: 'Callee',
116
+ hangup_reason: 'Call recipient hungup',
117
+ hangup_provider_code: 4000,
118
+ },
119
+ transfer_call_data: null,
120
+ context_details: {
121
+ recipient_data: null,
122
+ recipient_phone_number: '+9199999990',
123
+ },
124
+ batch_run_details: null,
125
+ provider: 'plivo',
126
+ },
127
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
128
+ onEnable(context) {
129
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
130
+ // implement webhook creation logic
131
+ });
132
+ },
133
+ onDisable(context) {
134
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
135
+ // implement webhook deletion logic
136
+ });
137
+ },
138
+ run(context) {
139
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
140
+ const payload = context.payload.body;
141
+ if (payload.status != 'completed') {
142
+ return [];
143
+ }
144
+ return [context.payload.body];
145
+ });
146
+ },
147
+ });
148
+ //# sourceMappingURL=call-completion-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-completion-report.js","sourceRoot":"","sources":["../../../src/lib/triggers/call-completion-report.ts"],"names":[],"mappings":"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"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@agnocon/piece-bolna",
3
+ "version": "0.1.7",
4
+ "description": "AgnoCon bolna connector",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "require": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "src",
17
+ "LICENSE.MIT-AP"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "vendor": "node ../scripts/vendor-ap.mjs piece-bolna"
22
+ },
23
+ "dependencies": {
24
+ "@agnocon/core-utils": "0.2.0",
25
+ "@agnocon/piece-types": "0.3.1",
26
+ "@agnocon/pieces-common": "0.12.8",
27
+ "@agnocon/pieces-framework": "0.36.0",
28
+ "tslib": "2.6.2"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "20.17.6",
32
+ "typescript": "5.5.4"
33
+ },
34
+ "license": "MIT",
35
+ "agnocon": {
36
+ "originVersion": "0.1.7"
37
+ },
38
+ "publishConfig": {
39
+ "access": "restricted",
40
+ "tag": "latest"
41
+ },
42
+ "keywords": [
43
+ "agnocon",
44
+ "connector"
45
+ ]
46
+ }
package/src/index.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { createPiece, PieceAuth } from '@agnocon/pieces-framework';
2
+ import { bolnaaiAuth } from './lib/common/auth';
3
+ import { makePhoneCall } from './lib/actions/make-phone-call';
4
+ import { callCompletionReport } from './lib/triggers/call-completion-report';
5
+ import { createCustomApiCallAction } from '@agnocon/pieces-common';
6
+
7
+ export const bolna = createPiece({
8
+ displayName: 'Bolna AI',
9
+ auth: bolnaaiAuth,
10
+ minimumSupportedRelease: '0.36.1',
11
+ logoUrl: 'https://cdn.activepieces.com/pieces/bolna.png',
12
+ authors: ['sanket-a11y'],
13
+ actions: [
14
+ makePhoneCall,
15
+ createCustomApiCallAction({
16
+ auth: bolnaaiAuth,
17
+ baseUrl: () => 'https://api.bolna.ai',
18
+ authMapping: async (auth) => ({
19
+ Authorization: `Bearer ${auth.secret_text}`,
20
+ }),
21
+ }),
22
+ ],
23
+ triggers: [callCompletionReport],
24
+ });
@@ -0,0 +1,68 @@
1
+ import { createAction, Property } from '@agnocon/pieces-framework';
2
+ import { bolnaaiAuth } from '../common/auth';
3
+ import { makeRequest } from '../common/client';
4
+ import { HttpMethod } from '@agnocon/pieces-common';
5
+ import { agentId } from '../common/props';
6
+
7
+ export const makePhoneCall = createAction({
8
+ auth: bolnaaiAuth,
9
+ name: 'makePhoneCall',
10
+ displayName: 'Make Phone Call',
11
+ description:
12
+ 'Initiate an outbound phone call from a Bolna Voice AI agent to a recipient.',
13
+ audience: 'both',
14
+ aiMetadata: {
15
+ description:
16
+ 'Place an outbound voice call to a recipient using a Bolna AI agent. Requires an agent ID and a recipient phone number in E.164 format; optionally set a from-number, schedule the call for a future ISO 8601 time (omit to dial immediately), and pass dynamic user variables referenced in the agent prompt. Each call is not idempotent — repeating it places another call.',
17
+ idempotent: false,
18
+ },
19
+ props: {
20
+ agentId: agentId,
21
+ recipientPhoneNumber: Property.ShortText({
22
+ displayName: 'Recipient Phone Number',
23
+ description:
24
+ 'Phone number of the recipient with country code (E.164 format, e.g., +10123456789)',
25
+ required: true,
26
+ }),
27
+ fromPhoneNumber: Property.ShortText({
28
+ displayName: 'From Phone Number',
29
+ description:
30
+ 'Phone number of the sender with country code (E.164 format, e.g., +19876543007). Optional.',
31
+ required: false,
32
+ }),
33
+ scheduledAt: Property.ShortText({
34
+ displayName: 'Scheduled At',
35
+ description:
36
+ 'The scheduled date and time in ISO 8601 format with time zone (e.g., 2025-08-21T10:35:00Z). Leave empty to call immediately.',
37
+ required: false,
38
+ }),
39
+ userData: Property.Json({
40
+ displayName: 'User Data',
41
+ description:
42
+ 'Additional user dynamic variables as defined in the agent prompt (JSON object)',
43
+ required: false,
44
+ }),
45
+ },
46
+ async run(context) {
47
+ const auth = context.auth.secret_text;
48
+ const payload: Record<string, unknown> = {
49
+ agent_id: context.propsValue.agentId,
50
+ recipient_phone_number: context.propsValue.recipientPhoneNumber,
51
+ };
52
+
53
+ if (context.propsValue.fromPhoneNumber) {
54
+ payload['from_phone_number'] = context.propsValue.fromPhoneNumber;
55
+ }
56
+
57
+ if (context.propsValue.scheduledAt) {
58
+ payload['scheduled_at'] = context.propsValue.scheduledAt;
59
+ }
60
+
61
+ if (context.propsValue.userData) {
62
+ payload['user_data'] = context.propsValue.userData;
63
+ }
64
+
65
+ const response = await makeRequest(auth, HttpMethod.POST, '/call', payload);
66
+ return response;
67
+ },
68
+ });
@@ -0,0 +1,35 @@
1
+ import { HttpMethod } from '@agnocon/pieces-common';
2
+ import { PieceAuth } from '@agnocon/pieces-framework';
3
+ import { makeRequest } from './client';
4
+
5
+ export const bolnaaiAuth = PieceAuth.SecretText({
6
+ displayName: 'Bolna AI API Key',
7
+ description: `
8
+ To get your API Key:
9
+
10
+ 1. Login to the dashboard at https://platform.bolna.ai
11
+ 2. Navigate to Developers tab from the left menu bar after login
12
+ 3. Click the button Generate a new API Key to generate a key
13
+ 4. Get your API Key
14
+ `,
15
+ required: true,
16
+ validate: async ({ auth }) => {
17
+ if (auth) {
18
+ try {
19
+ await makeRequest(auth, HttpMethod.GET, '/agent/all');
20
+ return {
21
+ valid: true,
22
+ };
23
+ } catch (error) {
24
+ return {
25
+ valid: false,
26
+ error: 'Invalid Api Key',
27
+ };
28
+ }
29
+ }
30
+ return {
31
+ valid: false,
32
+ error: 'Invalid Api Key',
33
+ };
34
+ },
35
+ });
@@ -0,0 +1,25 @@
1
+ import { HttpMethod, httpClient } from '@agnocon/pieces-common';
2
+
3
+ export const BASE_URL = ` https://api.bolna.ai`;
4
+
5
+ export async function makeRequest(
6
+ api_key: string,
7
+ method: HttpMethod,
8
+ path: string,
9
+ body?: unknown
10
+ ) {
11
+ try {
12
+ const response = await httpClient.sendRequest({
13
+ method,
14
+ url: `${BASE_URL}${path}`,
15
+ headers: {
16
+ Authorization: `Bearer ${api_key}`,
17
+ 'Content-Type': 'application/json',
18
+ },
19
+ body,
20
+ });
21
+ return response.body;
22
+ } catch (error: any) {
23
+ throw new Error(`Unexpected error: ${error.message || String(error)}`);
24
+ }
25
+ }
@@ -0,0 +1,40 @@
1
+ import { HttpMethod } from '@agnocon/pieces-common';
2
+ import { Property } from '@agnocon/pieces-framework';
3
+ import { makeRequest } from './client';
4
+ import { bolnaaiAuth } from './auth';
5
+
6
+ export const agentId = Property.Dropdown({
7
+ displayName: 'Agent',
8
+ description: 'Select the Bolna Voice AI agent',
9
+ required: true,
10
+ refreshers: [],
11
+ auth: bolnaaiAuth,
12
+ options: async ({ auth }) => {
13
+ if (!auth) {
14
+ return {
15
+ disabled: true,
16
+ options: [],
17
+ };
18
+ }
19
+ try {
20
+ const response = await makeRequest(
21
+ auth.secret_text,
22
+ HttpMethod.GET,
23
+ '/agent/all'
24
+ );
25
+
26
+ return {
27
+ disabled: false,
28
+ options: response.map((agent: any) => ({
29
+ label: agent.agent_name,
30
+ value: agent.id,
31
+ })),
32
+ };
33
+ } catch (e) {
34
+ return {
35
+ disabled: true,
36
+ options: [],
37
+ };
38
+ }
39
+ },
40
+ });
@@ -0,0 +1,143 @@
1
+ import {
2
+ createTrigger,
3
+ Property,
4
+ TriggerStrategy,
5
+ } from '@agnocon/pieces-framework';
6
+ import { bolnaaiAuth } from '../common/auth';
7
+ export const callCompletionReport = createTrigger({
8
+ auth: bolnaaiAuth,
9
+ name: 'callCompletionReport',
10
+ displayName: 'Call Completion Report',
11
+ description: 'Triggers when Bolna call report it is completed',
12
+ aiMetadata: {
13
+ description:
14
+ 'Fires when a Bolna AI voice call finishes and its execution report is pushed to the configured webhook, emitting only calls with a completed status. Use to act on call outcomes such as transcript, duration, cost, and recording once a conversation has ended. Requires manually configuring the Bolna agent to push execution data to the webhook URL.',
15
+ },
16
+ props: {
17
+ markdown: Property.MarkDown({
18
+ value: `## Bolna AI Webhook Setup
19
+ To use this trigger, you need to manually set up a webhook in your Bolna AI account:
20
+
21
+ 1. Login to your Bolna AI account.
22
+ 2. Navigate to **Agent Setup** tab on the left navigation menu.
23
+ 3. Go to **Analytics** .
24
+ 4. Add to the **Push all execution data to webhook** and specify the following URL:
25
+ \`\`\`text
26
+ {{webhookUrl}}
27
+ \`\`\`
28
+ 5. Click Save Agent.
29
+ `,
30
+ }),
31
+ },
32
+ sampleData: {
33
+ id: '7e8391e5-dd-4d3b-ddd-dfe255c71848',
34
+ agent_id: '5a12b25a-dddd-4e77-90a5-9b4fd4577e44',
35
+ batch_id: null,
36
+ created_at: '2025-11-19T08:48:27.193399',
37
+ updated_at: '2025-11-19T08:49:25.219095',
38
+ scheduled_at: '2025-11-19T08:48:27.193376',
39
+ answered_by_voice_mail: null,
40
+ conversation_duration: 24.2,
41
+ total_cost: 3.54,
42
+ transcript:
43
+ 'assistant: Hello from Bolna\nuser: hello\nassistant: Hello! Am I speaking with you? Is this a good time to talk? How can I assist you today?\n',
44
+ usage_breakdown: {
45
+ llmModel: { 'azure/gpt-4.1-mini': { input: 1397, output: 23 } },
46
+ llmTokens: 0,
47
+ synthesizer_model: 'eleven_turbo_v2_5',
48
+ transcriber_model: 'nova-3',
49
+ llm_usage_breakdown: {
50
+ hangup: null,
51
+ analytics: null,
52
+ extraction: null,
53
+ conversation: {
54
+ input: 1397,
55
+ model: 'azure/gpt-4.1-mini',
56
+ output: 23,
57
+ provider: 'azure',
58
+ provider_connected: false,
59
+ },
60
+ summarization: null,
61
+ },
62
+ synthesizer_provider: 'elevenlabs',
63
+ transcriber_duration: 0,
64
+ transcriber_provider: 'deepgram',
65
+ synthesizer_characters: 111,
66
+ synthesizer_usage_breakdown: {
67
+ provider_connected: false,
68
+ welcome_message_cache: true,
69
+ conversation_characters: 111,
70
+ welcome_message_characters: 0,
71
+ },
72
+ transcriber_usage_breakdown: {
73
+ provider_connected: false,
74
+ transcriber_duration: 0,
75
+ },
76
+ },
77
+ cost_breakdown: {
78
+ llm: 0.06,
79
+ network: 0.375,
80
+ platform: 2.0,
81
+ synthesizer: 1.11,
82
+ transcriber: 0.0,
83
+ llm_breakdown: {
84
+ hangup: 0,
85
+ analytics: 0,
86
+ extraction: 0,
87
+ conversation: 0.06,
88
+ summarization: 0,
89
+ },
90
+ transfer_cost: 0.0,
91
+ synthesizer_breakdown: { conversation: 1.11, welcome_message: 0 },
92
+ transcriber_breakdown: { analytics: 0, conversation: 0.0 },
93
+ },
94
+ extracted_data: null,
95
+ summary: null,
96
+ error_message: null,
97
+ status: 'completed',
98
+ agent_extraction: null,
99
+ workflow_retries: null,
100
+ rescheduled_at: null,
101
+ custom_extractions: null,
102
+ campaign_id: null,
103
+ smart_status: null,
104
+ user_number: '+9199999999',
105
+ agent_number: '+916565656565',
106
+ telephony_data: {
107
+ duration: '24',
108
+ to_number: '+9199999999',
109
+ from_number: '+916565656565',
110
+ recording_url:
111
+ 'https://bolna-recordings-india.s3.ap-south-1.amazonaws.com/plivo/e3v16015b-vvvv12ef-42fd-898c-52cevvv62058v8cd.mp3',
112
+ hosted_telephony: true,
113
+ provider_call_id: 'e316c015b-12ef-4c2fd-c898c-52ce620ccc588cd',
114
+ call_type: 'outbound',
115
+ provider: 'plivo',
116
+ hangup_by: 'Callee',
117
+ hangup_reason: 'Call recipient hungup',
118
+ hangup_provider_code: 4000,
119
+ },
120
+ transfer_call_data: null,
121
+ context_details: {
122
+ recipient_data: null,
123
+ recipient_phone_number: '+9199999990',
124
+ },
125
+ batch_run_details: null,
126
+ provider: 'plivo',
127
+ },
128
+ type: TriggerStrategy.WEBHOOK,
129
+ async onEnable(context) {
130
+ // implement webhook creation logic
131
+ },
132
+ async onDisable(context) {
133
+ // implement webhook deletion logic
134
+ },
135
+ async run(context) {
136
+ const payload = context.payload.body as any;
137
+
138
+ if (payload.status != 'completed') {
139
+ return [];
140
+ }
141
+ return [context.payload.body];
142
+ },
143
+ });