-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat(triggers): add Gong webhook triggers for call events #3984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+282
−2
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2f3e382
feat(triggers): add Gong webhook triggers for call events
waleedlatif1 9bb5bd0
fix(triggers): reorder Gong trigger spread and dropdown options
waleedlatif1 5a71158
fix(triggers): resolve Biome lint errors in Gong trigger files
waleedlatif1 a79bb4b
json
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import type { | ||
| FormatInputContext, | ||
| FormatInputResult, | ||
| WebhookProviderHandler, | ||
| } from '@/lib/webhooks/providers/types' | ||
|
|
||
| export const gongHandler: WebhookProviderHandler = { | ||
| async formatInput({ body }: FormatInputContext): Promise<FormatInputResult> { | ||
| const b = body as Record<string, unknown> | ||
| const callData = b.callData as Record<string, unknown> | undefined | ||
| const metaData = (callData?.metaData as Record<string, unknown>) || {} | ||
| const content = callData?.content as Record<string, unknown> | undefined | ||
|
|
||
| return { | ||
| input: { | ||
| isTest: b.isTest ?? false, | ||
| callData, | ||
| metaData, | ||
| parties: (callData?.parties as unknown[]) || [], | ||
| context: (callData?.context as unknown[]) || [], | ||
| trackers: (content?.trackers as unknown[]) || [], | ||
waleedlatif1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| } | ||
| }, | ||
| } | ||
waleedlatif1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import { GongIcon } from '@/components/icons' | ||
| import type { TriggerConfig } from '@/triggers/types' | ||
| import { buildCallOutputs, gongSetupInstructions } from './utils' | ||
|
|
||
| /** | ||
| * Gong Call Completed Trigger | ||
| * | ||
| * Secondary trigger - does NOT include the dropdown (the generic webhook trigger has it). | ||
| * Fires when a call matching the configured rule is processed in Gong. | ||
| */ | ||
| export const gongCallCompletedTrigger: TriggerConfig = { | ||
| id: 'gong_call_completed', | ||
| name: 'Gong Call Completed', | ||
| provider: 'gong', | ||
| description: 'Trigger workflow when a call is completed and processed in Gong', | ||
| version: '1.0.0', | ||
| icon: GongIcon, | ||
|
|
||
| subBlocks: [ | ||
| { | ||
| id: 'webhookUrlDisplay', | ||
| title: 'Webhook URL', | ||
| type: 'short-input', | ||
| readOnly: true, | ||
| showCopyButton: true, | ||
| useWebhookUrl: true, | ||
| placeholder: 'Webhook URL will be generated', | ||
| mode: 'trigger', | ||
| condition: { | ||
| field: 'selectedTriggerId', | ||
| value: 'gong_call_completed', | ||
| }, | ||
| }, | ||
| { | ||
| id: 'triggerSave', | ||
| title: '', | ||
| type: 'trigger-save', | ||
| hideFromPreview: true, | ||
| mode: 'trigger', | ||
| triggerId: 'gong_call_completed', | ||
| condition: { | ||
| field: 'selectedTriggerId', | ||
| value: 'gong_call_completed', | ||
| }, | ||
| }, | ||
waleedlatif1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| id: 'triggerInstructions', | ||
| title: 'Setup Instructions', | ||
| hideFromPreview: true, | ||
| type: 'text', | ||
| defaultValue: gongSetupInstructions('Call Completed'), | ||
| mode: 'trigger', | ||
| condition: { | ||
| field: 'selectedTriggerId', | ||
| value: 'gong_call_completed', | ||
| }, | ||
| }, | ||
| ], | ||
|
|
||
| outputs: buildCallOutputs(), | ||
|
|
||
| webhook: { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| }, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { gongCallCompletedTrigger } from './call_completed' | ||
| export { gongWebhookTrigger } from './webhook' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import type { TriggerOutput } from '@/triggers/types' | ||
|
|
||
| /** | ||
| * Shared trigger dropdown options for all Gong triggers | ||
| */ | ||
| export const gongTriggerOptions = [ | ||
| { label: 'General Webhook (All Events)', id: 'gong_webhook' }, | ||
| { label: 'Call Completed', id: 'gong_call_completed' }, | ||
| ] | ||
|
|
||
| /** | ||
| * Generate setup instructions for a specific Gong event type | ||
| */ | ||
| export function gongSetupInstructions(eventType: string): string { | ||
| const instructions = [ | ||
| '<strong>Note:</strong> You need admin access to Gong to set up webhooks. See the <a href="https://help.gong.io/docs/create-a-webhook-rule" target="_blank" rel="noopener noreferrer">Gong webhook documentation</a> for details.', | ||
| 'Copy the <strong>Webhook URL</strong> above.', | ||
| 'In Gong, go to <strong>Admin center > Settings > Ecosystem > Automation rules</strong>.', | ||
| 'Click <strong>"+ Add Rule"</strong> to create a new automation rule.', | ||
| `Configure rule filters to match <strong>${eventType}</strong> calls.`, | ||
| 'Under Actions, select <strong>"Fire webhook"</strong>.', | ||
| 'Paste the Webhook URL into the destination field.', | ||
| 'Choose an authentication method (URL includes key or Signed JWT header).', | ||
| 'Save the rule and click <strong>"Save"</strong> above to activate your trigger.', | ||
| ] | ||
|
|
||
| return instructions | ||
| .map( | ||
| (instruction, index) => | ||
| `<div class="mb-3">${index === 0 ? instruction : `<strong>${index}.</strong> ${instruction}`}</div>` | ||
| ) | ||
| .join('') | ||
| } | ||
|
|
||
| /** | ||
| * Build output schema for call events. | ||
| * Gong webhooks deliver call data including metadata, participants, context, and content analysis. | ||
| */ | ||
| export function buildCallOutputs(): Record<string, TriggerOutput> { | ||
| return { | ||
| isTest: { | ||
| type: 'boolean', | ||
| description: 'Whether this is a test webhook from the Gong UI', | ||
| }, | ||
| callData: { | ||
| type: 'json', | ||
| description: 'Full call data object', | ||
| }, | ||
| metaData: { | ||
| id: { type: 'string', description: 'Gong call ID' }, | ||
| url: { type: 'string', description: 'URL to the call in Gong' }, | ||
| title: { type: 'string', description: 'Call title' }, | ||
| scheduled: { type: 'string', description: 'Scheduled start time (ISO 8601)' }, | ||
| started: { type: 'string', description: 'Actual start time (ISO 8601)' }, | ||
| duration: { type: 'number', description: 'Call duration in seconds' }, | ||
| primaryUserId: { type: 'string', description: 'Primary Gong user ID' }, | ||
| direction: { type: 'string', description: 'Call direction (Conference, Call, etc.)' }, | ||
| system: { type: 'string', description: 'Meeting system (Zoom, Teams, etc.)' }, | ||
| scope: { type: 'string', description: 'Call scope (External or Internal)' }, | ||
| media: { type: 'string', description: 'Media type (Video or Audio)' }, | ||
| language: { type: 'string', description: 'Call language code' }, | ||
| }, | ||
| parties: { | ||
| type: 'array', | ||
| description: 'Array of call participants with name, email, title, and affiliation', | ||
| }, | ||
| context: { | ||
| type: 'array', | ||
| description: 'Array of CRM context objects (Salesforce opportunities, accounts, etc.)', | ||
| }, | ||
| trackers: { | ||
| type: 'array', | ||
| description: 'Array of tracked topics/keywords with counts', | ||
| }, | ||
| } as Record<string, TriggerOutput> | ||
| } | ||
|
|
||
| /** | ||
| * Build output schema for generic webhook events. | ||
| * Uses the same call output structure since Gong webhooks primarily deliver call data. | ||
| */ | ||
| export function buildGenericOutputs(): Record<string, TriggerOutput> { | ||
| return buildCallOutputs() | ||
| } | ||
waleedlatif1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { GongIcon } from '@/components/icons' | ||
| import type { TriggerConfig } from '@/triggers/types' | ||
| import { buildGenericOutputs, gongSetupInstructions, gongTriggerOptions } from './utils' | ||
|
|
||
| /** | ||
| * Gong Generic Webhook Trigger | ||
| * | ||
| * Primary trigger - includes the dropdown for selecting trigger type. | ||
| * Accepts all webhook events from Gong automation rules. | ||
| */ | ||
| export const gongWebhookTrigger: TriggerConfig = { | ||
| id: 'gong_webhook', | ||
| name: 'Gong Webhook', | ||
| provider: 'gong', | ||
| description: 'Generic webhook trigger for all Gong events', | ||
| version: '1.0.0', | ||
| icon: GongIcon, | ||
|
|
||
| subBlocks: [ | ||
| { | ||
| id: 'selectedTriggerId', | ||
| title: 'Trigger Type', | ||
| type: 'dropdown', | ||
| mode: 'trigger', | ||
| options: gongTriggerOptions, | ||
| value: () => 'gong_webhook', | ||
| required: true, | ||
| }, | ||
waleedlatif1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| id: 'webhookUrlDisplay', | ||
| title: 'Webhook URL', | ||
| type: 'short-input', | ||
| readOnly: true, | ||
| showCopyButton: true, | ||
| useWebhookUrl: true, | ||
| placeholder: 'Webhook URL will be generated', | ||
| mode: 'trigger', | ||
| condition: { | ||
| field: 'selectedTriggerId', | ||
| value: 'gong_webhook', | ||
| }, | ||
| }, | ||
| { | ||
| id: 'triggerSave', | ||
| title: '', | ||
| type: 'trigger-save', | ||
| hideFromPreview: true, | ||
| mode: 'trigger', | ||
| triggerId: 'gong_webhook', | ||
| condition: { | ||
| field: 'selectedTriggerId', | ||
| value: 'gong_webhook', | ||
| }, | ||
| }, | ||
| { | ||
| id: 'triggerInstructions', | ||
| title: 'Setup Instructions', | ||
| hideFromPreview: true, | ||
| type: 'text', | ||
| defaultValue: gongSetupInstructions('All Events'), | ||
| mode: 'trigger', | ||
| condition: { | ||
| field: 'selectedTriggerId', | ||
| value: 'gong_webhook', | ||
| }, | ||
| }, | ||
| ], | ||
|
|
||
| outputs: buildGenericOutputs(), | ||
|
|
||
| webhook: { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| }, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.