diff --git a/components/gong/actions/add-new-call/add-new-call.mjs b/components/gong/actions/add-new-call/add-new-call.mjs index 38b21904435c7..6d3058b341d23 100644 --- a/components/gong/actions/add-new-call/add-new-call.mjs +++ b/components/gong/actions/add-new-call/add-new-call.mjs @@ -8,7 +8,7 @@ export default { name: "Add New Call", description: "Add a new call. [See the documentation](https://us-66463.app.gong.io/settings/api/documentation#post-/v2/calls)", type: "action", - version: "0.0.2", + version: "0.0.3", props: { app, clientUniqueId: { diff --git a/components/gong/actions/get-extensive-data/get-extensive-data.mjs b/components/gong/actions/get-extensive-data/get-extensive-data.mjs index fc7d6a642c4b1..d62c4581ab73b 100644 --- a/components/gong/actions/get-extensive-data/get-extensive-data.mjs +++ b/components/gong/actions/get-extensive-data/get-extensive-data.mjs @@ -1,12 +1,13 @@ import app from "../../gong.app.mjs"; import constants from "../../common/constants.mjs"; import { ConfigurationError } from "@pipedream/platform"; +import utils from "../../common/utils.mjs"; export default { key: "gong-get-extensive-data", name: "Get Extensive Data", - description: "Lists detailed call data. [See the documentation](https://us-66463.app.gong.io/settings/api/documentation#post-/v2/calls/extensive)", - version: "0.0.1", + description: "Lists detailed call data. [See the documentation](https://gong.app.gong.io/settings/api/documentation#post-/v2/calls/extensive)", + version: "0.0.3", type: "action", props: { app, @@ -54,6 +55,75 @@ export default { default: constants.DEFAULT_MAX, optional: true, }, + context: { + type: "string", + label: "Context", + description: "If 'Basic', add links to external systems (context objects) such as CRM, Telephony System, Case Management. If 'Extended' include also data (context fields) for these links.", + options: [ + "None", + "Basic", + "Extended", + ], + default: "None", + optional: true, + }, + contextTiming: { + type: "string[]", + label: "Context Timing", + description: "Allowed: Now, TimeOfCall. Timing for the context data. The field is optional and can contain either 'Now' or 'TimeOfCall' or both. The default value is ['Now']. Can be provided only when the context field is set to 'Extended'", + optional: true, + }, + includeParties: { + type: "boolean", + label: "Include Parties", + description: "Whether to include parties in the response", + default: false, + optional: true, + }, + exposedFieldsContent: { + type: "object", + label: "Exposed Fields Content", + description: "Specify which fields to include in the response for the content. Example object: {'structure': false, 'topics': false, 'trackers': false, 'trackerOccurrences': false, 'pointsOfInterest': false, 'brief': true, 'outline': true, 'highlights': true, 'callOutcome': true, 'keyPoints': true}", + default: { + "structure": "false", + "topics": "false", + "trackers": "false", + "trackerOccurrences": "false", + "pointsOfInterest": "false", + "brief": "false", + "outline": "false", + "highlights": "false", + "callOutcome": "false", + "keyPoints": "false", + }, + optional: true, + }, + exposedFieldsInteraction: { + type: "object", + label: "Exposed Fields Interaction", + description: "Specify which fields to include in the response for the interaction. Example object: {'speakers': true, 'video': true, 'personInteractionStats': true, 'questions': true}", + default: { + "speakers": "false", + "video": "false", + "personInteractionStats": "false", + "questions": "false", + }, + optional: true, + }, + includePublicComments: { + type: "boolean", + label: "Include Public Comments", + description: "Whether to include public comments in the response", + default: false, + optional: true, + }, + includeMedia: { + type: "boolean", + label: "Include Media", + description: "Whether to include media in the response", + default: false, + optional: true, + }, }, methods: { getExtensiveData(args = {}) { @@ -68,6 +138,13 @@ export default { app, getExtensiveData, maxResults, + context, + contextTiming, + includeParties, + exposedFieldsContent, + exposedFieldsInteraction, + includePublicComments, + includeMedia, ...filter } = this; @@ -75,6 +152,41 @@ export default { throw new ConfigurationError("Must not provide both `callIds` and `workspaceId`"); } + const exposedFieldsContentObj = utils.parseObject(exposedFieldsContent); + const exposedFieldsInteractionObj = utils.parseObject(exposedFieldsInteraction); + + const contentSelector = { + "context": context || "None", + ...(contextTiming?.length > 0 && { + "contextTiming": contextTiming, + }), + "exposedFields": { + "parties": includeParties || false, + "content": { + "structure": exposedFieldsContentObj?.structure || false, + "topics": exposedFieldsContentObj?.topics || false, + "trackers": exposedFieldsContentObj?.trackers || false, + "trackerOccurrences": exposedFieldsContentObj?.trackerOccurrences || false, + "pointsOfInterest": exposedFieldsContentObj?.pointsOfInterest || false, + "brief": exposedFieldsContentObj?.brief || false, + "outline": exposedFieldsContentObj?.outline || false, + "highlights": exposedFieldsContentObj?.highlights || false, + "callOutcome": exposedFieldsContentObj?.callOutcome || false, + "keyPoints": exposedFieldsContentObj?.keyPoints || false, + }, + "interaction": { + "speakers": exposedFieldsInteractionObj?.speakers || false, + "video": exposedFieldsInteractionObj?.video || false, + "personInteractionStats": exposedFieldsInteractionObj?.personInteractionStats || false, + "questions": exposedFieldsInteractionObj?.questions || false, + }, + "collaboration": { + "publicComments": includePublicComments || false, + }, + "media": includeMedia || false, + }, + }; + try { const calls = await app.paginate({ resourceFn: getExtensiveData, @@ -82,6 +194,7 @@ export default { step: $, data: { filter, + contentSelector, }, }, resourceName: "calls", diff --git a/components/gong/actions/list-calls/list-calls.mjs b/components/gong/actions/list-calls/list-calls.mjs index 3fc6631be0b4e..544547add7ab4 100644 --- a/components/gong/actions/list-calls/list-calls.mjs +++ b/components/gong/actions/list-calls/list-calls.mjs @@ -5,7 +5,7 @@ export default { name: "List calls", description: "List calls. [See the documentation](https://us-66463.app.gong.io/settings/api/documentation#get-/v2/calls)", type: "action", - version: "0.0.2", + version: "0.0.3", props: { app, fromDateTime: { diff --git a/components/gong/actions/retrieve-transcripts-of-calls/retrieve-transcripts-of-calls.mjs b/components/gong/actions/retrieve-transcripts-of-calls/retrieve-transcripts-of-calls.mjs index 5c37201adccb5..0f53c95475c1a 100644 --- a/components/gong/actions/retrieve-transcripts-of-calls/retrieve-transcripts-of-calls.mjs +++ b/components/gong/actions/retrieve-transcripts-of-calls/retrieve-transcripts-of-calls.mjs @@ -5,7 +5,7 @@ export default { name: "Retrieve Transcripts Of Calls", description: "Retrieve transcripts of calls. [See the documentation](https://us-66463.app.gong.io/settings/api/documentation#post-/v2/calls/transcript)", type: "action", - version: "0.0.3", + version: "0.0.4", props: { app, fromDateTime: { diff --git a/components/gong/common/utils.mjs b/components/gong/common/utils.mjs index bea869f0ecd99..cb58fcb169c55 100644 --- a/components/gong/common/utils.mjs +++ b/components/gong/common/utils.mjs @@ -1,7 +1,7 @@ import { ConfigurationError } from "@pipedream/platform"; function emptyStrToUndefined(value) { - const trimmed = typeof(value) === "string" && value.trim(); + const trimmed = typeof (value) === "string" && value.trim(); return trimmed === "" ? undefined : value; @@ -9,7 +9,7 @@ function emptyStrToUndefined(value) { function parse(value) { const valueToParse = emptyStrToUndefined(value); - if (typeof(valueToParse) === "object" || valueToParse === undefined) { + if (typeof (valueToParse) === "object" || valueToParse === undefined) { return valueToParse; } try { @@ -42,6 +42,31 @@ function parseArray(value) { } } +function parseObject(obj) { + if (!obj) return undefined; + + if (Array.isArray(obj)) { + return obj.map((item) => { + if (typeof item === "string") { + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } + return item; + }); + } + if (typeof obj === "string") { + try { + return JSON.parse(obj); + } catch (e) { + return obj; + } + } + return obj; +}; + async function streamIterator(stream) { const resources = []; for await (const resource of stream) { @@ -52,6 +77,7 @@ async function streamIterator(stream) { export default { parseArray, + parseObject, parse, streamIterator, }; diff --git a/components/gong/package.json b/components/gong/package.json index f7a09cd82f3b3..1c039a6a039ef 100644 --- a/components/gong/package.json +++ b/components/gong/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/gong", - "version": "0.2.0", + "version": "0.3.0", "description": "Pipedream Gong Components", "main": "gong.app.mjs", "keywords": [ diff --git a/components/gong/sources/new-call/new-call.mjs b/components/gong/sources/new-call/new-call.mjs index 91b44d543eccb..e9bfadd5a6bc7 100644 --- a/components/gong/sources/new-call/new-call.mjs +++ b/components/gong/sources/new-call/new-call.mjs @@ -6,7 +6,7 @@ export default { name: "New Call", description: "Triggers when a new call is added. [See the documentation](https://us-66463.app.gong.io/settings/api/documentation#get-/v2/calls)", type: "source", - version: "0.0.2", + version: "0.0.3", dedupe: "unique", methods: { ...common.methods,