Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 102 additions & 8 deletions apps/sim/blocks/blocks/gong.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ export const GongBlock: BlockConfig<GongResponse> = {
{ label: 'List Trackers', id: 'list_trackers' },
{ label: 'List Workspaces', id: 'list_workspaces' },
{ label: 'List Flows', id: 'list_flows' },
{ label: 'Assign Flow Prospects', id: 'assign_flow_prospects' },
{ label: 'Get Prospect Flows', id: 'get_prospect_flows' },
{ label: 'Get Coaching', id: 'get_coaching' },
{ label: 'Lookup Email', id: 'lookup_email' },
{ label: 'Lookup Phone', id: 'lookup_phone' },
{ label: 'Purge Email Address', id: 'purge_email_address' },
{ label: 'Purge Phone Number', id: 'purge_phone_number' },
],
value: () => 'list_calls',
},
Expand Down Expand Up @@ -239,6 +243,12 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
type: 'short-input',
placeholder: 'Comma-separated call IDs (optional)',
condition: { field: 'operation', value: ['get_call_transcript', 'get_extensive_calls'] },
wandConfig: {
enabled: true,
prompt: `Generate a comma-separated list of Gong call IDs based on the user's description.
Return ONLY the comma-separated list of IDs - no explanations, no extra text.`,
placeholder: 'Describe the call IDs (e.g., "calls 123456 and 789012")...',
},
},
{
id: 'transcriptFromDateTime',
Expand Down Expand Up @@ -289,6 +299,12 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
placeholder: 'Comma-separated user IDs (optional)',
condition: { field: 'operation', value: 'get_extensive_calls' },
mode: 'advanced',
wandConfig: {
enabled: true,
prompt: `Generate a comma-separated list of Gong user IDs based on the user's description.
Return ONLY the comma-separated list of IDs - no explanations, no extra text.`,
placeholder: 'Describe the user IDs...',
},
},

// List Users inputs
Expand Down Expand Up @@ -405,6 +421,12 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
],
},
mode: 'advanced',
wandConfig: {
enabled: true,
prompt: `Generate a comma-separated list of Gong user IDs based on the user's description.
Return ONLY the comma-separated list of IDs - no explanations, no extra text.`,
placeholder: 'Describe the user IDs...',
},
},

// Aggregate by Period inputs
Expand Down Expand Up @@ -499,6 +521,12 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
placeholder: 'Comma-separated scorecard IDs (optional)',
condition: { field: 'operation', value: 'answered_scorecards' },
mode: 'advanced',
wandConfig: {
enabled: true,
prompt: `Generate a comma-separated list of Gong scorecard IDs based on the user's description.
Return ONLY the comma-separated list of IDs - no explanations, no extra text.`,
placeholder: 'Describe the scorecard IDs...',
},
},
{
id: 'reviewedUserIds',
Expand All @@ -507,6 +535,12 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
placeholder: 'Comma-separated user IDs (optional)',
condition: { field: 'operation', value: 'answered_scorecards' },
mode: 'advanced',
wandConfig: {
enabled: true,
prompt: `Generate a comma-separated list of Gong user IDs based on the user's description.
Return ONLY the comma-separated list of IDs - no explanations, no extra text.`,
placeholder: 'Describe the reviewed user IDs...',
},
},

// Get Folder Content inputs
Expand Down Expand Up @@ -550,6 +584,38 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
required: { field: 'operation', value: 'list_flows' },
},

