@agnocon/piece-cal-com 0.4.8

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,3 @@
1
+ export declare const calcomAuth: import("@agnocon/pieces-framework").SecretTextProperty<true>;
2
+ export declare const calcom: import("@agnocon/pieces-framework").Piece<import("@agnocon/pieces-framework").SecretTextProperty<true>>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU,8DAIrB,CAAC;AAEH,eAAO,MAAM,MAAM,yGAUjB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calcom = exports.calcomAuth = void 0;
4
+ // Vendored from Activepieces packages/pieces/community/cal-com/src/index.ts (MIT).
5
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
6
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
7
+ const pieces_framework_2 = require("@agnocon/pieces-framework");
8
+ const triggers_1 = require("./lib/triggers");
9
+ exports.calcomAuth = pieces_framework_1.PieceAuth.SecretText({
10
+ displayName: 'API Key',
11
+ description: 'API Key provided by cal.com',
12
+ required: true,
13
+ });
14
+ exports.calcom = (0, pieces_framework_1.createPiece)({
15
+ displayName: 'Cal.com',
16
+ description: 'Open-source alternative to Calendly',
17
+ minimumSupportedRelease: '0.30.0',
18
+ logoUrl: 'https://cdn.activepieces.com/pieces/cal.com.png',
19
+ categories: [pieces_framework_2.PieceCategory.PRODUCTIVITY],
20
+ authors: ["kishanprmr", "AbdulTheActivePiecer", "khaledmashaly", "abuaboud"],
21
+ auth: exports.calcomAuth,
22
+ actions: [],
23
+ triggers: triggers_1.triggers,
24
+ });
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,qEAAqE;AACrE,gEAAmE;AACnE,gEAA0D;AAC1D,6CAA0C;AAE7B,QAAA,UAAU,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,6BAA6B;IAC1C,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,qCAAqC;IAClD,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,UAAU,EAAE,CAAC,gCAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,YAAY,EAAC,sBAAsB,EAAC,eAAe,EAAC,UAAU,CAAC;IACzE,IAAI,EAAE,kBAAU;IAChB,OAAO,EAAE,EAAE;IACX,QAAQ,EAAR,mBAAQ;CACT,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const enum EventTrigger {
2
+ BOOKING_CREATED = "BOOKING_CREATED",
3
+ BOOKING_RESCHEDULED = "BOOKING_RESCHEDULED",
4
+ BOOKING_CANCELLED = "BOOKING_CANCELLED"
5
+ }
6
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/lib/common.ts"],"names":[],"mappings":"AAEA,0BAAkB,YAAY;IAC5B,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;CACxC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/lib/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare const triggers: (import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.POLLING, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<import("@agnocon/piece-types").TriggerStrategy.APP_WEBHOOK, 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/lib/triggers/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,0qBAkMpB,CAAC"}
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggers = void 0;
4
+ const register_webhook_1 = require("./register-webhook");
5
+ exports.triggers = [
6
+ {
7
+ type: "BOOKING_CANCELLED" /* EventTrigger.BOOKING_CANCELLED */,
8
+ displayName: 'Booking Cancelled',
9
+ sampleData: {
10
+ triggerEvent: 'BOOKING_CANCELLED',
11
+ createdAt: '2023-02-18T12:11:37.975Z',
12
+ payload: {
13
+ title: '30 Min Meeting between Mohammad Abu Aboud and John Doe',
14
+ type: '30 Min Meeting',
15
+ description: 'Discuss pricing',
16
+ customInputs: {},
17
+ startTime: '2023-02-21T11:00:00+00:00',
18
+ endTime: '2023-02-21T11:30:00+00:00',
19
+ organizer: {
20
+ email: 'mo@activepieces.com',
21
+ name: 'Mohammad Abu Aboud',
22
+ timeZone: 'Europe/Berlin',
23
+ language: {
24
+ locale: 'en',
25
+ },
26
+ },
27
+ attendees: [
28
+ {
29
+ name: 'John Doe',
30
+ email: 'john@example.com',
31
+ timeZone: 'Europe/Berlin',
32
+ language: {
33
+ locale: 'en',
34
+ },
35
+ },
36
+ ],
37
+ uid: '88wXJjC8AHAbepGYM2bwp4',
38
+ location: 'integrations:daily',
39
+ destinationCalendar: null,
40
+ cancellationReason: 'Cancellation note',
41
+ eventTitle: '30 Min Meeting',
42
+ eventDescription: null,
43
+ requiresConfirmation: null,
44
+ price: null,
45
+ currency: 'usd',
46
+ length: 30,
47
+ status: 'CANCELLED',
48
+ },
49
+ },
50
+ },
51
+ {
52
+ type: "BOOKING_CREATED" /* EventTrigger.BOOKING_CREATED */,
53
+ displayName: 'Booking Created',
54
+ sampleData: {
55
+ triggerEvent: 'BOOKING_CREATED',
56
+ createdAt: '2023-02-18T11:54:18.440Z',
57
+ payload: {
58
+ type: '15 Min Meeting',
59
+ title: '15 Min Meeting between Ash Sam and John Doe',
60
+ description: '',
61
+ additionalNotes: '',
62
+ customInputs: {},
63
+ startTime: '2023-02-20T08:00:00Z',
64
+ endTime: '2023-02-20T08:15:00Z',
65
+ organizer: {
66
+ id: 63498,
67
+ name: 'Ash Sam',
68
+ email: 'ash@sam.com',
69
+ timeZone: 'Europe/Berlin',
70
+ language: {
71
+ locale: 'en',
72
+ },
73
+ },
74
+ attendees: [
75
+ {
76
+ email: 'johndoe@gmail.com',
77
+ name: 'John Doe',
78
+ timeZone: 'Europe/Berlin',
79
+ language: {
80
+ locale: 'en',
81
+ },
82
+ },
83
+ ],
84
+ location: 'integrations:daily',
85
+ destinationCalendar: null,
86
+ hideCalendarNotes: false,
87
+ requiresConfirmation: null,
88
+ eventTypeId: 217779,
89
+ seatsShowAttendees: false,
90
+ seatsPerTimeSlot: null,
91
+ uid: 'pssX2hWwDbuKHmdGQ9BuBz',
92
+ conferenceData: {
93
+ createRequest: {
94
+ requestId: '2db644eb-37a5-581a-99fa-ebe6ce513834',
95
+ },
96
+ },
97
+ videoCallData: {
98
+ type: 'daily_video',
99
+ id: 'GrhVEmlnsyhAGw3UWKjW',
100
+ password: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyIjoir3JoVkVtbG5zeWhBR3czVVdLalciLCJvIjf0cnVlLCJkIjoiYmJkOThhNzEtMTljOS00YmIxLWE1YzUtY2FmMWVjNWJkMTA1IiwiaWF0IjoxNjc2NzIxMjU4fQ.FbmuGSRgCae6yfQKSldHEpUwHfLOZXS_m72rjnFu6gc',
101
+ url: 'https://meetco.daily.co/GrhVEmlnsyhAGw3UWKjW',
102
+ },
103
+ appsStatus: [
104
+ {
105
+ appName: 'Cal Video',
106
+ type: 'daily_video',
107
+ success: 1,
108
+ failures: 0,
109
+ errors: [],
110
+ },
111
+ ],
112
+ eventTitle: '15 Min Meeting',
113
+ eventDescription: null,
114
+ price: 0,
115
+ currency: 'usd',
116
+ length: 15,
117
+ bookingId: 235143,
118
+ metadata: {
119
+ videoCallUrl: 'https://meetco.daily.co/GrhVEmlnsyhAGw3UWKjW',
120
+ },
121
+ status: 'ACCEPTED',
122
+ },
123
+ },
124
+ },
125
+ {
126
+ type: "BOOKING_RESCHEDULED" /* EventTrigger.BOOKING_RESCHEDULED */,
127
+ displayName: 'Booking Rescheduled',
128
+ sampleData: {
129
+ triggerEvent: 'BOOKING_RESCHEDULED',
130
+ createdAt: '2023-02-18T12:11:26.909Z',
131
+ payload: {
132
+ type: '30 Min Meeting',
133
+ title: '30 Min Meeting between Mohammad Abu Aboud and John Doe',
134
+ description: 'Discuss pricing',
135
+ additionalNotes: 'Discuss pricing',
136
+ customInputs: {},
137
+ startTime: '2023-02-21T11:00:00Z',
138
+ endTime: '2023-02-21T11:30:00Z',
139
+ organizer: {
140
+ id: 63498,
141
+ name: 'Mohammad Abu Aboud',
142
+ email: 'mo@example.com',
143
+ timeZone: 'Europe/Berlin',
144
+ language: {
145
+ locale: 'en',
146
+ },
147
+ },
148
+ attendees: [
149
+ {
150
+ email: 'john@example.com',
151
+ name: 'John Doe',
152
+ timeZone: 'Europe/Berlin',
153
+ language: {
154
+ locale: 'en',
155
+ },
156
+ },
157
+ ],
158
+ location: 'https://meetco.daily.co/9tJRDCRw9ESmb64SuEwU',
159
+ destinationCalendar: null,
160
+ hideCalendarNotes: false,
161
+ requiresConfirmation: null,
162
+ eventTypeId: 217780,
163
+ seatsShowAttendees: false,
164
+ seatsPerTimeSlot: null,
165
+ uid: '88wXJjC8AHAbepGYM2bwp4',
166
+ conferenceData: {
167
+ createRequest: {
168
+ requestId: '2db644eb-37a5-581a-99fa-ebe6ce513834',
169
+ },
170
+ },
171
+ videoCallData: {
172
+ type: 'daily_video',
173
+ id: '9tJRDCRw9ESmb64SuEwU',
174
+ password: 'PASSWORD',
175
+ url: 'https://meetco.daily.co/RANDOM',
176
+ },
177
+ eventTitle: '30 Min Meeting',
178
+ eventDescription: null,
179
+ price: 0,
180
+ currency: 'usd',
181
+ length: 30,
182
+ bookingId: 235153,
183
+ rescheduleUid: '3qTJ7WiwdMR3RJmDW2KGhr',
184
+ rescheduleStartTime: '2023-02-20T08:30:00Z',
185
+ rescheduleEndTime: '2023-02-20T09:00:00Z',
186
+ metadata: {},
187
+ status: 'ACCEPTED',
188
+ },
189
+ },
190
+ },
191
+ ].map((eventTrigger) => (0, register_webhook_1.registerWebhooks)({
192
+ name: eventTrigger.type,
193
+ displayName: eventTrigger.displayName,
194
+ sampleData: eventTrigger.sampleData,
195
+ description: `Create a webhook to monitor when ${eventTrigger.displayName}`,
196
+ }));
197
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/triggers/index.ts"],"names":[],"mappings":";;;AAGA,yDAAsD;AAEzC,QAAA,QAAQ,GAAG;IACtB;QACE,IAAI,0DAAgC;QACpC,WAAW,EAAE,mBAAmB;QAChC,UAAU,EAAE;YACV,YAAY,EAAE,mBAAmB;YACjC,SAAS,EAAE,0BAA0B;YACrC,OAAO,EAAE;gBACP,KAAK,EAAE,wDAAwD;gBAC/D,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,iBAAiB;gBAC9B,YAAY,EAAE,EAAE;gBAChB,SAAS,EAAE,2BAA2B;gBACtC,OAAO,EAAE,2BAA2B;gBACpC,SAAS,EAAE;oBACT,KAAK,EAAE,qBAAqB;oBAC5B,IAAI,EAAE,oBAAoB;oBAC1B,QAAQ,EAAE,eAAe;oBACzB,QAAQ,EAAE;wBACR,MAAM,EAAE,IAAI;qBACb;iBACF;gBACD,SAAS,EAAE;oBACT;wBACE,IAAI,EAAE,UAAU;wBAChB,KAAK,EAAE,kBAAkB;wBACzB,QAAQ,EAAE,eAAe;wBACzB,QAAQ,EAAE;4BACR,MAAM,EAAE,IAAI;yBACb;qBACF;iBACF;gBACD,GAAG,EAAE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AI;yBACb;qBACF;iBACF;gBACD,QAAQ,EAAE,8CAA8C;gBACxD,mBAAmB,EAAE,IAAI;gBACzB,iBAAiB,EAAE,KAAK;gBACxB,oBAAoB,EAAE,IAAI;gBAC1B,WAAW,EAAE,MAAM;gBACnB,kBAAkB,EAAE,KAAK;gBACzB,gBAAgB,EAAE,IAAI;gBACtB,GAAG,EAAE,wBAAwB;gBAC7B,cAAc,EAAE;oBACd,aAAa,EAAE;wBACb,SAAS,EAAE,sCAAsC;qBAClD;iBACF;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,aAAa;oBACnB,EAAE,EAAE,sBAAsB;oBAC1B,QAAQ,EAAE,UAAU;oBACpB,GAAG,EAAE,gCAAgC;iBACtC;gBACD,UAAU,EAAE,gBAAgB;gBAC5B,gBAAgB,EAAE,IAAI;gBACtB,KAAK,EAAE,CAAC;gBACR,QAAQ,EAAE,KAAK;gBACf,MAAM,EAAE,EAAE;gBACV,SAAS,EAAE,MAAM;gBACjB,aAAa,EAAE,wBAAwB;gBACvC,mBAAmB,EAAE,sBAAsB;gBAC3C,iBAAiB,EAAE,sBAAsB;gBACzC,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,UAAU;aACnB;SACF;KACF;CACF,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CACrB,IAAA,mCAAgB,EAAC;IACf,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,WAAW,EAAE,YAAY,CAAC,WAAW;IACrC,UAAU,EAAE,YAAY,CAAC,UAAU;IACnC,WAAW,EAAE,oCAAoC,YAAY,CAAC,WAAW,EAAE;CAC5E,CAAC,CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { TriggerStrategy } from '@agnocon/pieces-framework';
2
+ export declare const registerWebhooks: ({ name, description, displayName, sampleData, aiMetadata, }: {
3
+ name: string;
4
+ description: string;
5
+ displayName: string;
6
+ sampleData: Record<string, unknown>;
7
+ aiMetadata?: {
8
+ description: string;
9
+ };
10
+ }) => import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}>;
11
+ //# sourceMappingURL=register-webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-webhook.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/register-webhook.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,eAAe,EAEhB,MAAM,2BAA2B,CAAC;AAQnC,eAAO,MAAM,gBAAgB,gEAM1B;IACD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC,6iBA+DG,CAAC"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerWebhooks = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/cal-com/src/lib/triggers/register-webhook.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 pieces_common_1 = require("@agnocon/pieces-common");
9
+ const __1 = require("../..");
10
+ const registerWebhooks = ({ name, description, displayName, sampleData, aiMetadata, }) => (0, pieces_framework_1.createTrigger)({
11
+ auth: __1.calcomAuth,
12
+ name,
13
+ description,
14
+ displayName,
15
+ aiMetadata,
16
+ props: {},
17
+ sampleData: sampleData,
18
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
19
+ onEnable(context) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ var _a;
22
+ const request = {
23
+ method: pieces_common_1.HttpMethod.POST,
24
+ url: `https://api.cal.com/v2/webhooks`,
25
+ body: {
26
+ triggers: [name],
27
+ subscriberUrl: context.webhookUrl,
28
+ active: true,
29
+ },
30
+ headers: {
31
+ Authorization: `Bearer ${context.auth.secret_text}`,
32
+ 'cal-api-version': '2024-06-14',
33
+ },
34
+ };
35
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
36
+ if (response.status === 200 || response.status === 201) {
37
+ yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put(`cal_com_trigger_${name}`, response.body.data));
38
+ }
39
+ });
40
+ },
41
+ onDisable(context) {
42
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
+ var _a, _b;
44
+ const data = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get(`cal_com_trigger_${name}`));
45
+ if (data != null) {
46
+ const request = {
47
+ method: pieces_common_1.HttpMethod.DELETE,
48
+ url: `https://api.cal.com/v2/webhooks/${data.id}`,
49
+ headers: {
50
+ Authorization: `Bearer ${context.auth.secret_text}`,
51
+ 'cal-api-version': '2024-06-14',
52
+ },
53
+ };
54
+ try {
55
+ yield pieces_common_1.httpClient.sendRequest(request);
56
+ }
57
+ catch (e) {
58
+ // 404 means the webhook was registered under the old v1 API and no
59
+ // longer exists in v2 — safe to ignore, re-enabling will create a
60
+ // fresh v2 webhook.
61
+ if (((_b = e === null || e === void 0 ? void 0 : e.response) === null || _b === void 0 ? void 0 : _b.status) !== 404)
62
+ throw e;
63
+ }
64
+ }
65
+ });
66
+ },
67
+ run(context) {
68
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
69
+ return [context.payload.body];
70
+ });
71
+ },
72
+ });
73
+ exports.registerWebhooks = registerWebhooks;
74
+ //# sourceMappingURL=register-webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-webhook.js","sourceRoot":"","sources":["../../../src/lib/triggers/register-webhook.ts"],"names":[],"mappings":";;;;AAAA,2GAA2G;AAC3G,qEAAqE;AACrE,gEAKmC;AACnC,0DAIgC;AAChC,6BAAmC;AAE5B,MAAM,gBAAgB,GAAG,CAAC,EAC/B,IAAI,EACJ,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,GAOX,EAAE,EAAE,CACH,IAAA,gCAAa,EAAC;IACZ,IAAI,EAAE,cAAU;IAChB,IAAI;IACJ,WAAW;IACX,WAAW;IACX,UAAU;IACV,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,UAAU;IACtB,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;;YACpB,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,iCAAiC;gBACtC,IAAI,EAAE;oBACJ,QAAQ,EAAE,CAAC,IAAI,CAAC;oBAChB,aAAa,EAAE,OAAO,CAAC,UAAU;oBACjC,MAAM,EAAE,IAAI;iBACb;gBACD,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;oBACnD,iBAAiB,EAAE,YAAY;iBAChC;aACF,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAC3C,OAAO,CACR,CAAC;YAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvD,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CACtB,mBAAmB,IAAI,EAAE,EACzB,QAAQ,CAAC,IAAI,CAAC,IAAI,CACnB,CAAA,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;;YACrB,MAAM,IAAI,GAAG,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CACnC,mBAAmB,IAAI,EAAE,CAC1B,CAAA,CAAC;YACF,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;gBACjB,MAAM,OAAO,GAAgB;oBAC3B,MAAM,EAAE,0BAAU,CAAC,MAAM;oBACzB,GAAG,EAAE,mCAAmC,IAAI,CAAC,EAAE,EAAE;oBACjD,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;wBACnD,iBAAiB,EAAE,YAAY;qBAChC;iBACF,CAAC;gBAEF,IAAI,CAAC;oBACH,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBACxC,CAAC;gBAAC,OAAO,CAAM,EAAE,CAAC;oBAChB,mEAAmE;oBACnE,kEAAkE;oBAClE,oBAAoB;oBACpB,IAAI,CAAA,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,QAAQ,0CAAE,MAAM,MAAK,GAAG;wBAAE,MAAM,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC;AA3EQ,QAAA,gBAAgB,oBA2ExB"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@agnocon/piece-cal-com",
3
+ "version": "0.4.8",
4
+ "description": "AgnoCon cal com 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-cal-com"
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.4.8"
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,21 @@
1
+ import { PieceAuth, createPiece } from '@agnocon/pieces-framework';
2
+ import { PieceCategory } from '@agnocon/pieces-framework';
3
+ import { triggers } from './lib/triggers';
4
+
5
+ export const calcomAuth = PieceAuth.SecretText({
6
+ displayName: 'API Key',
7
+ description: 'API Key provided by cal.com',
8
+ required: true,
9
+ });
10
+
11
+ export const calcom = createPiece({
12
+ displayName: 'Cal.com',
13
+ description: 'Open-source alternative to Calendly',
14
+ minimumSupportedRelease: '0.30.0',
15
+ logoUrl: 'https://cdn.activepieces.com/pieces/cal.com.png',
16
+ categories: [PieceCategory.PRODUCTIVITY],
17
+ authors: ["kishanprmr","AbdulTheActivePiecer","khaledmashaly","abuaboud"],
18
+ auth: calcomAuth,
19
+ actions: [],
20
+ triggers,
21
+ });
@@ -0,0 +1,5 @@
1
+ export const enum EventTrigger {
2
+ BOOKING_CREATED = 'BOOKING_CREATED',
3
+ BOOKING_RESCHEDULED = 'BOOKING_RESCHEDULED',
4
+ BOOKING_CANCELLED = 'BOOKING_CANCELLED',
5
+ }
@@ -0,0 +1,198 @@
1
+ import { EventTrigger } from '../common';
2
+ import { registerWebhooks } from './register-webhook';
3
+
4
+ export const triggers = [
5
+ {
6
+ type: EventTrigger.BOOKING_CANCELLED,
7
+ displayName: 'Booking Cancelled',
8
+ sampleData: {
9
+ triggerEvent: 'BOOKING_CANCELLED',
10
+ createdAt: '2023-02-18T12:11:37.975Z',
11
+ payload: {
12
+ title: '30 Min Meeting between Mohammad Abu Aboud and John Doe',
13
+ type: '30 Min Meeting',
14
+ description: 'Discuss pricing',
15
+ customInputs: {},
16
+ startTime: '2023-02-21T11:00:00+00:00',
17
+ endTime: '2023-02-21T11:30:00+00:00',
18
+ organizer: {
19
+ email: 'mo@activepieces.com',
20
+ name: 'Mohammad Abu Aboud',
21
+ timeZone: 'Europe/Berlin',
22
+ language: {
23
+ locale: 'en',
24
+ },
25
+ },
26
+ attendees: [
27
+ {
28
+ name: 'John Doe',
29
+ email: 'john@example.com',
30
+ timeZone: 'Europe/Berlin',
31
+ language: {
32
+ locale: 'en',
33
+ },
34
+ },
35
+ ],
36
+ uid: '88wXJjC8AHAbepGYM2bwp4',
37
+ location: 'integrations:daily',
38
+ destinationCalendar: null,
39
+ cancellationReason: 'Cancellation note',
40
+ eventTitle: '30 Min Meeting',
41
+ eventDescription: null,
42
+ requiresConfirmation: null,
43
+ price: null,
44
+ currency: 'usd',
45
+ length: 30,
46
+ status: 'CANCELLED',
47
+ },
48
+ },
49
+ },
50
+ {
51
+ type: EventTrigger.BOOKING_CREATED,
52
+ displayName: 'Booking Created',
53
+ sampleData: {
54
+ triggerEvent: 'BOOKING_CREATED',
55
+ createdAt: '2023-02-18T11:54:18.440Z',
56
+ payload: {
57
+ type: '15 Min Meeting',
58
+ title: '15 Min Meeting between Ash Sam and John Doe',
59
+ description: '',
60
+ additionalNotes: '',
61
+ customInputs: {},
62
+ startTime: '2023-02-20T08:00:00Z',
63
+ endTime: '2023-02-20T08:15:00Z',
64
+ organizer: {
65
+ id: 63498,
66
+ name: 'Ash Sam',
67
+ email: 'ash@sam.com',
68
+ timeZone: 'Europe/Berlin',
69
+ language: {
70
+ locale: 'en',
71
+ },
72
+ },
73
+ attendees: [
74
+ {
75
+ email: 'johndoe@gmail.com',
76
+ name: 'John Doe',
77
+ timeZone: 'Europe/Berlin',
78
+ language: {
79
+ locale: 'en',
80
+ },
81
+ },
82
+ ],
83
+ location: 'integrations:daily',
84
+ destinationCalendar: null,
85
+ hideCalendarNotes: false,
86
+ requiresConfirmation: null,
87
+ eventTypeId: 217779,
88
+ seatsShowAttendees: false,
89
+ seatsPerTimeSlot: null,
90
+ uid: 'pssX2hWwDbuKHmdGQ9BuBz',
91
+ conferenceData: {
92
+ createRequest: {
93
+ requestId: '2db644eb-37a5-581a-99fa-ebe6ce513834',
94
+ },
95
+ },
96
+ videoCallData: {
97
+ type: 'daily_video',
98
+ id: 'GrhVEmlnsyhAGw3UWKjW',
99
+ password:
100
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyIjoir3JoVkVtbG5zeWhBR3czVVdLalciLCJvIjf0cnVlLCJkIjoiYmJkOThhNzEtMTljOS00YmIxLWE1YzUtY2FmMWVjNWJkMTA1IiwiaWF0IjoxNjc2NzIxMjU4fQ.FbmuGSRgCae6yfQKSldHEpUwHfLOZXS_m72rjnFu6gc',
101
+ url: 'https://meetco.daily.co/GrhVEmlnsyhAGw3UWKjW',
102
+ },
103
+ appsStatus: [
104
+ {
105
+ appName: 'Cal Video',
106
+ type: 'daily_video',
107
+ success: 1,
108
+ failures: 0,
109
+ errors: [],
110
+ },
111
+ ],
112
+ eventTitle: '15 Min Meeting',
113
+ eventDescription: null,
114
+ price: 0,
115
+ currency: 'usd',
116
+ length: 15,
117
+ bookingId: 235143,
118
+ metadata: {
119
+ videoCallUrl: 'https://meetco.daily.co/GrhVEmlnsyhAGw3UWKjW',
120
+ },
121
+ status: 'ACCEPTED',
122
+ },
123
+ },
124
+ },
125
+ {
126
+ type: EventTrigger.BOOKING_RESCHEDULED,
127
+ displayName: 'Booking Rescheduled',
128
+ sampleData: {
129
+ triggerEvent: 'BOOKING_RESCHEDULED',
130
+ createdAt: '2023-02-18T12:11:26.909Z',
131
+ payload: {
132
+ type: '30 Min Meeting',
133
+ title: '30 Min Meeting between Mohammad Abu Aboud and John Doe',
134
+ description: 'Discuss pricing',
135
+ additionalNotes: 'Discuss pricing',
136
+ customInputs: {},
137
+ startTime: '2023-02-21T11:00:00Z',
138
+ endTime: '2023-02-21T11:30:00Z',
139
+ organizer: {
140
+ id: 63498,
141
+ name: 'Mohammad Abu Aboud',
142
+ email: 'mo@example.com',
143
+ timeZone: 'Europe/Berlin',
144
+ language: {
145
+ locale: 'en',
146
+ },
147
+ },
148
+ attendees: [
149
+ {
150
+ email: 'john@example.com',
151
+ name: 'John Doe',
152
+ timeZone: 'Europe/Berlin',
153
+ language: {
154
+ locale: 'en',
155
+ },
156
+ },
157
+ ],
158
+ location: 'https://meetco.daily.co/9tJRDCRw9ESmb64SuEwU',
159
+ destinationCalendar: null,
160
+ hideCalendarNotes: false,
161
+ requiresConfirmation: null,
162
+ eventTypeId: 217780,
163
+ seatsShowAttendees: false,
164
+ seatsPerTimeSlot: null,
165
+ uid: '88wXJjC8AHAbepGYM2bwp4',
166
+ conferenceData: {
167
+ createRequest: {
168
+ requestId: '2db644eb-37a5-581a-99fa-ebe6ce513834',
169
+ },
170
+ },
171
+ videoCallData: {
172
+ type: 'daily_video',
173
+ id: '9tJRDCRw9ESmb64SuEwU',
174
+ password: 'PASSWORD',
175
+ url: 'https://meetco.daily.co/RANDOM',
176
+ },
177
+ eventTitle: '30 Min Meeting',
178
+ eventDescription: null,
179
+ price: 0,
180
+ currency: 'usd',
181
+ length: 30,
182
+ bookingId: 235153,
183
+ rescheduleUid: '3qTJ7WiwdMR3RJmDW2KGhr',
184
+ rescheduleStartTime: '2023-02-20T08:30:00Z',
185
+ rescheduleEndTime: '2023-02-20T09:00:00Z',
186
+ metadata: {},
187
+ status: 'ACCEPTED',
188
+ },
189
+ },
190
+ },
191
+ ].map((eventTrigger) =>
192
+ registerWebhooks({
193
+ name: eventTrigger.type,
194
+ displayName: eventTrigger.displayName,
195
+ sampleData: eventTrigger.sampleData,
196
+ description: `Create a webhook to monitor when ${eventTrigger.displayName}`,
197
+ })
198
+ );
@@ -0,0 +1,104 @@
1
+ import {
2
+ createTrigger,
3
+ Trigger,
4
+ TriggerStrategy,
5
+ Property,
6
+ } from '@agnocon/pieces-framework';
7
+ import {
8
+ httpClient,
9
+ HttpRequest,
10
+ HttpMethod,
11
+ } from '@agnocon/pieces-common';
12
+ import { calcomAuth } from '../..';
13
+
14
+ export const registerWebhooks = ({
15
+ name,
16
+ description,
17
+ displayName,
18
+ sampleData,
19
+ aiMetadata,
20
+ }: {
21
+ name: string;
22
+ description: string;
23
+ displayName: string;
24
+ sampleData: Record<string, unknown>;
25
+ aiMetadata?: { description: string };
26
+ }) =>
27
+ createTrigger({
28
+ auth: calcomAuth,
29
+ name,
30
+ description,
31
+ displayName,
32
+ aiMetadata,
33
+ props: {},
34
+ sampleData: sampleData,
35
+ type: TriggerStrategy.WEBHOOK,
36
+ async onEnable(context) {
37
+ const request: HttpRequest = {
38
+ method: HttpMethod.POST,
39
+ url: `https://api.cal.com/v2/webhooks`,
40
+ body: {
41
+ triggers: [name],
42
+ subscriberUrl: context.webhookUrl,
43
+ active: true,
44
+ },
45
+ headers: {
46
+ Authorization: `Bearer ${context.auth.secret_text}`,
47
+ 'cal-api-version': '2024-06-14',
48
+ },
49
+ };
50
+
51
+ const response = await httpClient.sendRequest<WebhookResponseBody>(
52
+ request
53
+ );
54
+
55
+ if (response.status === 200 || response.status === 201) {
56
+ await context.store?.put(
57
+ `cal_com_trigger_${name}`,
58
+ response.body.data
59
+ );
60
+ }
61
+ },
62
+ async onDisable(context) {
63
+ const data = await context.store?.get<WebhookInformation>(
64
+ `cal_com_trigger_${name}`
65
+ );
66
+ if (data != null) {
67
+ const request: HttpRequest = {
68
+ method: HttpMethod.DELETE,
69
+ url: `https://api.cal.com/v2/webhooks/${data.id}`,
70
+ headers: {
71
+ Authorization: `Bearer ${context.auth.secret_text}`,
72
+ 'cal-api-version': '2024-06-14',
73
+ },
74
+ };
75
+
76
+ try {
77
+ await httpClient.sendRequest(request);
78
+ } catch (e: any) {
79
+ // 404 means the webhook was registered under the old v1 API and no
80
+ // longer exists in v2 — safe to ignore, re-enabling will create a
81
+ // fresh v2 webhook.
82
+ if (e?.response?.status !== 404) throw e;
83
+ }
84
+ }
85
+ },
86
+ async run(context) {
87
+ return [context.payload.body];
88
+ },
89
+ });
90
+
91
+ interface WebhookInformation {
92
+ id: string;
93
+ userId: number;
94
+ eventTypeId?: null | string;
95
+ payloadTemplate?: null | string;
96
+ triggers: string[];
97
+ appId?: null | string;
98
+ subscriberUrl: string;
99
+ }
100
+
101
+ interface WebhookResponseBody {
102
+ data: WebhookInformation;
103
+ status: string;
104
+ }