@prismatic-io/components-gong 0.0.0-stage → 0.0.1

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.
@@ -0,0 +1,2104 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ let _prismatic_io_spectral = require("@prismatic-io/spectral");
24
+ let _prismatic_io_spectral_http = require("@prismatic-io/spectral/http");
25
+ let form_data = require("form-data");
26
+ form_data = __toESM(form_data);
27
+ //#region src/connections.ts
28
+ const gongConnection = (0, _prismatic_io_spectral.oauth2Connection)({
29
+ oauth2Type: _prismatic_io_spectral.OAuth2Type.AuthorizationCode,
30
+ key: "oauth2",
31
+ display: {
32
+ label: "OAuth 2.0",
33
+ description: "Authenticate using oauth flow."
34
+ },
35
+ inputs: {
36
+ authorizeUrl: {
37
+ label: "Authorize URL",
38
+ placeholder: "Authorize URL",
39
+ type: "string",
40
+ required: true,
41
+ shown: false,
42
+ comments: "The OAuth 2.0 Authorization URL for Gong",
43
+ default: "https://app.gong.io/oauth2/authorize"
44
+ },
45
+ tokenUrl: {
46
+ label: "Token URL",
47
+ placeholder: "Token URL",
48
+ type: "string",
49
+ required: true,
50
+ shown: false,
51
+ default: "https://app.gong.io/oauth2/generate-customer-token",
52
+ comments: "The OAuth 2.0 Token URL for Gong"
53
+ },
54
+ scopes: {
55
+ label: "Scopes",
56
+ placeholder: "Scopes",
57
+ type: "string",
58
+ required: false,
59
+ shown: true,
60
+ comments: "A space-delimited set of one or more scopes to get the user's permission to access. A list of all scopes is available at https://app.gong.io/settings/api/documentation#overview",
61
+ default: "api:calls:create api:calls:read:basic"
62
+ },
63
+ clientId: {
64
+ label: "API Key",
65
+ placeholder: "API Key",
66
+ type: "string",
67
+ required: true,
68
+ shown: true,
69
+ comments: "Obtain this by creating an app at your Gong Dashboard"
70
+ },
71
+ clientSecret: {
72
+ label: "API Secret",
73
+ placeholder: "API Secret",
74
+ type: "password",
75
+ required: true,
76
+ shown: true,
77
+ comments: "Obtain this by creating an app at your Gong Dashboard"
78
+ }
79
+ }
80
+ });
81
+ const gongApiKey = (0, _prismatic_io_spectral.connection)({
82
+ key: "gongApiKey",
83
+ display: {
84
+ label: "API Key",
85
+ description: "Generate by visiting Company Settings > Ecosystem > API."
86
+ },
87
+ inputs: {
88
+ baseUrl: {
89
+ label: "Base URL",
90
+ required: true,
91
+ shown: true,
92
+ type: "string",
93
+ example: "https://us-0000.api.gong.io",
94
+ comments: "The base URL for your Gong instance API.",
95
+ clean: _prismatic_io_spectral.util.types.toString
96
+ },
97
+ accessKey: {
98
+ label: "Access Key",
99
+ required: true,
100
+ type: "string",
101
+ comments: "The access key for authentication.",
102
+ placeholder: "Enter access key",
103
+ clean: _prismatic_io_spectral.util.types.toString
104
+ },
105
+ accessKeySecret: {
106
+ label: "Access Key Secret",
107
+ required: true,
108
+ shown: true,
109
+ type: "password",
110
+ comments: "The access key secret for authentication."
111
+ }
112
+ }
113
+ });
114
+ var connections_default = [gongConnection, gongApiKey];
115
+ //#endregion
116
+ //#region src/client.ts
117
+ const getHeaders = (connection) => {
118
+ if (connection.key === gongConnection.key) {
119
+ const connectionToken = connection.token;
120
+ if (connectionToken) return {
121
+ baseUrl: _prismatic_io_spectral.util.types.toString(connectionToken.api_base_url_for_customer),
122
+ headers: { Authorization: `Bearer ${_prismatic_io_spectral.util.types.toString(connectionToken.access_token)}` }
123
+ };
124
+ }
125
+ if (connection.key === gongApiKey.key) {
126
+ const { baseUrl, accessKey, accessKeySecret } = connection.fields;
127
+ const basicAuth = Buffer.from(`${accessKey}:${accessKeySecret}`).toString("base64");
128
+ return {
129
+ baseUrl: _prismatic_io_spectral.util.types.toString(baseUrl),
130
+ headers: { Authorization: `Basic ${basicAuth}` }
131
+ };
132
+ }
133
+ throw new Error(`Failed to guess at authorization parameters for Connection: ${connection.key}`);
134
+ };
135
+ const createClient = (connection, debug) => {
136
+ const { baseUrl, headers } = getHeaders(connection);
137
+ return (0, _prismatic_io_spectral_http.createClient)({
138
+ baseUrl,
139
+ headers: {
140
+ ...headers,
141
+ Accept: "application/json"
142
+ },
143
+ responseType: "json",
144
+ debug
145
+ });
146
+ };
147
+ //#endregion
148
+ //#region src/util.ts
149
+ const toOptionalString = (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0;
150
+ const toOptionalNumber = (value) => value ? _prismatic_io_spectral.util.types.toNumber(value) : void 0;
151
+ const jsonInputClean = (value) => {
152
+ if (value !== null && value !== "") return JSON.parse(value);
153
+ };
154
+ const valueListInputClean = (value) => {
155
+ if (Array.isArray(value) && value.length >= 1 && value[0] !== "000xxx") return value;
156
+ };
157
+ const fetchAllCalls = async (client, fromDateTime, toDateTime) => {
158
+ const allCalls = [];
159
+ let cursor;
160
+ do {
161
+ const { data } = await client.get("/v2/calls", { params: {
162
+ fromDateTime,
163
+ toDateTime,
164
+ cursor
165
+ } });
166
+ const calls = data.calls ?? [];
167
+ allCalls.push(...calls);
168
+ cursor = data.records?.cursor;
169
+ } while (cursor);
170
+ return allCalls;
171
+ };
172
+ const fetchAllUsers = async (client) => {
173
+ const allUsers = [];
174
+ let cursor;
175
+ do {
176
+ const { data } = await client.get("/v2/users", { params: { cursor } });
177
+ const users = data.users ?? [];
178
+ allUsers.push(...users);
179
+ cursor = data.records?.cursor;
180
+ } while (cursor);
181
+ return allUsers;
182
+ };
183
+ const LOOK_BACK_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
184
+ const lookBackDateClean = (value) => {
185
+ if (value === void 0 || value === null) return "";
186
+ const raw = typeof value === "string" ? value.trim() : String(value);
187
+ if (raw === "") return "";
188
+ const match = typeof value === "string" ? raw.match(LOOK_BACK_DATE_PATTERN) : null;
189
+ if (!match) throw new Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${raw}`);
190
+ const [, yearStr, monthStr, dayStr] = match;
191
+ const year = Number(yearStr);
192
+ const month = Number(monthStr);
193
+ const day = Number(dayStr);
194
+ const parsed = new Date(Date.UTC(year, month - 1, day));
195
+ if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) throw new Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${raw}`);
196
+ if (parsed.getTime() > Date.now()) throw new Error(`Look-back Date cannot be a future date. Received: ${raw}`);
197
+ return parsed.toISOString();
198
+ };
199
+ const resolvePollingRecordChanges = (data) => {
200
+ const changesObject = data ?? {};
201
+ return [...(changesObject.created ?? []).map((record) => ({
202
+ changeType: "created",
203
+ record
204
+ })), ...(changesObject.updated ?? []).map((record) => ({
205
+ changeType: "updated",
206
+ record
207
+ }))];
208
+ };
209
+ //#endregion
210
+ //#region src/constants.ts
211
+ const PollResource = {
212
+ CALLS: "calls",
213
+ USERS: "users"
214
+ };
215
+ const POLL_RESOURCE_CONFIG = {
216
+ [PollResource.CALLS]: { label: "Calls" },
217
+ [PollResource.USERS]: { label: "Users" }
218
+ };
219
+ const pollResourceModel = Object.entries(POLL_RESOURCE_CONFIG).map(([value, { label }]) => ({
220
+ label,
221
+ value
222
+ }));
223
+ //#endregion
224
+ //#region src/inputs.ts
225
+ const connection = (0, _prismatic_io_spectral.input)({
226
+ label: "Connection",
227
+ type: "connection",
228
+ required: true
229
+ });
230
+ const callId = (0, _prismatic_io_spectral.input)({
231
+ label: "Call Id",
232
+ type: "string",
233
+ required: true,
234
+ clean: _prismatic_io_spectral.util.types.toString,
235
+ comments: "Gong's unique numeric identifier for the call (up to 20 digits)",
236
+ example: "1230788881967087399",
237
+ placeholder: "Enter call ID",
238
+ dataSource: "calls"
239
+ });
240
+ const userId = (0, _prismatic_io_spectral.input)({
241
+ label: "User Id",
242
+ type: "string",
243
+ required: true,
244
+ clean: _prismatic_io_spectral.util.types.toString,
245
+ comments: "Gong's unique numeric identifier for the user (up to 20 digits).",
246
+ example: "1230788881967087399",
247
+ placeholder: "Enter user ID",
248
+ dataSource: "users"
249
+ });
250
+ const folderId = (0, _prismatic_io_spectral.input)({
251
+ label: "Folder Id",
252
+ type: "string",
253
+ required: false,
254
+ clean: toOptionalString,
255
+ comments: "Gong's unique numeric identifier for the folder (up to 20 digits).",
256
+ example: "1230788881967087399",
257
+ placeholder: "Enter folder ID",
258
+ dataSource: "folders"
259
+ });
260
+ const cursor = (0, _prismatic_io_spectral.input)({
261
+ label: "Cursor",
262
+ type: "string",
263
+ required: false,
264
+ clean: toOptionalString,
265
+ comments: "When paging is needed, provide the value supplied by the previous API call to bring the following page of records.",
266
+ example: "eyJhbGciOiJIUzI1NiJ9.eyJjYWxsSWQiM1M30.6qKwpOcvnuweTZmFRzYdtjs_YwJphJU4QIwWFM",
267
+ placeholder: "Enter pagination cursor"
268
+ });
269
+ const startTime = (0, _prismatic_io_spectral.input)({
270
+ label: "Start Time",
271
+ type: "string",
272
+ required: true,
273
+ clean: _prismatic_io_spectral.util.types.toString,
274
+ comments: "The meeting start time in ISO-8601 format (e.g., '2018-02-18T02:30:00-07:00' or '2018-02-18T08:00:00Z', where Z stands for UTC).",
275
+ example: "2018-02-18T02:30:00-07:00",
276
+ placeholder: "2018-02-18T02:30:00-07:00"
277
+ });
278
+ const endTime = (0, _prismatic_io_spectral.input)({
279
+ label: "End Time",
280
+ type: "string",
281
+ required: true,
282
+ clean: _prismatic_io_spectral.util.types.toString,
283
+ comments: "The meeting end time in ISO-8601 format (e.g., '2018-02-18T02:30:00-07:00' or '2018-02-18T08:00:00Z', where Z stands for UTC).",
284
+ example: "2018-02-18T02:30:00-07:00",
285
+ placeholder: "2018-02-18T03:30:00-07:00"
286
+ });
287
+ const fromDateTime = (0, _prismatic_io_spectral.input)({
288
+ label: "From Date Time",
289
+ type: "string",
290
+ required: true,
291
+ clean: _prismatic_io_spectral.util.types.toString,
292
+ comments: "Date and time (in ISO-8601 format: '2018-02-18T02:30:00-07:00' or '2018-02-18T08:00:00Z', where Z stands for UTC) from which to list recorded calls. Returns calls that started on or after the specified date and time. If not provided, list starts with earliest call. For web-conference calls recorded by Gong, the date denotes its scheduled time, otherwise, it denotes its actual start time.",
293
+ example: "2018-02-18T02:30:00-07:00",
294
+ placeholder: "2018-02-18T02:30:00-07:00"
295
+ });
296
+ const toDateTime = (0, _prismatic_io_spectral.input)({
297
+ label: "To Date Time",
298
+ type: "string",
299
+ required: true,
300
+ clean: _prismatic_io_spectral.util.types.toString,
301
+ comments: "Date and time (in ISO-8601 format: '2018-02-18T02:30:00-07:00' or '2018-02-18T08:00:00Z', where Z stands for UTC) until which to list recorded calls. Returns calls that started up to but excluding specified date and time. If not provided, list ends with most recent call. For web-conference calls recorded by Gong, the date denotes its scheduled time, otherwise, it denotes its actual start time.",
302
+ example: "2018-02-18T02:30:00-07:00",
303
+ placeholder: "2018-02-20T02:30:00-07:00"
304
+ });
305
+ const workspaceId = (0, _prismatic_io_spectral.input)({
306
+ label: "Workspace Id",
307
+ type: "string",
308
+ required: false,
309
+ clean: toOptionalString,
310
+ comments: "Optional Workspace identifier, if supplied the API will return only the calls belonging to this workspace.",
311
+ example: "1230788881967087399",
312
+ placeholder: "Enter workspace ID",
313
+ dataSource: "workspaces"
314
+ });
315
+ const clientUniqueId = (0, _prismatic_io_spectral.input)({
316
+ label: "Client Unique Id",
317
+ type: "string",
318
+ required: true,
319
+ clean: _prismatic_io_spectral.util.types.toString,
320
+ comments: "A call's unique identifier in the PBX or the recording system. Gong uses this identifier to prevent repeated attempts to upload the same recording.",
321
+ example: "1230788881967087399",
322
+ placeholder: "Enter unique identifier"
323
+ });
324
+ const title = (0, _prismatic_io_spectral.input)({
325
+ label: "Title",
326
+ type: "string",
327
+ required: false,
328
+ clean: toOptionalString,
329
+ comments: "The title of the call. This title is available in the Gong system for indexing and search.",
330
+ example: "Example call",
331
+ placeholder: "Enter call title"
332
+ });
333
+ const purpose = (0, _prismatic_io_spectral.input)({
334
+ label: "Purpose",
335
+ type: "string",
336
+ required: false,
337
+ clean: toOptionalString,
338
+ comments: "The purpose of the call. This optional field is a free text of up to 255 characters.",
339
+ example: "Demo call",
340
+ placeholder: "Enter call purpose"
341
+ });
342
+ const scheduledStart = (0, _prismatic_io_spectral.input)({
343
+ label: "Scheduled Start",
344
+ type: "string",
345
+ required: false,
346
+ clean: toOptionalString,
347
+ comments: "The date and time the call was scheduled to begin in the ISO-8601 format (e.g., '2018-02-18T02:30:00-07:00' or '2018-02-18T08:00:00Z', where Z stands for UTC)",
348
+ example: "2018-02-18T02:30:00-07:00",
349
+ placeholder: "2018-02-18T02:30:00-07:00"
350
+ });
351
+ const scheduledEnd = (0, _prismatic_io_spectral.input)({
352
+ label: "Scheduled End",
353
+ type: "string",
354
+ required: false,
355
+ clean: toOptionalString,
356
+ comments: "The date and time the call was scheduled to end in the ISO-8601 format (e.g., '2018-02-18T02:30:00-07:00' or '2018-02-18T08:00:00Z', where Z stands for UTC)",
357
+ example: "2018-02-18T02:30:00-07:00",
358
+ placeholder: "2018-02-18T03:30:00-07:00"
359
+ });
360
+ const actualStart = (0, _prismatic_io_spectral.input)({
361
+ label: "Actual Start",
362
+ type: "string",
363
+ required: true,
364
+ clean: _prismatic_io_spectral.util.types.toString,
365
+ comments: "The actual date and time when the call started in the ISO-8601 format (e.g., '2018-02-18T02:30:00-07:00' or '2018-02-18T08:00:00Z', where Z stands for UTC)",
366
+ example: "2018-02-18T02:30:00-07:00",
367
+ placeholder: "2018-02-18T02:30:00-07:00"
368
+ });
369
+ const duration = (0, _prismatic_io_spectral.input)({
370
+ label: "Duration",
371
+ type: "string",
372
+ required: false,
373
+ clean: toOptionalNumber,
374
+ comments: "The actual call duration in seconds.",
375
+ example: "125.8",
376
+ placeholder: "Enter duration in seconds"
377
+ });
378
+ const parties = (0, _prismatic_io_spectral.input)({
379
+ label: "Parties",
380
+ type: "code",
381
+ language: "json",
382
+ comments: "A list of the call's participants. A party must be provided for the primaryUser.",
383
+ example: JSON.stringify([{
384
+ phoneNumber: "+1 123-567-8989",
385
+ emailAddress: "test@test.com",
386
+ name: "Test User",
387
+ partyId: "1",
388
+ mediaChannelId: 0,
389
+ context: [{
390
+ system: "Salesforce",
391
+ objects: [{
392
+ objectType: "Contact",
393
+ objectId: "0013601230sV7grAAC",
394
+ fields: [{
395
+ name: "name",
396
+ value: "Gong Inc."
397
+ }]
398
+ }]
399
+ }],
400
+ userId: "234599484848423"
401
+ }], null, 2),
402
+ clean: jsonInputClean,
403
+ required: true
404
+ });
405
+ const direction = (0, _prismatic_io_spectral.input)({
406
+ label: "Direction",
407
+ type: "string",
408
+ comments: "Whether the call is inbound (someone called the company), outbound (a rep dialed someone outside the company), or a conference call.",
409
+ clean: _prismatic_io_spectral.util.types.toString,
410
+ model: [
411
+ {
412
+ label: "Inbound",
413
+ value: "Inbound"
414
+ },
415
+ {
416
+ label: "Outbound",
417
+ value: "Outbound"
418
+ },
419
+ {
420
+ label: "Conference",
421
+ value: "Conference"
422
+ },
423
+ {
424
+ label: "Unknown",
425
+ value: "Unknown"
426
+ }
427
+ ],
428
+ required: true,
429
+ example: "Inbound"
430
+ });
431
+ const disposition = (0, _prismatic_io_spectral.input)({
432
+ label: "Disposition",
433
+ type: "string",
434
+ required: false,
435
+ clean: toOptionalString,
436
+ comments: "The disposition of the call. The disposition is free text of up to 255 characters.",
437
+ example: "No Answer",
438
+ placeholder: "Enter call disposition"
439
+ });
440
+ const context = (0, _prismatic_io_spectral.input)({
441
+ label: "Context",
442
+ type: "code",
443
+ language: "json",
444
+ comments: "A list of references to external systems such as CRM, Telephony System, Case Management, etc.",
445
+ example: JSON.stringify([{
446
+ system: "Salesforce",
447
+ objects: [{
448
+ objectType: "Account",
449
+ objectId: "0013601230sV7grAAC",
450
+ fields: [{
451
+ name: "name",
452
+ value: "Gong Inc."
453
+ }]
454
+ }]
455
+ }], null, 2),
456
+ clean: jsonInputClean,
457
+ required: false
458
+ });
459
+ const customData = (0, _prismatic_io_spectral.input)({
460
+ label: "Custom Data",
461
+ type: "string",
462
+ required: false,
463
+ clean: toOptionalString,
464
+ comments: "Optional metadata associated with the call (represented as text). Gong stores this metadata and it can be used for troubleshooting.",
465
+ example: "Optional data",
466
+ placeholder: "Enter custom metadata"
467
+ });
468
+ const speakersTimeline = (0, _prismatic_io_spectral.input)({
469
+ label: "Speakers Timeline",
470
+ type: "code",
471
+ language: "json",
472
+ comments: "The audio recording speech segments (who spoke when). Note that speakersTimeline and mediaChannelId are mutually exclusive, when providing speakersTimeline - mediaChannelId will not be used.",
473
+ example: JSON.stringify({
474
+ precise: true,
475
+ speechSegments: [{
476
+ fromTime: 5100,
477
+ toTime: 24e3,
478
+ partyIds: ["1"]
479
+ }]
480
+ }, null, 2),
481
+ clean: jsonInputClean,
482
+ required: false
483
+ });
484
+ const meetingUrl = (0, _prismatic_io_spectral.input)({
485
+ label: "Meeting URL",
486
+ type: "string",
487
+ required: false,
488
+ clean: toOptionalString,
489
+ comments: "The URL of the conference call by which users join the meeting",
490
+ example: "https://example.com/meeting/john.smith",
491
+ placeholder: "https://example.com/meeting"
492
+ });
493
+ const callProviderCode = (0, _prismatic_io_spectral.input)({
494
+ label: "Call Provider Code",
495
+ type: "string",
496
+ required: false,
497
+ clean: toOptionalString,
498
+ comments: "The code identifies the provider conferencing or telephony system. For example: zoom, clearslide, gotomeeting, ringcentral, outreach, insidesales, etc. These values are predefined by Gong, please contact help@gong.io to find the proper value for your system.",
499
+ example: "clearslide",
500
+ placeholder: "Enter provider code"
501
+ });
502
+ const downloadMediaUrl = (0, _prismatic_io_spectral.input)({
503
+ label: "Download Media URL",
504
+ type: "string",
505
+ required: false,
506
+ clean: toOptionalString,
507
+ comments: "The URL from which Gong can download the media file. The URL must be unique, the audio or video file must be a maximum of 1.5GB. If you provide this URL, you should not perform the 'Add call media' step.",
508
+ example: "https://example.com/media/sample-call.mp3",
509
+ placeholder: "https://example.com/media.mp3"
510
+ });
511
+ const languageCode = (0, _prismatic_io_spectral.input)({
512
+ label: "Language Code",
513
+ type: "string",
514
+ required: false,
515
+ clean: toOptionalString,
516
+ comments: "The language code the call should be transcribed to. This field is optional as Gong automatically detects the language spoken in the call and transcribes it accordingly. Set this field only if you are sure of the language the call is in. Valid values are: af-ZA, am-ET, ar-AE, ar-BH, ar-DZ, ar-EG, ar-IL, ar-IQ, ar-JO, ar-KW, ar-LB, ar-MA, ar-MR, ar-OM, ar-PS, ar-QA, ar-SA, ar-TN, ar-YE, az-AZ, bg-BG, bn-BD, bn-IN, bs-BA, ca-ES, cs-CZ, da-DK, de-AT, de-CH, de-DE, el-GR, en-AB, en-AU, en-CA, en-GB, en-IE, en-IN, en-NZ, en-PH, en-SG, en-US, en-WL, en-ZA, es-AR, es-BO, es-CL, es-CO, es-CR, es-DO, es-EC, es-ES, es-GT, es-HN, es-MX, es-NI, es-PA, es-PE, es-PR, es-PY, es-SV, es-US, es-UY, et-EE, eu-ES, fa-IR, fi-FI, fil-PH, fr-BE, fr-CA, fr-CH, fr-FR, gl-ES, gu-IN, he-IL, hi-IN, hr-HR, hu-HU, hy-AM, id-ID, is-IS, it-CH, it-IT, ja-JP, jv-ID, ka-GE, kk-KZ, km-KH, kn-IN, ko-KR, lo-LA, lt-LT, lv-LV, mk-MK, ml-IN, mn-MN, mr-IN, ms-MY, my-MM, ne-NP, nl-BE, nl-NL, no-NO, pa-Guru-IN, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, si-LK, sk-SK, sl-SI, sq-AL, sr-RS, su-ID, sv-SE, sw-KE, sw-TZ, ta-IN, ta-LK, ta-MY, ta-SG, te-IN, th-TH, tr-TR, uk-UA, ur-IN, ur-PK, uz-UZ, vi-VN, yue-Hant-HK, zh-CN, zh-TW, zu-ZA",
517
+ example: "en-US",
518
+ placeholder: "en-US"
519
+ });
520
+ const primaryUser = (0, _prismatic_io_spectral.input)({
521
+ label: "Primary User",
522
+ type: "string",
523
+ required: true,
524
+ clean: _prismatic_io_spectral.util.types.toString,
525
+ comments: "The Gong internal user ID of the team member who hosted the call.",
526
+ example: "234599484848423",
527
+ placeholder: "Enter user ID"
528
+ });
529
+ const fileInput = (0, _prismatic_io_spectral.input)({
530
+ label: "File",
531
+ type: "data",
532
+ required: true,
533
+ clean: _prismatic_io_spectral.util.types.toData,
534
+ example: "Some binary file"
535
+ });
536
+ const fileName = (0, _prismatic_io_spectral.input)({
537
+ label: "File Name",
538
+ type: "string",
539
+ required: true,
540
+ comments: "The name of the file",
541
+ clean: _prismatic_io_spectral.util.types.toString,
542
+ example: "some-file-name.txt",
543
+ placeholder: "Enter file name"
544
+ });
545
+ const callIds = (0, _prismatic_io_spectral.input)({
546
+ label: "Call Ids",
547
+ type: "string",
548
+ collection: "valuelist",
549
+ required: false,
550
+ comments: "List of calls Ids to be filtered. If not supplied, returns all calls between fromDateTime and toDateTime.",
551
+ default: ["000xxx"],
552
+ clean: valueListInputClean,
553
+ example: "7782342274025937895",
554
+ dataSource: "calls"
555
+ });
556
+ const includeAvatars = (0, _prismatic_io_spectral.input)({
557
+ label: "Include Avatars",
558
+ type: "boolean",
559
+ required: false,
560
+ clean: _prismatic_io_spectral.util.types.toBool,
561
+ comments: "Avatars are synthetic users representing Gong employees (CSMs and support providers) when they access your instance. References to avatars' IDs may be found in the outputs of other API endpoints. This parameter is optional, if not provided avatars will not be included in the results.",
562
+ example: "false"
563
+ });
564
+ const invitees = (0, _prismatic_io_spectral.input)({
565
+ label: "Invitees",
566
+ type: "code",
567
+ language: "json",
568
+ comments: "A list of email addresses of invitees to the event (not including the organizer).",
569
+ example: JSON.stringify([{
570
+ displayName: "Cookie Monster",
571
+ email: "cookie.monster@cookies.com"
572
+ }], null, 2),
573
+ clean: jsonInputClean,
574
+ required: true
575
+ });
576
+ const externalId = (0, _prismatic_io_spectral.input)({
577
+ label: "External ID",
578
+ type: "string",
579
+ required: false,
580
+ clean: toOptionalString,
581
+ comments: "The ID as it is formed on the external system.",
582
+ example: "7JEHFRGXDDZFEW2FC4U",
583
+ placeholder: "Enter external ID"
584
+ });
585
+ const organizerEmail = (0, _prismatic_io_spectral.input)({
586
+ label: "Organizer Email",
587
+ type: "string",
588
+ required: true,
589
+ clean: _prismatic_io_spectral.util.types.toString,
590
+ comments: "The email address of the user creating the meeting, the Gong consent page link will be used according to the settings of this user.",
591
+ example: "test@test.com",
592
+ placeholder: "user@company.com"
593
+ });
594
+ const meetingId = (0, _prismatic_io_spectral.input)({
595
+ label: "Meeting ID",
596
+ type: "string",
597
+ required: true,
598
+ clean: _prismatic_io_spectral.util.types.toString,
599
+ comments: "Gong's unique identifier for the meeting (up to 20 digits).",
600
+ example: "7782342274025937895",
601
+ placeholder: "Enter meeting ID"
602
+ });
603
+ const logType = (0, _prismatic_io_spectral.input)({
604
+ label: "Log Type",
605
+ type: "string",
606
+ comments: "Type of logs requested.",
607
+ clean: _prismatic_io_spectral.util.types.toString,
608
+ model: [
609
+ {
610
+ label: "AccessLog",
611
+ value: "AccessLog"
612
+ },
613
+ {
614
+ label: "UserActivityLog",
615
+ value: "UserActivityLog"
616
+ },
617
+ {
618
+ label: "UserCallPlay",
619
+ value: "UserCallPlay"
620
+ },
621
+ {
622
+ label: "ExternallySharedCallAccess",
623
+ value: "ExternallySharedCallAccess"
624
+ },
625
+ {
626
+ label: "ExternallySharedCallPlay",
627
+ value: "ExternallySharedCallPlay"
628
+ }
629
+ ],
630
+ required: true
631
+ });
632
+ const emailAddress = (0, _prismatic_io_spectral.input)({
633
+ label: "Email Address",
634
+ type: "string",
635
+ required: true,
636
+ clean: _prismatic_io_spectral.util.types.toString,
637
+ comments: "The email address.",
638
+ example: "test@test.com",
639
+ placeholder: "user@company.com"
640
+ });
641
+ const phoneNumber = (0, _prismatic_io_spectral.input)({
642
+ label: "Phone Number",
643
+ type: "string",
644
+ required: true,
645
+ clean: _prismatic_io_spectral.util.types.toString,
646
+ comments: "The phone number. This number must start with a + (plus) sign followed by the country code, area code, and local phone number. All other non-digits are ignored. The following are examples of permitted phone numbers: +1 425 555 2671, +1-425-555-2671, +1 425 5552671, +14255552671, +1 425 555 26 71, +1(425) 555-2671, etc.",
647
+ example: "+1 425 555 2671",
648
+ placeholder: "+1 425 555 2671"
649
+ });
650
+ const reportingSystem = (0, _prismatic_io_spectral.input)({
651
+ label: "Reporting System",
652
+ type: "string",
653
+ required: true,
654
+ clean: _prismatic_io_spectral.util.types.toString,
655
+ comments: "The unique identifier of the reporting system. It is the same value in all events originating from the same system.",
656
+ example: "abc123",
657
+ placeholder: "Enter system ID"
658
+ });
659
+ const eventTimestamp = (0, _prismatic_io_spectral.input)({
660
+ label: "Event Timestamp",
661
+ type: "string",
662
+ required: true,
663
+ clean: _prismatic_io_spectral.util.types.toString,
664
+ comments: "The date and time when the event happened in the ISO-8601 format (e.g., '2021-08-01T02:30:00+05:00' or '2021-08-01T08:00:00Z', where Z stands for UTC);",
665
+ example: "2018-02-18T02:30:00-07:00",
666
+ placeholder: "2018-02-18T02:30:00-07:00"
667
+ });
668
+ const eventId = (0, _prismatic_io_spectral.input)({
669
+ label: "Event Id",
670
+ type: "string",
671
+ required: false,
672
+ clean: _prismatic_io_spectral.util.types.toString,
673
+ comments: "The original id of the event as designated in the reporting system.",
674
+ example: "7782342274025932395",
675
+ placeholder: "Enter event ID"
676
+ });
677
+ const contentId = (0, _prismatic_io_spectral.input)({
678
+ label: "Content Id",
679
+ type: "string",
680
+ required: false,
681
+ clean: _prismatic_io_spectral.util.types.toString,
682
+ comments: "The id of the content that was viewed in the reporting system.",
683
+ example: "7782342223025937895",
684
+ placeholder: "Enter content ID"
685
+ });
686
+ const contentUrl = (0, _prismatic_io_spectral.input)({
687
+ label: "Content Url",
688
+ type: "string",
689
+ required: false,
690
+ clean: _prismatic_io_spectral.util.types.toString,
691
+ comments: "The url of the content that was viewed in the reporting system. This is the url that is was accessed by the viewer.",
692
+ example: "https://example.com/doc_123456789",
693
+ placeholder: "https://example.com/document"
694
+ });
695
+ const contentTitle = (0, _prismatic_io_spectral.input)({
696
+ label: "Content Title",
697
+ type: "string",
698
+ required: false,
699
+ clean: _prismatic_io_spectral.util.types.toString,
700
+ comments: "Human readable title of the content.",
701
+ example: "Features & Spec V.1",
702
+ placeholder: "Enter content title"
703
+ });
704
+ const shareInfoUrl = (0, _prismatic_io_spectral.input)({
705
+ label: "Share Info Url",
706
+ type: "string",
707
+ required: false,
708
+ clean: _prismatic_io_spectral.util.types.toString,
709
+ comments: "The link to a page that presents additional information about this event.",
710
+ example: "https://example.com/path/to/a/page",
711
+ placeholder: "https://example.com/info"
712
+ });
713
+ const actionName = (0, _prismatic_io_spectral.input)({
714
+ label: "Action Name",
715
+ type: "string",
716
+ required: false,
717
+ clean: _prismatic_io_spectral.util.types.toString,
718
+ comments: "The name of the action like 'Document Viewed' or 'Presentation Opened'.",
719
+ example: "Document Viewed",
720
+ placeholder: "Enter action name"
721
+ });
722
+ const eventInfoUrl = (0, _prismatic_io_spectral.input)({
723
+ label: "Event Info Url",
724
+ type: "string",
725
+ required: false,
726
+ clean: _prismatic_io_spectral.util.types.toString,
727
+ comments: "The link to a page that presents additional information about this event.",
728
+ example: "https://example.com/path/to/a/page",
729
+ placeholder: "https://example.com/event"
730
+ });
731
+ const userAgent = (0, _prismatic_io_spectral.input)({
732
+ label: "User Agent",
733
+ type: "string",
734
+ required: false,
735
+ clean: _prismatic_io_spectral.util.types.toString,
736
+ comments: "'User-Agent' header value for browser based interaction",
737
+ example: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
738
+ placeholder: "Mozilla/5.0 (compatible; Browser)"
739
+ });
740
+ const mobileAppId = (0, _prismatic_io_spectral.input)({
741
+ label: "Mobile App Id",
742
+ type: "string",
743
+ required: false,
744
+ clean: _prismatic_io_spectral.util.types.toString,
745
+ comments: "The application identification string in case of interaction via mobile application (bundle identifier or package name).",
746
+ example: "com.example.app",
747
+ placeholder: "com.yourcompany.app"
748
+ });
749
+ const moreInfoUrl = (0, _prismatic_io_spectral.input)({
750
+ label: "More Info Url",
751
+ type: "string",
752
+ required: false,
753
+ clean: _prismatic_io_spectral.util.types.toString,
754
+ example: "https://example.com/path/to/a/page",
755
+ placeholder: "https://example.com/info"
756
+ });
757
+ const shareId = (0, _prismatic_io_spectral.input)({
758
+ label: "Share Id",
759
+ type: "string",
760
+ required: false,
761
+ clean: _prismatic_io_spectral.util.types.toString,
762
+ example: "7782342223025937895",
763
+ placeholder: "Enter share ID"
764
+ });
765
+ const sharingMessageSubject = (0, _prismatic_io_spectral.input)({
766
+ label: "Sharing Message Subject",
767
+ type: "string",
768
+ required: false,
769
+ clean: _prismatic_io_spectral.util.types.toString,
770
+ comments: "The subject of share email / message.",
771
+ example: "Check out this document",
772
+ placeholder: "Enter message subject"
773
+ });
774
+ const sharingMessageBody = (0, _prismatic_io_spectral.input)({
775
+ label: "Sharing Message Body",
776
+ type: "string",
777
+ required: false,
778
+ clean: _prismatic_io_spectral.util.types.toString,
779
+ comments: "The share message body. Can contain HTML and will be cleaned when it is presented.",
780
+ example: "Check out this document",
781
+ placeholder: "Enter message body"
782
+ });
783
+ const actor = (0, _prismatic_io_spectral.input)({
784
+ label: "Actor",
785
+ type: "code",
786
+ language: "json",
787
+ example: JSON.stringify({
788
+ email: "test@test.com",
789
+ name: "Test User",
790
+ title: "Enterprise Account Executive",
791
+ context: [{
792
+ system: "Salesforce",
793
+ objects: [{
794
+ objectType: "Contact",
795
+ objectId: "0013601230sV7grAAC",
796
+ fields: [{
797
+ name: "name",
798
+ value: "Gong Inc."
799
+ }]
800
+ }]
801
+ }]
802
+ }, null, 2),
803
+ clean: jsonInputClean,
804
+ required: false
805
+ });
806
+ const crmContext = (0, _prismatic_io_spectral.input)({
807
+ label: "CRM Context",
808
+ type: "code",
809
+ language: "json",
810
+ example: JSON.stringify([{
811
+ system: "Salesforce",
812
+ objects: [{
813
+ objectType: "Account",
814
+ objectId: "0013601230sV7grAAC",
815
+ fields: [{
816
+ name: "name",
817
+ value: "Gong Inc."
818
+ }]
819
+ }]
820
+ }], null, 2),
821
+ clean: jsonInputClean,
822
+ required: false
823
+ });
824
+ const contentProperties = (0, _prismatic_io_spectral.input)({
825
+ label: "Content Properties",
826
+ type: "code",
827
+ language: "json",
828
+ example: JSON.stringify([{
829
+ name: "string",
830
+ value: "string",
831
+ dataType: "string"
832
+ }], null, 2),
833
+ clean: jsonInputClean,
834
+ required: false
835
+ });
836
+ const eventProperties = (0, _prismatic_io_spectral.input)({
837
+ label: "Event Properties",
838
+ type: "code",
839
+ language: "json",
840
+ example: JSON.stringify([{
841
+ name: "string",
842
+ value: "string",
843
+ dataType: "string"
844
+ }], null, 2),
845
+ clean: jsonInputClean,
846
+ required: false
847
+ });
848
+ const nonCompanyParticipants = (0, _prismatic_io_spectral.input)({
849
+ label: "Non Company Participants",
850
+ type: "code",
851
+ language: "json",
852
+ example: JSON.stringify([{
853
+ email: "test@test.com",
854
+ name: "Test User",
855
+ title: "Enterprise Account Executive",
856
+ context: [{
857
+ system: "Salesforce",
858
+ objects: [{
859
+ objectType: "Contact",
860
+ objectId: "0013601230sV7grAAC",
861
+ fields: [{
862
+ name: "name",
863
+ value: "Gong Inc."
864
+ }]
865
+ }]
866
+ }]
867
+ }], null, 2),
868
+ clean: jsonInputClean,
869
+ required: false
870
+ });
871
+ const sharer = (0, _prismatic_io_spectral.input)({
872
+ label: "Sharer",
873
+ type: "code",
874
+ language: "json",
875
+ example: JSON.stringify({
876
+ id: "234599484848423",
877
+ email: "test@test.com",
878
+ name: "Test User"
879
+ }),
880
+ clean: jsonInputClean,
881
+ required: false
882
+ });
883
+ const recipients = (0, _prismatic_io_spectral.input)({
884
+ label: "Recipients",
885
+ type: "code",
886
+ language: "json",
887
+ example: JSON.stringify([{
888
+ email: "test@test.com",
889
+ name: "Test User",
890
+ title: "Enterprise Account Executive",
891
+ context: [{
892
+ system: "Salesforce",
893
+ objects: [{
894
+ objectType: "Contact",
895
+ objectId: "0013601230sV7grAAC",
896
+ fields: [{
897
+ name: "name",
898
+ value: "Gong Inc."
899
+ }]
900
+ }]
901
+ }]
902
+ }], null, 2),
903
+ clean: jsonInputClean,
904
+ required: false
905
+ });
906
+ const agentPlatform = (0, _prismatic_io_spectral.input)({
907
+ label: "Agent Platform",
908
+ type: "string",
909
+ comments: "Platform on which the interaction was made",
910
+ clean: _prismatic_io_spectral.util.types.toString,
911
+ model: [
912
+ {
913
+ label: "Windows",
914
+ value: "Windows"
915
+ },
916
+ {
917
+ label: "Linux",
918
+ value: "Linux"
919
+ },
920
+ {
921
+ label: "MacOS",
922
+ value: "MacOS"
923
+ },
924
+ {
925
+ label: "iOS",
926
+ value: "iOS"
927
+ },
928
+ {
929
+ label: "Android",
930
+ value: "Android"
931
+ }
932
+ ],
933
+ required: false,
934
+ example: "Windows"
935
+ });
936
+ const viewActionTitle = (0, _prismatic_io_spectral.input)({
937
+ label: "View Action Title",
938
+ type: "string",
939
+ required: false,
940
+ clean: _prismatic_io_spectral.util.types.toString,
941
+ comments: "The name of the action like 'Document Viewed' or 'Presentation Opened'.",
942
+ example: "Document Viewed",
943
+ placeholder: "Enter action title"
944
+ });
945
+ const viewInfoUrl = (0, _prismatic_io_spectral.input)({
946
+ label: "View Info URL",
947
+ type: "string",
948
+ required: false,
949
+ clean: _prismatic_io_spectral.util.types.toString,
950
+ comments: "The link to a page that presents additional information about this event.",
951
+ example: "https://example.com/path/to/a/page",
952
+ placeholder: "https://example.com/info"
953
+ });
954
+ const viewer = (0, _prismatic_io_spectral.input)({
955
+ label: "Viewer",
956
+ type: "code",
957
+ language: "json",
958
+ example: JSON.stringify({
959
+ email: "test@test.com",
960
+ name: "Test User",
961
+ title: "Enterprise Account Executive",
962
+ context: [{
963
+ system: "Salesforce",
964
+ objects: [{
965
+ objectType: "Contact",
966
+ objectId: "0013601230sV7grAAC",
967
+ fields: [{
968
+ name: "name",
969
+ value: "Gong Inc."
970
+ }]
971
+ }]
972
+ }]
973
+ }, null, 2),
974
+ clean: jsonInputClean,
975
+ required: false
976
+ });
977
+ const pollResourceType = (0, _prismatic_io_spectral.input)({
978
+ label: "Resource Type",
979
+ type: "string",
980
+ required: true,
981
+ comments: "The type of resource to poll for new records.",
982
+ model: pollResourceModel,
983
+ clean: _prismatic_io_spectral.util.types.toString
984
+ });
985
+ const lookBackDate = (0, _prismatic_io_spectral.input)({
986
+ label: "Look-back Date",
987
+ placeholder: "Enter look-back date (YYYY-MM-DD)",
988
+ type: "string",
989
+ required: false,
990
+ comments: "The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each call started on or after this date once, ignoring the visibility filters. Applies to the Calls resource only.",
991
+ example: "2026-01-01",
992
+ clean: lookBackDateClean
993
+ });
994
+ const showNewRecords = (0, _prismatic_io_spectral.input)({
995
+ label: "Show New Records",
996
+ type: "boolean",
997
+ required: true,
998
+ default: "true",
999
+ comments: "Include newly created records in trigger results.",
1000
+ clean: _prismatic_io_spectral.util.types.toBool
1001
+ });
1002
+ //#endregion
1003
+ //#region src/actions/calls/addMedia.ts
1004
+ const addMedia = (0, _prismatic_io_spectral.action)({
1005
+ display: {
1006
+ label: "Add Call Media",
1007
+ description: "Adds a call media, recorded by a telephony system (PBX) or other media recording facility."
1008
+ },
1009
+ inputs: {
1010
+ connection,
1011
+ callId: {
1012
+ ...callId,
1013
+ comments: "callId returned from 'Add New Call' request"
1014
+ },
1015
+ fileInput: {
1016
+ ...fileInput,
1017
+ comments: "The media file of the recording. You may attach files up to 1.5GB in size."
1018
+ },
1019
+ fileName
1020
+ },
1021
+ perform: async (context, { connection, callId, fileInput, fileName }) => {
1022
+ const client = createClient(connection, context.debug.enabled);
1023
+ const { data: fileData, contentType } = fileInput;
1024
+ const formData = new form_data.default();
1025
+ formData.append("mediaFile", fileData, {
1026
+ contentType,
1027
+ filename: fileName
1028
+ });
1029
+ const { data } = await client.put(`/v2/calls/${callId}/media`, formData.getBuffer(), { headers: formData.getHeaders() });
1030
+ return { data };
1031
+ },
1032
+ examplePayload: { data: {
1033
+ requestId: "4al018gzaztcr8nbukw",
1034
+ message: "Media file uploaded successfully"
1035
+ } }
1036
+ });
1037
+ //#endregion
1038
+ //#region src/actions/calls/create.ts
1039
+ const createNewCall = (0, _prismatic_io_spectral.action)({
1040
+ display: {
1041
+ label: "Create New Call",
1042
+ description: "When using this endpoint, either provide a downloadMediaUrl or use the returned callId in a follow-up request to /v2/calls/[id]/media to upload the media file."
1043
+ },
1044
+ perform: async (context, { connection, ...params }) => {
1045
+ const { data } = await createClient(connection, context.debug.enabled).post(`/v2/calls/`, params);
1046
+ return { data };
1047
+ },
1048
+ inputs: {
1049
+ connection,
1050
+ clientUniqueId,
1051
+ primaryUser,
1052
+ parties,
1053
+ direction,
1054
+ actualStart,
1055
+ scheduledStart,
1056
+ scheduledEnd,
1057
+ title,
1058
+ purpose,
1059
+ duration,
1060
+ disposition,
1061
+ contextParam: context,
1062
+ customData,
1063
+ speakersTimeline,
1064
+ meetingUrl,
1065
+ callProviderCode,
1066
+ downloadMediaUrl,
1067
+ workspaceId,
1068
+ languageCode
1069
+ },
1070
+ examplePayload: { data: {
1071
+ requestId: "4al018gzaztcr8nbukw",
1072
+ callId: "7782342274025937895",
1073
+ url: "https://app.gong.io/call?id=7782342274025937895"
1074
+ } }
1075
+ });
1076
+ //#endregion
1077
+ //#region src/actions/calls/get.ts
1078
+ const getCallUsingGet = (0, _prismatic_io_spectral.action)({
1079
+ display: {
1080
+ label: "Get Call",
1081
+ description: "Retrieve data for a specific call (/v2/calls/[id])"
1082
+ },
1083
+ perform: async (context, { connection, callId }) => {
1084
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/calls/${callId}`);
1085
+ return { data };
1086
+ },
1087
+ inputs: {
1088
+ connection,
1089
+ callId
1090
+ },
1091
+ examplePayload: { data: {
1092
+ requestId: "4al018gzaztcr8nbukw",
1093
+ call: {
1094
+ id: "7782342274025937895",
1095
+ url: "https://app.gong.io/call?id=7782342274025937895",
1096
+ title: "Example call",
1097
+ scheduled: 1518863400,
1098
+ started: 1518863400,
1099
+ duration: 460,
1100
+ primaryUserId: "234599484848423",
1101
+ direction: "Inbound",
1102
+ system: "Outreach",
1103
+ scope: "Internal",
1104
+ media: "Video",
1105
+ language: "eng",
1106
+ workspaceId: "623457276584334",
1107
+ sdrDisposition: "Got the gatekeeper",
1108
+ clientUniqueId: "7JEHFRGXDDZFEW2FC4U",
1109
+ customData: "Conference Call",
1110
+ purpose: "Demo Call",
1111
+ meetingUrl: "https://zoom.us/j/123",
1112
+ isPrivate: false,
1113
+ calendarEventId: "abcde@google.com"
1114
+ }
1115
+ } }
1116
+ });
1117
+ //#endregion
1118
+ //#region src/actions/calls/getTranscript.ts
1119
+ const getCallTranscript = (0, _prismatic_io_spectral.action)({
1120
+ display: {
1121
+ label: "Get Call Transcript",
1122
+ description: "Returns transcripts for calls that took place during the specified date period."
1123
+ },
1124
+ perform: async (context, { connection, cursor, fromDateTime, toDateTime, workspaceId, callIds }) => {
1125
+ const { data } = await createClient(connection, context.debug.enabled).post(`/v2/calls/transcript`, {
1126
+ cursor,
1127
+ filter: {
1128
+ fromDateTime,
1129
+ toDateTime,
1130
+ workspaceId,
1131
+ callIds
1132
+ }
1133
+ });
1134
+ return { data };
1135
+ },
1136
+ inputs: {
1137
+ connection,
1138
+ cursor,
1139
+ fromDateTime: {
1140
+ ...fromDateTime,
1141
+ required: false
1142
+ },
1143
+ toDateTime: {
1144
+ ...toDateTime,
1145
+ required: false
1146
+ },
1147
+ workspaceId,
1148
+ callIds
1149
+ },
1150
+ examplePayload: { data: {
1151
+ requestId: "4al018gzaztcr8nbukw",
1152
+ records: {
1153
+ totalRecords: 263,
1154
+ currentPageSize: 100,
1155
+ currentPageNumber: 0,
1156
+ cursor: "eyJhbGciOiJIUzI1NiJ9.eyJjYWxsSWQiM1M30.6qKwpOcvnuweTZmFRzYdtjs_YwJphJU4QIwWFM"
1157
+ },
1158
+ callTranscripts: [{
1159
+ callId: "7782342274025937895",
1160
+ transcript: [{
1161
+ speakerId: "6432345678555530067",
1162
+ topic: "Objections",
1163
+ sentences: [{
1164
+ start: 460230,
1165
+ end: 462343,
1166
+ text: "No wait, I think we should check that out first."
1167
+ }]
1168
+ }]
1169
+ }]
1170
+ } }
1171
+ });
1172
+ //#endregion
1173
+ //#region src/actions/calls/index.ts
1174
+ var calls_default = {
1175
+ listCallsUsingGet: (0, _prismatic_io_spectral.action)({
1176
+ display: {
1177
+ label: "List Calls",
1178
+ description: "Retrieve call data by date range (/v2/calls)"
1179
+ },
1180
+ perform: async (context, { connection, cursor, fromDateTime, toDateTime, workspaceId }) => {
1181
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/calls`, { params: {
1182
+ cursor,
1183
+ fromDateTime,
1184
+ toDateTime,
1185
+ workspaceId
1186
+ } });
1187
+ return { data };
1188
+ },
1189
+ inputs: {
1190
+ connection,
1191
+ cursor,
1192
+ fromDateTime,
1193
+ toDateTime,
1194
+ workspaceId
1195
+ },
1196
+ examplePayload: { data: {
1197
+ requestId: "4al018gzaztcr8nbukw",
1198
+ records: {
1199
+ totalRecords: 263,
1200
+ currentPageSize: 100,
1201
+ currentPageNumber: 0,
1202
+ cursor: "eyJhbGciOiJIUzI1NiJ9.eyJjYWxsSWQiM1M30.6qKwpOcvnuweTZmFRzYdtjs_YwJphJU4QIwWFM"
1203
+ },
1204
+ calls: [{
1205
+ id: "7782342274025937895",
1206
+ url: "https://app.gong.io/call?id=7782342274025937895",
1207
+ title: "Example call",
1208
+ scheduled: 1518863400,
1209
+ started: 1518863400,
1210
+ duration: 460,
1211
+ primaryUserId: "234599484848423",
1212
+ direction: "Inbound",
1213
+ system: "Outreach",
1214
+ scope: "Internal",
1215
+ media: "Video",
1216
+ language: "eng",
1217
+ workspaceId: "623457276584334",
1218
+ sdrDisposition: "Got the gatekeeper",
1219
+ clientUniqueId: "7JEHFRGXDDZFEW2FC4U",
1220
+ customData: "Conference Call",
1221
+ purpose: "Demo Call",
1222
+ meetingUrl: "https://zoom.us/j/123",
1223
+ isPrivate: false,
1224
+ calendarEventId: "abcde@google.com"
1225
+ }]
1226
+ } }
1227
+ }),
1228
+ getCallUsingGet,
1229
+ createNewCall,
1230
+ addMedia,
1231
+ getCallTranscript
1232
+ };
1233
+ //#endregion
1234
+ //#region src/actions/engagement/index.ts
1235
+ var engagement_default = {
1236
+ customActionEvent: (0, _prismatic_io_spectral.action)({
1237
+ display: {
1238
+ label: "Custom Action Event",
1239
+ description: "Push engagement events into Gong and display them as events in Gong's activity timeline, when a content is engaged by an external participant (for example, a contract was 'signed' by the prospect)"
1240
+ },
1241
+ perform: async (context, { connection, ...params }) => {
1242
+ const { data } = await createClient(connection, context.debug.enabled).put(`/v2/customer-engagement/action`, params);
1243
+ return { data };
1244
+ },
1245
+ inputs: {
1246
+ connection,
1247
+ reportingSystem,
1248
+ eventTimestamp,
1249
+ eventId,
1250
+ contentId,
1251
+ contentUrl,
1252
+ contentTitle,
1253
+ actionName,
1254
+ eventInfoUrl,
1255
+ actor,
1256
+ crmContext,
1257
+ contentProperties,
1258
+ eventProperties,
1259
+ userAgent,
1260
+ mobileAppId,
1261
+ agentPlatform,
1262
+ workspaceId,
1263
+ nonCompanyParticipants,
1264
+ moreInfoUrl,
1265
+ shareId,
1266
+ sharer,
1267
+ sharingMessageSubject,
1268
+ sharingMessageBody
1269
+ },
1270
+ examplePayload: { data: {
1271
+ requestId: "4al018gzaztcr8nbukw",
1272
+ integrationId: 55170271882342
1273
+ } }
1274
+ }),
1275
+ customSharedEvent: (0, _prismatic_io_spectral.action)({
1276
+ display: {
1277
+ label: "Custom Shared Event",
1278
+ description: "Push engagement events into Gong and display them as events in Gong’s activity timeline, when a Gong user shares content with external participants (for example, a contract was “shared” by the account executive with his prospects)"
1279
+ },
1280
+ perform: async (context, { connection, ...params }) => {
1281
+ const { data } = await createClient(connection, context.debug.enabled).put(`/v2/customer-engagement/content/shared`, params);
1282
+ return { data };
1283
+ },
1284
+ inputs: {
1285
+ connection,
1286
+ reportingSystem,
1287
+ eventTimestamp,
1288
+ eventId,
1289
+ contentId: {
1290
+ ...contentId,
1291
+ required: true,
1292
+ comments: "The id of the content that was shared in the reporting system."
1293
+ },
1294
+ contentUrl: {
1295
+ ...contentUrl,
1296
+ required: true,
1297
+ comments: "The url of the content that was shared in the reporting system. This is the url that is was accessed by the viewer."
1298
+ },
1299
+ contentTitle: {
1300
+ ...contentTitle,
1301
+ required: true,
1302
+ comments: "Human readable title of the content."
1303
+ },
1304
+ shareId,
1305
+ shareInfoUrl,
1306
+ sharingMessageSubject,
1307
+ sharingMessageBody,
1308
+ sharer,
1309
+ recipients,
1310
+ crmContext,
1311
+ contentProperties,
1312
+ eventProperties,
1313
+ workspaceId,
1314
+ actionName,
1315
+ nonCompanyParticipants,
1316
+ moreInfoUrl,
1317
+ mobileAppId,
1318
+ agentPlatform,
1319
+ userAgent
1320
+ },
1321
+ examplePayload: { data: {
1322
+ requestId: "4al018gzaztcr8nbukw",
1323
+ integrationId: 55170271882342
1324
+ } }
1325
+ }),
1326
+ customViewedEvent: (0, _prismatic_io_spectral.action)({
1327
+ display: {
1328
+ label: "Custom Viewed Event",
1329
+ description: "Push engagement events into Gong and display them as events in Gong's activity timeline, when a Gong user shares content with external participants (for example, a contract was “shared” by the account executive with his prospects)"
1330
+ },
1331
+ perform: async (context, { connection, ...params }) => {
1332
+ const { data } = await createClient(connection, context.debug.enabled).put(`/v2/customer-engagement/content/viewed`, params);
1333
+ return { data };
1334
+ },
1335
+ inputs: {
1336
+ connection,
1337
+ reportingSystem,
1338
+ eventTimestamp,
1339
+ eventId,
1340
+ contentId: {
1341
+ ...contentId,
1342
+ required: true,
1343
+ comments: "The id of the content that was shared in the reporting system."
1344
+ },
1345
+ contentUrl: {
1346
+ ...contentUrl,
1347
+ required: true,
1348
+ comments: "The url of the content that was shared in the reporting system. This is the url that is was accessed by the viewer."
1349
+ },
1350
+ contentTitle: {
1351
+ ...contentTitle,
1352
+ required: true,
1353
+ comments: "Human readable title of the content."
1354
+ },
1355
+ viewActionTitle,
1356
+ shareId,
1357
+ viewInfoUrl,
1358
+ viewer,
1359
+ crmContext,
1360
+ contentProperties,
1361
+ eventProperties,
1362
+ userAgent,
1363
+ mobileAppId,
1364
+ agentPlatform,
1365
+ workspaceId,
1366
+ nonCompanyParticipants,
1367
+ moreInfoUrl,
1368
+ actionName,
1369
+ sharer,
1370
+ sharingMessageSubject,
1371
+ sharingMessageBody
1372
+ },
1373
+ examplePayload: { data: {
1374
+ requestId: "4al018gzaztcr8nbukw",
1375
+ integrationId: 55170271882342
1376
+ } }
1377
+ })
1378
+ };
1379
+ //#endregion
1380
+ //#region src/actions/folders/listCallsInFolders.ts
1381
+ const listCallsInFolder = (0, _prismatic_io_spectral.action)({
1382
+ display: {
1383
+ label: "List Calls in Folder",
1384
+ description: "Given a folder id, this endpoint retrieves a list of calls in it."
1385
+ },
1386
+ perform: async (context, { connection, folderId }) => {
1387
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/library/folder-content`, { params: { folderId } });
1388
+ return { data };
1389
+ },
1390
+ inputs: {
1391
+ connection,
1392
+ workspaceId,
1393
+ folderId
1394
+ },
1395
+ examplePayload: { data: {
1396
+ requestId: "4al018gzaztcr8nbukw",
1397
+ id: "3843152912968920037",
1398
+ name: "Sales Onboarding",
1399
+ createdBy: "234599484848423",
1400
+ updated: 1584192600,
1401
+ calls: [{
1402
+ id: "7782342274025937895",
1403
+ title: "Example call",
1404
+ note: "sample note",
1405
+ addedBy: "234599484848423",
1406
+ created: 1578868200,
1407
+ url: "https://app.gong.io/call?id=3636865806219496180&highlights=%5B%7B%22to%22%3A+3240%2C+%22from%22%3A+1200%2C+%22type%22%3A+%22LIBRARY%22%7D%5D",
1408
+ snippet: {
1409
+ fromSec: 21,
1410
+ toSec: 132
1411
+ }
1412
+ }]
1413
+ } }
1414
+ });
1415
+ //#endregion
1416
+ //#region src/actions/folders/index.ts
1417
+ var folders_default = {
1418
+ listLibraryFolders: (0, _prismatic_io_spectral.action)({
1419
+ display: {
1420
+ label: "List Library Folders",
1421
+ description: "Use this endpoint to retrieve a list of public library folders."
1422
+ },
1423
+ perform: async (context, { connection, workspaceId }) => {
1424
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/library/folders`, { params: { workspaceId } });
1425
+ return { data };
1426
+ },
1427
+ inputs: {
1428
+ connection,
1429
+ workspaceId
1430
+ },
1431
+ examplePayload: { data: {
1432
+ requestId: "4al018gzaztcr8nbukw",
1433
+ folders: [{
1434
+ id: "3843152912968920037",
1435
+ name: "Sales Onboarding",
1436
+ parentFolderId: "295738305212375930",
1437
+ createdBy: "234599484848423",
1438
+ updated: 1584192600
1439
+ }]
1440
+ } }
1441
+ }),
1442
+ listCallsInFolder
1443
+ };
1444
+ //#endregion
1445
+ //#region src/actions/listWorkspaces.ts
1446
+ const listWorkspaces = (0, _prismatic_io_spectral.action)({
1447
+ display: {
1448
+ label: "List Workspaces",
1449
+ description: "Returns a list of all workspaces including their details."
1450
+ },
1451
+ perform: async (context, { connection }) => {
1452
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/workspaces`);
1453
+ return { data };
1454
+ },
1455
+ inputs: { connection },
1456
+ examplePayload: { data: {
1457
+ requestId: "4al018gzaztcr8nbukw",
1458
+ workspaces: [{
1459
+ id: "623457276584334",
1460
+ name: "Some Workspace",
1461
+ description: "This is one of our workspaces"
1462
+ }]
1463
+ } }
1464
+ });
1465
+ //#endregion
1466
+ //#region src/actions/meetings/create.ts
1467
+ const createNewGongMeeting = (0, _prismatic_io_spectral.action)({
1468
+ display: {
1469
+ label: "Create New Gong Meeting",
1470
+ description: "Creates a new Gong Meeting"
1471
+ },
1472
+ perform: async (context, { connection, ...params }) => {
1473
+ const { data } = await createClient(connection, context.debug.enabled).post(`/v2/meetings`, params);
1474
+ return { data };
1475
+ },
1476
+ inputs: {
1477
+ connection,
1478
+ startTime,
1479
+ endTime,
1480
+ organizerEmail,
1481
+ invitees,
1482
+ externalId,
1483
+ title
1484
+ },
1485
+ examplePayload: { data: {
1486
+ requestId: "4al018gzaztcr8nbukw",
1487
+ meetingId: "7782342274025937895",
1488
+ meetingUrl: "https://join.gong.io/my-company/jon.snow?tkn=MoNpS9tMNt8BK7EZxQpSJl",
1489
+ additionalInvitees: [{
1490
+ displayName: "Gong Assistant",
1491
+ email: "assistant@gong.io"
1492
+ }]
1493
+ } }
1494
+ });
1495
+ //#endregion
1496
+ //#region src/actions/meetings/delete.ts
1497
+ const deleteMeeting = (0, _prismatic_io_spectral.action)({
1498
+ display: {
1499
+ label: "Delete Gong Meeting",
1500
+ description: "Deletes an existing Gong Meeting"
1501
+ },
1502
+ perform: async (context, { connection, meetingId }) => {
1503
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/meetings/${meetingId}`);
1504
+ return { data };
1505
+ },
1506
+ inputs: {
1507
+ connection,
1508
+ meetingId
1509
+ },
1510
+ examplePayload: { data: { organizerEmail: "test@test.com" } }
1511
+ });
1512
+ //#endregion
1513
+ //#region src/actions/meetings/index.ts
1514
+ var meetings_default = {
1515
+ createNewGongMeeting,
1516
+ updateGongMeeting: (0, _prismatic_io_spectral.action)({
1517
+ display: {
1518
+ label: "Update Gong Meeting",
1519
+ description: "Updates an existing Gong Meeting"
1520
+ },
1521
+ perform: async (context, { connection, meetingId, ...params }) => {
1522
+ const { data } = await createClient(connection, context.debug.enabled).put(`/v2/meetings/${meetingId}`, params);
1523
+ return { data };
1524
+ },
1525
+ inputs: {
1526
+ connection,
1527
+ meetingId,
1528
+ startTime,
1529
+ endTime,
1530
+ organizerEmail,
1531
+ invitees,
1532
+ externalId,
1533
+ title
1534
+ },
1535
+ examplePayload: { data: {
1536
+ requestId: "4al018gzaztcr8nbukw",
1537
+ meetingId: "7782342274025937895",
1538
+ meetingUrl: "https://join.gong.io/my-company/jon.snow?tkn=MoNpS9tMNt8BK7EZxQpSJl",
1539
+ additionalInvitees: [{
1540
+ displayName: "Gong Assistant",
1541
+ email: "assistant@gong.io"
1542
+ }]
1543
+ } }
1544
+ }),
1545
+ deleteMeeting
1546
+ };
1547
+ //#endregion
1548
+ //#region src/actions/rawRequest.ts
1549
+ const { debugRequest: _, ...httpInputsWithoutDebug } = _prismatic_io_spectral_http.inputs;
1550
+ const rawRequest = (0, _prismatic_io_spectral.action)({
1551
+ display: {
1552
+ label: "Raw Request",
1553
+ description: "Send raw HTTP request to Gong"
1554
+ },
1555
+ inputs: {
1556
+ connection,
1557
+ ...httpInputsWithoutDebug,
1558
+ url: {
1559
+ ...httpInputsWithoutDebug.url,
1560
+ example: "Input the path only (/v2/users), The base URL is already included (https://us-6852.app.gong.io/). For example, to connect to https://us-6852.app.gong.io/v2/users, only /v2/users is entered in this field."
1561
+ }
1562
+ },
1563
+ perform: async (context, { connection, ...httpClientInputs }) => {
1564
+ const { baseUrl, headers } = getHeaders(connection);
1565
+ const { data } = await (0, _prismatic_io_spectral_http.sendRawRequest)(baseUrl, {
1566
+ ...httpClientInputs,
1567
+ debugRequest: context.debug.enabled
1568
+ }, { ...headers });
1569
+ return { data };
1570
+ }
1571
+ });
1572
+ //#endregion
1573
+ //#region src/actions/references/deleteEmailAddressAndAssociatedElements.ts
1574
+ const deleteEmailAddressAndAssociatedElements = (0, _prismatic_io_spectral.action)({
1575
+ display: {
1576
+ label: "Delete Email Address and Associated Elements",
1577
+ description: "Given an email address, this endpoint deletes from the Gong system any calls or email messages that reference this address."
1578
+ },
1579
+ perform: async (context, { connection, emailAddress }) => {
1580
+ const { data } = await createClient(connection, context.debug.enabled).post(`/v2/data-privacy/erase-data-for-email-address`, { params: { emailAddress } });
1581
+ return { data };
1582
+ },
1583
+ inputs: {
1584
+ connection,
1585
+ emailAddress
1586
+ },
1587
+ examplePayload: { data: { requestId: "4al018gzaztcr8nbukw" } }
1588
+ });
1589
+ //#endregion
1590
+ //#region src/actions/references/deletePhoneNumberAndAssociatedElements.ts
1591
+ const deletePhoneNumberAndAssociatedElements = (0, _prismatic_io_spectral.action)({
1592
+ display: {
1593
+ label: "Delete Phone Number and Associated Elements",
1594
+ description: "Given a phone number, this endpoint deletes from the Gong system any leads or contacts with a matching phone number or mobile phone number."
1595
+ },
1596
+ perform: async (context, { connection, phoneNumber }) => {
1597
+ const { data } = await createClient(connection, context.debug.enabled).post(`/v2/data-privacy/erase-data-for-phone-number`, { params: { phoneNumber: encodeURIComponent(phoneNumber) } });
1598
+ return { data };
1599
+ },
1600
+ inputs: {
1601
+ connection,
1602
+ phoneNumber
1603
+ },
1604
+ examplePayload: { data: { requestId: "4al018gzaztcr8nbukw" } }
1605
+ });
1606
+ //#endregion
1607
+ //#region src/actions/references/getLogsData.ts
1608
+ const getLogsDataByTypeAndTimeRange = (0, _prismatic_io_spectral.action)({
1609
+ display: {
1610
+ label: "Get Logs Data by Type and Time Range",
1611
+ description: "List log entries that took place during a specified time range."
1612
+ },
1613
+ perform: async (context, { connection, cursor, fromDateTime, toDateTime, logType }) => {
1614
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/logs`, { params: {
1615
+ cursor,
1616
+ fromDateTime,
1617
+ toDateTime,
1618
+ logType
1619
+ } });
1620
+ return { data };
1621
+ },
1622
+ inputs: {
1623
+ connection,
1624
+ cursor,
1625
+ logType,
1626
+ fromDateTime,
1627
+ toDateTime: {
1628
+ ...toDateTime,
1629
+ comments: "The time until which to retrieve log records, in the ISO-8601 format (e.g., '2018-02-18T02:30:00-07:00' or '2018-02-18T08:00:00Z', where Z stands for UTC); if not specified, the logs end with the latest recorded log.",
1630
+ required: false
1631
+ }
1632
+ },
1633
+ examplePayload: { data: {
1634
+ requestId: "4al018gzaztcr8nbukw",
1635
+ records: {
1636
+ totalRecords: 263,
1637
+ currentPageSize: 100,
1638
+ currentPageNumber: 0,
1639
+ cursor: "eyJhbGciOiJIUzI1NiJ9.eyJjYWxsSWQiM1M30.6qKwpOcvnuweTZmFRzYdtjs_YwJphJU4QIwWFM"
1640
+ },
1641
+ logEntries: [{
1642
+ userId: "234599484848423",
1643
+ userEmailAddress: "test@test.com",
1644
+ userFullName: "Jon Snow",
1645
+ impersonatorUserId: "234599484848423",
1646
+ impersonatorEmailAddress: "test@test.com",
1647
+ impersonatorFullName: "Jon Snow",
1648
+ impersonatorCompanyId: "234599484848423",
1649
+ eventTime: "2018-02-17T02:30:00-08:00",
1650
+ logRecord: {}
1651
+ }]
1652
+ } }
1653
+ });
1654
+ //#endregion
1655
+ //#region src/actions/references/listReferencesToAnEmailAddress.ts
1656
+ const listReferencesToAnEmailAddress = (0, _prismatic_io_spectral.action)({
1657
+ display: {
1658
+ label: "List References to an Email Address",
1659
+ description: "Shows the elements in the Gong system that reference the given email address."
1660
+ },
1661
+ perform: async (context, { connection, emailAddress }) => {
1662
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/data-privacy/data-for-email-address`, { params: { emailAddress } });
1663
+ return { data };
1664
+ },
1665
+ inputs: {
1666
+ connection,
1667
+ emailAddress
1668
+ },
1669
+ examplePayload: { data: {
1670
+ requestId: "4al018gzaztcr8nbukw",
1671
+ emails: [{
1672
+ from: "test@test.com",
1673
+ id: "223mjfaaqqjuegabiyrmpctvcwwl75oz",
1674
+ sentTime: "2019-01-20T00:00:00-08:00",
1675
+ mailbox: "test@test.com",
1676
+ messageHash: "l3z7w2s7oircdabnkwizmycm6g2uwznc"
1677
+ }],
1678
+ calls: [{
1679
+ id: "7782342274025937895",
1680
+ status: "COMPLETED",
1681
+ externalSystems: [{
1682
+ system: "Salesforce",
1683
+ objects: [{
1684
+ objectType: "Task",
1685
+ externalId: "0013601230sV7grAAC"
1686
+ }]
1687
+ }]
1688
+ }],
1689
+ meetings: [{ id: "8059707022269524529.sb5gr1tgpt5dd799eh035rb3dk@google.com_2022-06-30T13:00:00Z" }],
1690
+ customerData: [{
1691
+ system: "Salesforce",
1692
+ objects: [{
1693
+ id: "7782342274025937895",
1694
+ objectType: "Contact",
1695
+ externalId: "0013601230sV7grAAC",
1696
+ mirrorId: "\"{\\\"integrationId\\\":\\\"262834820328732\\\",\\\"crmObjectType\\\":\\\"CONTACT\\\",\\\"crmId\\\":\\\"0031Q00002DFhi4QAD\\\"}\"",
1697
+ fields: [{
1698
+ name: "name",
1699
+ value: "Gong Inc."
1700
+ }]
1701
+ }]
1702
+ }],
1703
+ customerEngagement: [{
1704
+ eventType: "ExternalCallViewing",
1705
+ timestamp: 1547971200,
1706
+ contentId: "7782342274025937895",
1707
+ contentUrl: "https://app.gong.io/e/c-share/tkn=5vjaxkqnzmp515b220vlzto2i",
1708
+ reportingSystem: "https://app.gong.io/e/c-share/tkn=5vjaxkqnzmp515b220vlzto2i",
1709
+ eventName: "https://app.gong.io/e/c-share/tkn=5vjaxkqnzmp515b220vlzto2i",
1710
+ sourceEventId: "https://app.gong.io/e/c-share/tkn=5vjaxkqnzmp515b220vlzto2i"
1711
+ }]
1712
+ } }
1713
+ });
1714
+ //#endregion
1715
+ //#region src/actions/references/index.ts
1716
+ var references_default = {
1717
+ getLogsDataByTypeAndTimeRange,
1718
+ listReferencesToAPhoneNumber: (0, _prismatic_io_spectral.action)({
1719
+ display: {
1720
+ label: "List References to a Phone Number",
1721
+ description: "Shows the elements in the Gong system that reference the given phone number."
1722
+ },
1723
+ perform: async (context, { connection, phoneNumber }) => {
1724
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/data-privacy/data-for-phone-number`, { params: { phoneNumber: encodeURIComponent(phoneNumber) } });
1725
+ return { data };
1726
+ },
1727
+ inputs: {
1728
+ connection,
1729
+ phoneNumber
1730
+ },
1731
+ examplePayload: { data: {
1732
+ requestId: "4al018gzaztcr8nbukw",
1733
+ emails: [{
1734
+ from: "test@test.com",
1735
+ id: "223mjfaaqqjuegabiyrmpctvcwwl75oz",
1736
+ sentTime: "2019-01-20T00:00:00-08:00",
1737
+ mailbox: "test@test.com",
1738
+ messageHash: "l3z7w2s7oircdabnkwizmycm6g2uwznc"
1739
+ }],
1740
+ calls: [{
1741
+ id: "7782342274025937895",
1742
+ status: "COMPLETED",
1743
+ externalSystems: [{
1744
+ system: "Salesforce",
1745
+ objects: [{
1746
+ objectType: "Task",
1747
+ externalId: "0013601230sV7grAAC"
1748
+ }]
1749
+ }]
1750
+ }],
1751
+ meetings: [{ id: "8059707022269524529.sb5gr1tgpt5dd799eh035rb3dk@google.com_2022-06-30T13:00:00Z" }],
1752
+ customerData: [{
1753
+ system: "Salesforce",
1754
+ objects: [{
1755
+ id: "7782342274025937895",
1756
+ objectType: "Contact",
1757
+ externalId: "0013601230sV7grAAC",
1758
+ mirrorId: "\"{\\\"integrationId\\\":\\\"262834820328732\\\",\\\"crmObjectType\\\":\\\"CONTACT\\\",\\\"crmId\\\":\\\"0031Q00002DFhi4QAD\\\"}\"",
1759
+ fields: [{
1760
+ name: "name",
1761
+ value: "Gong Inc."
1762
+ }]
1763
+ }]
1764
+ }],
1765
+ customerEngagement: [{
1766
+ eventType: "ExternalCallViewing",
1767
+ timestamp: 1547971200,
1768
+ contentId: "7782342274025937895",
1769
+ contentUrl: "https://app.gong.io/e/c-share/tkn=5vjaxkqnzmp515b220vlzto2i",
1770
+ reportingSystem: "https://app.gong.io/e/c-share/tkn=5vjaxkqnzmp515b220vlzto2i",
1771
+ eventName: "https://app.gong.io/e/c-share/tkn=5vjaxkqnzmp515b220vlzto2i",
1772
+ sourceEventId: "https://app.gong.io/e/c-share/tkn=5vjaxkqnzmp515b220vlzto2i"
1773
+ }]
1774
+ } }
1775
+ }),
1776
+ listReferencesToAnEmailAddress,
1777
+ deleteEmailAddressAndAssociatedElements,
1778
+ deletePhoneNumberAndAssociatedElements
1779
+ };
1780
+ //#endregion
1781
+ //#region src/actions/users/index.ts
1782
+ var users_default = {
1783
+ getUser: (0, _prismatic_io_spectral.action)({
1784
+ display: {
1785
+ label: "Get User",
1786
+ description: "Retrieve a specific user."
1787
+ },
1788
+ perform: async (context, { connection, userId }) => {
1789
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/users/${userId}`);
1790
+ return { data };
1791
+ },
1792
+ inputs: {
1793
+ connection,
1794
+ userId
1795
+ },
1796
+ examplePayload: { data: {
1797
+ requestId: "4al018gzaztcr8nbukw",
1798
+ user: {
1799
+ id: "234599484848423",
1800
+ emailAddress: "test@test.com",
1801
+ created: "2018-02-17T02:30:00-08:00",
1802
+ active: true,
1803
+ emailAliases: ["testAlias@test.com"],
1804
+ trustedEmailAddress: "test@test.com",
1805
+ firstName: "Jon",
1806
+ lastName: "Snow",
1807
+ title: "Enterprise Account Executive",
1808
+ phoneNumber: "+1 123-567-8989",
1809
+ extension: "123",
1810
+ personalMeetingUrls: ["https://zoom.us/j/123"],
1811
+ settings: {
1812
+ webConferencesRecorded: true,
1813
+ preventWebConferenceRecording: false,
1814
+ telephonyCallsImported: false,
1815
+ emailsImported: true,
1816
+ preventEmailImport: false,
1817
+ nonRecordedMeetingsImported: true,
1818
+ gongConnectEnabled: true
1819
+ },
1820
+ managerId: "563515258458745",
1821
+ meetingConsentPageUrl: "https://join.gong.io/my-company/jon.snow?tkn=MoNpS9tMNt8BK7EZxQpSJl",
1822
+ spokenLanguages: [{
1823
+ language: "es-ES",
1824
+ primary: true
1825
+ }]
1826
+ }
1827
+ } }
1828
+ }),
1829
+ listUsers: (0, _prismatic_io_spectral.action)({
1830
+ display: {
1831
+ label: "List Users",
1832
+ description: "List all of the company's users."
1833
+ },
1834
+ perform: async (context, { connection, cursor, includeAvatars }) => {
1835
+ const { data } = await createClient(connection, context.debug.enabled).get(`/v2/users`, { params: {
1836
+ cursor,
1837
+ includeAvatars
1838
+ } });
1839
+ return { data };
1840
+ },
1841
+ inputs: {
1842
+ connection,
1843
+ cursor,
1844
+ includeAvatars
1845
+ },
1846
+ examplePayload: { data: {
1847
+ requestId: "4al018gzaztcr8nbukw",
1848
+ records: {
1849
+ totalRecords: 263,
1850
+ currentPageSize: 100,
1851
+ currentPageNumber: 0,
1852
+ cursor: "eyJhbGciOiJIUzI1NiJ9.eyJjYWxsSWQiM1M30.6qKwpOcvnuweTZmFRzYdtjs_YwJphJU4QIwWFM"
1853
+ },
1854
+ users: [{
1855
+ id: "234599484848423",
1856
+ emailAddress: "test@test.com",
1857
+ created: "2018-02-17T02:30:00-08:00",
1858
+ active: true,
1859
+ emailAliases: ["testAlias@test.com"],
1860
+ trustedEmailAddress: "test@test.com",
1861
+ firstName: "Jon",
1862
+ lastName: "Snow",
1863
+ title: "Enterprise Account Executive",
1864
+ phoneNumber: "+1 123-567-8989",
1865
+ extension: "123",
1866
+ personalMeetingUrls: ["https://zoom.us/j/123"],
1867
+ settings: {
1868
+ webConferencesRecorded: true,
1869
+ preventWebConferenceRecording: false,
1870
+ telephonyCallsImported: false,
1871
+ emailsImported: true,
1872
+ preventEmailImport: false,
1873
+ nonRecordedMeetingsImported: true,
1874
+ gongConnectEnabled: true
1875
+ },
1876
+ managerId: "563515258458745",
1877
+ meetingConsentPageUrl: "https://join.gong.io/my-company/jon.snow?tkn=MoNpS9tMNt8BK7EZxQpSJl",
1878
+ spokenLanguages: [{
1879
+ language: "es-ES",
1880
+ primary: true
1881
+ }]
1882
+ }]
1883
+ } }
1884
+ })
1885
+ };
1886
+ //#endregion
1887
+ //#region src/actions/index.ts
1888
+ var actions_default = {
1889
+ ...calls_default,
1890
+ ...users_default,
1891
+ ...folders_default,
1892
+ ...meetings_default,
1893
+ ...references_default,
1894
+ ...engagement_default,
1895
+ listWorkspaces,
1896
+ rawRequest
1897
+ };
1898
+ //#endregion
1899
+ //#region src/triggers/index.ts
1900
+ var triggers_default = {
1901
+ webhook: (0, _prismatic_io_spectral.trigger)({
1902
+ display: {
1903
+ label: `Process Automation Trigger`,
1904
+ description: `Trigger for handling process automations from Gong`
1905
+ },
1906
+ perform: async (_context, payload) => {
1907
+ await Promise.resolve();
1908
+ return { payload };
1909
+ },
1910
+ inputs: { rules: (0, _prismatic_io_spectral.input)({
1911
+ label: "Automation Rules",
1912
+ type: "jsonForm",
1913
+ required: true
1914
+ }) },
1915
+ synchronousResponseSupport: "valid",
1916
+ scheduleSupport: "valid"
1917
+ }),
1918
+ pollChangesTrigger: (0, _prismatic_io_spectral.pollingTrigger)({
1919
+ display: {
1920
+ label: "New Records",
1921
+ description: "Retrieves existing and ongoing calls, or new users, for a specified Gong resource type. Load history once, check for changes on a schedule, or both."
1922
+ },
1923
+ inputs: {
1924
+ connection,
1925
+ resourceType: pollResourceType,
1926
+ showNewRecords,
1927
+ lookBackDate
1928
+ },
1929
+ triggerResolverSupport: "valid",
1930
+ batchConfig: { batchSize: 50 },
1931
+ triggerResolver: { resolveItems: (_context, { payload }) => resolvePollingRecordChanges(payload.body.data) },
1932
+ perform: async (context, payload, { connection, resourceType, lookBackDate, showNewRecords }) => {
1933
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1934
+ const lastState = context.polling.getState();
1935
+ const isInitialSync = resourceType === PollResource.CALLS && lastState?.lastPolledAt === void 0 && Boolean(lookBackDate);
1936
+ const lastPolledAt = lastState?.lastPolledAt ?? (lookBackDate || now);
1937
+ const client = createClient(connection, context.debug.enabled);
1938
+ let created;
1939
+ if (resourceType === PollResource.CALLS) created = await fetchAllCalls(client, lastPolledAt, now);
1940
+ else {
1941
+ const records = await fetchAllUsers(client);
1942
+ if (lastState?.knownIds === void 0) {
1943
+ context.polling.setState({
1944
+ lastPolledAt: now,
1945
+ knownIds: records.map((r) => r.id)
1946
+ });
1947
+ return {
1948
+ payload: {
1949
+ ...payload,
1950
+ body: { data: {
1951
+ created: [],
1952
+ updated: []
1953
+ } }
1954
+ },
1955
+ polledNoChanges: true
1956
+ };
1957
+ }
1958
+ const knownSet = new Set(lastState.knownIds);
1959
+ created = records.filter((r) => !knownSet.has(r.id));
1960
+ const newState = {
1961
+ lastPolledAt: now,
1962
+ knownIds: records.map((r) => r.id)
1963
+ };
1964
+ context.polling.setState(newState);
1965
+ }
1966
+ if (resourceType === PollResource.CALLS) context.polling.setState({ lastPolledAt: now });
1967
+ const filteredCreated = showNewRecords || isInitialSync ? created : [];
1968
+ if (context.debug.enabled) context.logger.debug(`Polled ${resourceType}: ${filteredCreated.length} new`);
1969
+ return {
1970
+ payload: {
1971
+ ...payload,
1972
+ body: { data: {
1973
+ created: filteredCreated,
1974
+ updated: []
1975
+ } }
1976
+ },
1977
+ polledNoChanges: filteredCreated.length === 0
1978
+ };
1979
+ }
1980
+ })
1981
+ };
1982
+ //#endregion
1983
+ //#region src/datasources/folders.ts
1984
+ const folders = (0, _prismatic_io_spectral.dataSource)({
1985
+ display: {
1986
+ label: "Select Folder",
1987
+ description: "Select a folder from your Gong workspace"
1988
+ },
1989
+ inputs: {
1990
+ connection,
1991
+ workspaceId: {
1992
+ ...workspaceId,
1993
+ required: true,
1994
+ dataSource: void 0
1995
+ }
1996
+ },
1997
+ perform: async (_context, { connection, workspaceId }) => {
1998
+ const { data } = await createClient(connection, false).get(`/v2/library/folders`, { params: { workspaceId } });
1999
+ return { result: data.folders.map((folder) => ({
2000
+ label: folder.name,
2001
+ key: folder.id.toString()
2002
+ })) };
2003
+ },
2004
+ dataSourceType: "picklist",
2005
+ examplePayload: { result: [{
2006
+ label: "Sales Onboarding",
2007
+ key: "3843152912968920037"
2008
+ }] }
2009
+ });
2010
+ //#endregion
2011
+ //#region src/datasources/selectCall.ts
2012
+ const calls = (0, _prismatic_io_spectral.dataSource)({
2013
+ display: {
2014
+ label: "Select Call",
2015
+ description: "Select a call from your Gong workspace"
2016
+ },
2017
+ inputs: {
2018
+ connection,
2019
+ workspaceId: {
2020
+ ...workspaceId,
2021
+ dataSource: void 0
2022
+ }
2023
+ },
2024
+ perform: async (_context, { connection, workspaceId }) => {
2025
+ const { data } = await createClient(connection, false).get(`/v2/calls`, { params: { workspaceId } });
2026
+ return { result: data.calls.map((call) => ({
2027
+ label: call.title,
2028
+ key: call.id.toString()
2029
+ })) };
2030
+ },
2031
+ dataSourceType: "picklist",
2032
+ examplePayload: { result: [{
2033
+ label: "Title of the call",
2034
+ key: "3843152912968920037"
2035
+ }] }
2036
+ });
2037
+ //#endregion
2038
+ //#region src/datasources/users.ts
2039
+ const users = (0, _prismatic_io_spectral.dataSource)({
2040
+ display: {
2041
+ label: "Select User",
2042
+ description: "Select a user from your Gong workspace"
2043
+ },
2044
+ perform: async (_context, { connection }) => {
2045
+ const { data } = await createClient(connection, false).get(`/v2/users`);
2046
+ return { result: data.users.map((user) => {
2047
+ return {
2048
+ label: `${user.emailAddress} - ${user.lastName} ${user.firstName}`,
2049
+ key: user.id.toString()
2050
+ };
2051
+ }) };
2052
+ },
2053
+ dataSourceType: "picklist",
2054
+ inputs: { connection }
2055
+ });
2056
+ //#endregion
2057
+ //#region src/datasources/index.ts
2058
+ var datasources_default = {
2059
+ folders,
2060
+ workspaces: (0, _prismatic_io_spectral.dataSource)({
2061
+ display: {
2062
+ label: "Select Workspace",
2063
+ description: "Select a workspace from your Gong account"
2064
+ },
2065
+ inputs: { connection },
2066
+ perform: async (_context, { connection }) => {
2067
+ const { data } = await createClient(connection, false).get("/v2/workspaces");
2068
+ return { result: data.workspaces.map((workspace) => ({
2069
+ label: workspace.name,
2070
+ key: workspace.id.toString()
2071
+ })) };
2072
+ },
2073
+ dataSourceType: "picklist",
2074
+ examplePayload: { result: [{
2075
+ label: "Sales Onboarding",
2076
+ key: "3843152912968920037"
2077
+ }] }
2078
+ }),
2079
+ users,
2080
+ calls
2081
+ };
2082
+ //#endregion
2083
+ //#region src/index.ts
2084
+ var src_default = (0, _prismatic_io_spectral.component)({
2085
+ key: "gong",
2086
+ public: true,
2087
+ documentationUrl: "https://prismatic.io/docs/components/gong/",
2088
+ display: {
2089
+ label: "Gong",
2090
+ description: "Manage calls, users, and workspaces in the Gong revenue intelligence platform.",
2091
+ iconPath: "icon.png",
2092
+ category: "Application Connectors"
2093
+ },
2094
+ hooks: { error: _prismatic_io_spectral_http.handleErrors },
2095
+ actions: actions_default,
2096
+ connections: connections_default,
2097
+ triggers: triggers_default,
2098
+ dataSources: datasources_default
2099
+ });
2100
+ //#endregion
2101
+ //#region npm-dist/.entry.ts
2102
+ var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
2103
+ //#endregion
2104
+ module.exports = _entry_default;