// Assign Flow Prospects / Get Prospect Flows inputs
{
id: 'flowId',
title: 'Flow ID',
type: 'short-input',
placeholder: 'Enter the Gong Engage flow ID',
condition: { field: 'operation', value: 'assign_flow_prospects' },
required: { field: 'operation', value: 'assign_flow_prospects' },
},
{
id: 'crmProspectsIds',
title: 'CRM Prospect IDs',
type: 'short-input',
placeholder: 'Comma-separated CRM contact or lead IDs',
condition: { field: 'operation', value: ['assign_flow_prospects', 'get_prospect_flows'] },
required: { field: 'operation', value: ['assign_flow_prospects', 'get_prospect_flows'] },
wandConfig: {
enabled: true,
prompt: `Generate a comma-separated list of CRM prospect IDs based on the user's description.
Return ONLY the comma-separated list of IDs - no explanations, no extra text.`,
placeholder: 'Describe the CRM prospect IDs...',
},
},
{
id: 'flowInstanceOwnerEmail',
title: 'Flow Instance Owner Email',
type: 'short-input',
placeholder: 'user@example.com',
condition: { field: 'operation', value: 'assign_flow_prospects' },
required: { field: 'operation', value: 'assign_flow_prospects' },
},

// Get Coaching inputs
{
id: 'managerId',
Expand Down Expand Up @@ -610,24 +676,24 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
},
},

// Lookup Email inputs
// Lookup Email / Purge Email Address inputs
{
id: 'emailAddress',
title: 'Email Address',
type: 'short-input',
placeholder: 'user@example.com',
condition: { field: 'operation', value: 'lookup_email' },
required: { field: 'operation', value: 'lookup_email' },
condition: { field: 'operation', value: ['lookup_email', 'purge_email_address'] },
required: { field: 'operation', value: ['lookup_email', 'purge_email_address'] },
},

// Lookup Phone inputs
// Lookup Phone / Purge Phone Number inputs
{
id: 'phoneNumber',
title: 'Phone Number',
type: 'short-input',
placeholder: '+1234567890',
condition: { field: 'operation', value: 'lookup_phone' },
required: { field: 'operation', value: 'lookup_phone' },
condition: { field: 'operation', value: ['lookup_phone', 'purge_phone_number'] },
required: { field: 'operation', value: ['lookup_phone', 'purge_phone_number'] },
},

// Pagination cursor (shared)
Expand Down Expand Up @@ -692,9 +758,13 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
'gong_list_trackers',
'gong_list_workspaces',
'gong_list_flows',
'gong_assign_flow_prospects',
'gong_get_prospect_flows',
'gong_get_coaching',
'gong_lookup_email',
'gong_lookup_phone',
'gong_purge_email_address',
'gong_purge_phone_number',
],
config: {
tool: (params) => `gong_${params.operation}`,
Expand Down Expand Up @@ -763,8 +833,20 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
type: 'string',
description: 'Email of a Gong user to retrieve personal and company flows',
},
emailAddress: { type: 'string', description: 'Email address to look up' },
phoneNumber: { type: 'string', description: 'Phone number to look up' },
flowId: { type: 'string', description: 'Gong Engage flow ID' },
crmProspectsIds: { type: 'string', description: 'Comma-separated CRM prospect IDs' },
flowInstanceOwnerEmail: {
type: 'string',
description: 'Email of the Gong user who owns the flow instance and its to-dos',
},
emailAddress: {
type: 'string',
description: 'Email address to look up or purge',
},
phoneNumber: {
type: 'string',
description: 'Phone number to look up or purge',
},
cursor: { type: 'string', description: 'Pagination cursor' },
},
outputs: {
Expand Down Expand Up @@ -883,6 +965,18 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
'Gong Engage flows: [{id, name, folderId, folderName, visibility, creationDate, exclusive}]',
},

// assign_flow_prospects / get_prospect_flows
prospectsAssigned: {
type: 'json',
description:
'Prospects assigned to (or enrolled in) flows: [{flowId, flowName, crmProspectId, flowInstanceId, flowInstanceOwnerEmail, flowInstanceOwnerFullName, flowInstanceCreateDate, flowInstanceStatus, workspaceId, exclusive}]',
},
prospectsNotAssigned: {
type: 'json',
description:
'Prospects that failed to be assigned to a flow: [{flowId, crmProspectId, errorCode, errorMessage}]',
},

// get_coaching
coachingData: {
type: 'json',
Expand Down
1 change: 1 addition & 0 deletions apps/sim/tools/gong/aggregate_activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export const aggregateActivityTool: ToolConfig<
cursor: {
type: 'string',
description: 'Pagination cursor for the next page',
optional: true,
},
},
}
133 changes: 133 additions & 0 deletions apps/sim/tools/gong/assign_flow_prospects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import type {
GongAssignFlowProspectsParams,
GongAssignFlowProspectsResponse,
} from '@/tools/gong/types'
import { getGongErrorMessage, parseGongIdList } from '@/tools/gong/utils'
import type { ToolConfig } from '@/tools/types'

export const assignFlowProspectsTool: ToolConfig<
GongAssignFlowProspectsParams,
GongAssignFlowProspectsResponse
> = {
id: 'gong_assign_flow_prospects',
name: 'Gong Assign Flow Prospects',
description: 'Assign up to 200 CRM prospects (contacts or leads) to a Gong Engage flow.',
version: '1.0.0',

params: {
accessKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Gong API Access Key',
},
accessKeySecret: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Gong API Access Key Secret',
},
flowId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The Gong Engage flow ID to assign the prospects to',
},
crmProspectsIds: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Comma-separated list of CRM prospect IDs (contacts or leads) to assign',
},
flowInstanceOwnerEmail: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Email of the Gong user who owns the flow instance and its to-dos',
},
},

request: {
url: 'https://api.gong.io/v2/flows/prospects/assign',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Basic ${btoa(`${params.accessKey}:${params.accessKeySecret}`)}`,
}),
body: (params) => ({
flowId: params.flowId.trim(),
crmProspectsIds: parseGongIdList(params.crmProspectsIds) ?? [],
flowInstanceOwnerEmail: params.flowInstanceOwnerEmail.trim(),
}),
},

transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(getGongErrorMessage(data, 'Failed to assign prospects to flow'))
}
return {
success: true,
output: {
requestId: data.requestId ?? null,
prospectsAssigned: data.prospectsAssigned ?? [],
prospectsNotAssigned: data.prospectsNotAssigned ?? [],
},
}
},

outputs: {
requestId: {
type: 'string',
description: 'A Gong request reference ID for troubleshooting purposes',
optional: true,
},
prospectsAssigned: {
type: 'array',
description: 'Prospects successfully assigned to the flow',
items: {
type: 'object',
properties: {
flowId: { type: 'string', description: 'The flow ID' },
flowName: { type: 'string', description: 'The flow name' },
crmProspectId: { type: 'string', description: 'The CRM prospect ID' },
flowInstanceId: { type: 'string', description: 'The created flow instance ID' },
flowInstanceOwnerEmail: {
type: 'string',
description: 'Email of the flow instance owner',
},
flowInstanceOwnerFullName: {
type: 'string',
description: 'Full name of the flow instance owner',
},
flowInstanceCreateDate: {
type: 'string',
description: 'Creation time of the flow instance in ISO-8601 format',
},
flowInstanceStatus: { type: 'string', description: 'Status of the flow instance' },
workspaceId: { type: 'string', description: 'Workspace ID' },
exclusive: {
type: 'boolean',
description: 'Whether this prospect can be added to other flows',
},
},
},
},
prospectsNotAssigned: {
type: 'array',
description: 'Prospects that failed to be assigned to the flow',
items: {
type: 'object',
properties: {
flowId: { type: 'string', description: 'The flow ID' },
crmProspectId: { type: 'string', description: 'The CRM prospect ID' },
errorCode: {
type: 'string',
description: 'Failure reason: InvalidArgument, InvalidState, or UnexpectedError',
},
errorMessage: { type: 'string', description: 'Human-readable failure message' },
},
},
},
},
}
2 changes: 2 additions & 0 deletions apps/sim/tools/gong/get_extensive_calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export const getExtensiveCallsTool: ToolConfig<
const body: Record<string, unknown> = {
filter,
contentSelector: {
context: 'Extended',
contextTiming: ['Now', 'TimeOfCall'],
exposedFields: {
parties: true,
content: {
Expand Down
Loading
Loading